proso_common package¶
Subpackages¶
Submodules¶
proso_common.context_processors module¶
proso_common.json_enrich module¶
proso_common.middleware module¶
proso_common.models module¶
-
class
proso_common.models.
Config
(id, app_name, key, content, content_hash)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Config.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Config.
answer_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Config.
customconfig_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Config.
environmentinfo_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Config.
objects
= <proso_common.models.ConfigManager object>¶
-
exception
-
class
proso_common.models.
CustomConfig
(id, config, user, condition_key, condition_value)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
CustomConfig.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
CustomConfig.
config
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
CustomConfig.
objects
= <proso_common.models.CustomConfigManager object>¶
-
CustomConfig.
user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
exception
-
proso_common.models.
get_config
(app_name, key, config_name=None, required=False, default=None)[source]¶
-
proso_common.models.
instantiate_from_config
(app_name, key, default_class=None, default_parameters=None, pass_parameters=None, config_name=None)[source]¶
proso_common.urls module¶
proso_common.views module¶
-
proso_common.views.
custom_config
(request)[source]¶ Save user-specific configuration property.
- POST parameters (JSON keys):
- app_name: application name for which the configuration property is
- valid (e.g., proso_common)
key: name of the property value: value of the property (number, string, boolean, ...) condition_key (optional): name of the condition which is used to filter the property condition_value (optional): value for the condition filtering the property
-
proso_common.views.
languages
(request)[source]¶ Returns languages that are available in the system.
Returns Dict: language_code -> domain
-
proso_common.views.
log
(request)[source]¶ Log an event from the client to the server.
- POST parameters (JSON keys):
- message:
- description (str) of the logged event
- level:
- debug|info|warn|error
- data:
- additional data (JSON) describing the logged event
-
proso_common.views.
show_more
(request, post_process_fun, get_fun, object_class, should_cache=True, template='common_json.html', to_json_kwargs=None)[source]¶ Return list of objects of the given type.
- GET parameters:
- limit:
- number of returned objects (default 10, maximum 100)
- page:
- current page number
- filter_column:
- column name used to filter the results
- filter_value:
- value for the specified column used to filter the results
- user:
- identifier of the current user
- all:
- return all objects available instead of paging; be aware this parameter can be used only for objects for wich the caching is turned on
- db_orderby:
- database column which the result should be ordered by
- json_orderby:
- field of the JSON object which the result should be ordered by, it is less effective than the ordering via db_orderby; be aware this parameter can be used only for objects for which the caching is turned on
- desc
- turn on the descending order
- stats:
- turn on the enrichment of the objects by some statistics
- html
- turn on the HTML version of the API
- environment
- turn on the enrichment of the related environment values
-
proso_common.views.
show_one
(request, post_process_fun, object_class, id, template='common_json.html')[source]¶ Return object of the given type with the specified identifier.
- GET parameters:
- user:
- identifier of the current user
- stats:
- turn on the enrichment of the objects by some statistics
- html
- turn on the HTML version of the API