Skip to content
This repository has been archived by the owner on Nov 28, 2021. It is now read-only.

2.0 Design Notes

Devraj Mukherjee edited this page Jul 23, 2013 · 3 revisions

Server error message

{
    "code": 406,
    "message": "Unacceptable parameter",
    "trace": {
            
 
    }
}

Development server YAML configuration

name: prestans-demo
version: 1.0
hostname: localhost
port: 8000

path:
- ext/
- app/

environ:
- key: app_config
  value: config/app.config

static:
- url: /img
  directory: static/img

handlers:
- url: /api
  handler: pdemo.handler.application

Sample Pseudo Code:

import prestans.rest

wsgi_rest_app = prestans.rest.Router(

    routes=[
        (r'', prestans.demo.Category)
    ],
    inflators=[],
    deflators=[],
    application_name='prestans',
    debug=False
)

wsgi_rest_app.add_route()

#:
#: Parsers
#:

class KeywordParameterSet(prestans.parser.ParameterSet):

    keywords = prestans.types.String()

#: 
#: Handler
#:

class MyRestHandler(prestans.rest.Handler):

    class Providers:

        authentication = AuthenticationProvider()
        cache = CacheProvider()
        throttle = ThrottleProvider()

    class Rule:

        POST = prestans.rest.RuleSet(
            response=prestans.rest.ResponseRule(
                attribute_filter=AttributeFilter()
                body_template=Model()
            ),
            request=prestans.rest.RequestRule(
                parameter_sets=[
                    KeywordParameterSet()
                ],
                body_template=Model()
                attribute_filter=AttributeFilter()
            )
        )



    def handler_will_run(self):
        pass

    def handler_did_run(self):
        pass

    def get(self, parent_id):


Clone this wiki locally