Re: CorePost - a tiny Flask-style REST microframework for twisted.web

Jacek Furmankiewicz <[email protected]>
Newsgroups gmane.comp.python.twisted.web
Message-ID <CAGDztiHF5S4K7ACSP03R1i2hsCwpBdRAHNaUJOgyjS4EaMBLrQ@mail.gmail.com>
Hi, I just uploaded CorePost 0.0.5 to PyPi.

CorePost is a REST microframework built on top of the core twisted.web APIs,
providing a Flask-inspired API for building REST applications.

Version 0.0.5 integrates FormEncode for integrated path/form/query argument
validation,
similar to the way Pylons/TurboGears use it.

Example:

from corepost.web import CorePost, validate
from corepost.enums import Http
from formencode import Schema, validators

app = CorePost()

class TestSchema(Schema):
    allow_extra_fields = True
    childId = validators.Regex(regex="^value1|value2$")

@app.route("/validate/<int:rootId>/schema",Http.POST)
@validate(schema=TestSchema)
def postValidateSchema(request,rootId,childId,**kwargs):
    '''Validate using a common schema'''
    return "%s - %s - %s" % (rootId,childId,kwargs)

@app.route("/validate/<int:rootId>/custom",Http.POST)
@validate(childId=validators.Regex(regex="^value1|value2$"))
def postValidateCustom(request,rootId,childId,**kwargs):
    '''Validate using argument-specific validators'
    return "%s - %s - %s" % (rootId,childId,kwargs)


More docs on our site:
https://github.com/jacek99/corepost

Any feedback is welcome

Cheers,
Jacek

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.