Code Monkey home page Code Monkey logo

restea's Introduction

ResTea: Simple RESTful server toolkit

Restea is a RESTful server toolkit aimed to be simple, fast and framework agnostic. It abstracts out the mapping between HTTP methods and functions, data passing between client and server and validation. It doesn't bound to any ORM etc.

Travis CI status Coveralls status

restea's People

Contributors

bodbdigr avatar kkszysiu avatar mylokin avatar neob91 avatar puentesarrin avatar sergeyglazyrindev avatar vinicius-ronconi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

restea's Issues

Raising exceptions after catching FieldSet-related exceptions

Hi Valery!

Restea is currenly raising Error and ConfigurationError when there is something wrong in payload request or with fields configured themselves but those are converted into RestError-subclassed exceptions.
https://github.com/bodbdigr/restea/blob/d0dbf7b/restea/resource.py#L201-L204

What is weird is the RestError-subclassed exceptions are being initialized passing the same catched instance of Error or ConfigurationError, which are actually not serializable, even for default formatter.

Do you think we can just use something like the following?

try:
    return self.fields.validate(payload_data)
except fields.FieldSet.Error as e:
    raise errors.BadRequestError(str(e))
except fields.FieldSet.ConfigurationError as e:
    raise errors.ServerError(str(e))

Thanks!

Decorators order

Hello,

In resource code, when applying decorators we are maybe using a wrong order, for instance:

class MyResource(Resource):
    decorators = [
        validate_authenticated_user,
        validate_permissions_on_user
    ]
    # ...

Anyone may think that the first ("validate_authenticated_user") will be called before to the second one ("validate_permissions"), but this is not actually how is working. May we can to apply decorators in reverse order?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.