tcrudge package

Subpackages

tcrudge.utils package

Submodules

tcrudge.utils.json module

tcrudge.utils.json.json_serial(obj)

JSON serializer for objects not serializable by default json code.

Parameters:obj (date, datetime or UUID) – object to serialize
Returns:formatted and serialized object
Return type:str

tcrudge.utils.validation module

Module for common validation tools.

tcrudge.utils.validation.validate_integer(val, min_value=None, max_value=None, default=None)

Validates the input val parameter.

If it is can not be converted to integer, returns default_value.

If it is less than min_value, returns min_value.

If it is greater than max_value, returns max_value.

Parameters:
  • val (int, float, digital string) – number to validate
  • min_value (int) – min value of validation range
  • max_value (int) – max value of validation range
  • default (int) – default value to return in case of exception
Returns:

None, min, max, default or result - int

Return type:

NoneType, int

Module contents

Submodules

tcrudge.decorators module

tcrudge.handlers module

tcrudge.models module

tcrudge.response module

Functions to handle different response formats must receive two arguments:
  • handler: subclass of tornado.web.RequestHandler;
  • answer: dictionary with response data.

And it should return bytes.

tcrudge.response.response_json(handler, response)

Default JSON response.

Sets JSON content type to given handler.

Serializes result with JSON serializer and sends JSON as response body.

Returns:Bytes of JSONised response
Return type:bytes
tcrudge.response.response_msgpack(handler, response)

Optional MSGPACK response.

Sets MSGPACK content type to given handler.

Packs response with MSGPACK.

Returns:Bytes of MSGPACK packed response
Return type:bytes

Module contents

Simple async CRUDL framework based on Tornado and Peewee ORM.

Validates input using JSON-schema.

Supports JSON and MessagePack responses.