API¶
-
class
coralillo.
Form
[source]¶ Parent class of the Model class, defines validation and other useful functions.
-
class
coralillo.
Model
(id=None, **kwargs)[source]¶ Defines a model that comunicates to the Redis database
-
__eq__
(other)[source]¶ Compares this object to another. Returns true if both are of the same class and have the same properties. Returns false otherwise
-
delete
()[source]¶ Deletes this model from the database, calling delete in each field to properly delete special cases
-
classmethod
get_by
(field, value)[source]¶ Tries to retrieve an isinstance of this model from the database given a value for a defined index. Return None in case of failure
-
classmethod
get_or_exception
(id)[source]¶ Tries to retrieve an instance of this model from the database or raises an exception in case of failure
-
static
is_object_key
()[source]¶ checks if the given key belongs to an object. Its easy since it depends on the key ending like: ‘:obj’
-
classmethod
members_key
()[source]¶ This key holds a set whose members are the ids that exist of objects from this class
-
permission
(restrict=None)[source]¶ Returns a fully qualified key name to a permission over this object
-
reload
()[source]¶ reloads this object so if it was updated in the database it now contains the new values
-
save
()[source]¶ Persists this object to the database. Each field knows how to store itself so we don’t have to worry about it
-
to_json
(fields=None, embed=None)[source]¶ Serializes this model to a JSON representation so it can be sent via an HTTP REST API
-
classmethod
tree_match
(field, string)[source]¶ Given a tree index, retrieves the ids atached to the given prefix, think of if as a mechanism for pattern suscription, where two models attached to the a, a:b respectively are found by the a:b string, because both model’s subscription key matches the string.
-