fobi package

Subpackages

Submodules

fobi.admin module

fobi.app module

fobi.app.app_name(path, reduce_depth_by=1)[source]

Returns another path by reducing the depth by one.

Parameters:
  • path (str) – Absolute app path (from project root).
  • reduce_depth_by (int) –
Return str:
fobi.app.app_config(path, config_app_path='apps.Config')[source]
Parameters:
  • path (str) – Absolute app path (from project root).
  • config_app_path (str) – Relative config path (from app root)
Return str:

fobi.apps module

class fobi.apps.Config(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

label = 'fobi'
name = 'fobi'

fobi.base module

fobi.compat module

fobi.conf module

fobi.conf.get_setting(setting, override=None)[source]

Get a setting from fobi conf module, falling back to the default.

If override is not None, it will be used instead of the setting.

Parameters:
  • setting – String with setting name
  • override – Value to use when no setting is available. Defaults to None.
Returns:

Setting value.

fobi.constants module

fobi.context_processors module

fobi.data_structures module

class fobi.data_structures.SortableDict(data=None)[source]

Bases: dict

A dictionary that keeps its keys in the order in which they’re inserted. Very similar to (and partly based on) SortedDict of the Django, but has several additional methods implemented, such as: insert_before_key and insert_after_key.

clear()[source]
copy()[source]

Returns a copy of this object.

insert(index, key, value)[source]

Inserts the key, value pair before the item with the given index.

insert_after_key(target_key, key, value, fail_silently=True)[source]

Inserts the {key: value} after the target_key.

Parameters:
  • target_key (immutable) –
  • key (immutable) –
  • value (mutable) –
  • fail_silently (boolean) –
  • offset (int) –
Return bool:
insert_before_key(target_key, key, value, fail_silently=True, offset=0)[source]

Inserts the {key: value} before the target_key.

Parameters:
  • target_key (immutable) –
  • key (immutable) –
  • value (mutable) –
  • fail_silently (boolean) –
  • offset (int) –
Return bool:
items()[source]
iteritems()
iterkeys()
itervalues()
keys()[source]
move_after_key(source_key, target_key, fail_silently=True)[source]

Moves the {key: value} after the given source_key.

Parameters:
  • source_key (immutable) –
  • target_key (immutable) –
  • fail_silently (boolean) –
Return bool:
move_before_key(source_key, target_key, fail_silently=True, offset=0)[source]

Moves the {key: value} before the given source_key.

Parameters:
  • source_key (immutable) –
  • target_key (immutable) –
  • fail_silently (boolean) –
  • offset (int) –
Return bool:
pop(k, *args)[source]
popitem()[source]
setdefault(key, default)[source]
update(dict_)[source]
value_for_index(index)[source]

Returns the value of the item at the given zero-based index.

values()[source]

fobi.decorators module

fobi.decorators.permissions_required(perms, satisfy='all', login_url=None, raise_exception=False)[source]

Checks for the permissions given based on the strategy chosen.

Parameters:
  • perms (iterable) –
  • satisfy (string) – Allowed values are “all” and “any”.
  • login_url (string) –
  • raise_exception (bool) – If set to True, the PermissionDenied exception is raised on failures.
Return bool:
Example:
>>> @login_required
>>> @permissions_required(satisfy='any', perms=[
>>>     'fobi.add_formentry',
>>>     'fobi.change_formentry',
>>>     'fobi.delete_formentry',
>>>     'fobi.add_formelemententry',
>>>     'fobi.change_formelemententry',
>>>     'fobi.delete_formelemententry',
>>> ])
>>> def edit_dashboard(request):
>>>     # your code
fobi.decorators.all_permissions_required(perms, login_url=None, raise_exception=False)[source]
Example:
>>> @login_required
>>> @all_permissions_required([
>>>     'fobi.add_formentry',
>>>     'fobi.change_formentry',
>>>     'fobi.delete_formentry',
>>>     'fobi.add_formelemententry',
>>>     'fobi.change_formelemententry',
>>>     'fobi.delete_formelemententry',
>>> ])
>>> def edit_dashboard(request):
>>>     # your code
fobi.decorators.any_permission_required(perms, login_url=None, raise_exception=False)[source]
Example:
>>> @login_required
>>> @any_permission_required([
>>>     'fobi.add_formentry',
>>>     'fobi.change_formentry',
>>>     'fobi.delete_formentry',
>>>     'fobi.add_formelemententry',
>>>     'fobi.change_formelemententry',
>>>     'fobi.delete_formelemententry',
>>> ])
>>> def edit_dashboard(request):
>>>     # your code

fobi.defaults module

fobi.discover module

fobi.dynamic module

fobi.dynamic.assemble_form_class(form_entry, base_class=<class 'django.forms.forms.BaseForm'>, request=None, origin=None, origin_kwargs_update_func=None, origin_return_func=None, form_element_entries=None)[source]

Assembles a form class by given entry.

Parameters:
  • form_entry
  • base_class
  • request (django.http.HttpRequest) –
  • origin (string) –
  • origin_kwargs_update_func (callable) –
  • origin_return_func (callable) –
  • form_element_entries (iterable) – If given, used instead of form_entry.formelemententry_set.all (no additional database hit).

fobi.exceptions module

exception fobi.exceptions.BaseException[source]

Bases: exceptions.Exception

Base exception.

exception fobi.exceptions.ImproperlyConfigured[source]

Bases: fobi.exceptions.BaseException

Exception raised when developer didn’t configure/write the code properly.

exception fobi.exceptions.InvalidRegistryItemType[source]

Bases: exceptions.ValueError, fobi.exceptions.BaseException

Raised when an attempt is made to register an item in the registry which does not have a proper type.

exception fobi.exceptions.DoesNotExist[source]

Bases: fobi.exceptions.BaseException

Raised when something does not exist.

exception fobi.exceptions.ThemeDoesNotExist[source]

Bases: fobi.exceptions.DoesNotExist

Raised when no theme with given uid can be found.

exception fobi.exceptions.PluginDoesNotExist[source]

Bases: fobi.exceptions.DoesNotExist

Raised when no plugin with given uid can be found.

exception fobi.exceptions.FormElementPluginDoesNotExist[source]

Bases: fobi.exceptions.PluginDoesNotExist

Raised when no form element plugin with given uid can be found.

exception fobi.exceptions.FormHandlerPluginDoesNotExist[source]

Bases: fobi.exceptions.PluginDoesNotExist

Raised when no form handler plugin with given uid can be found.

exception fobi.exceptions.NoDefaultThemeSet[source]

Bases: fobi.exceptions.ImproperlyConfigured

Raised when no active theme is chosen.

exception fobi.exceptions.FormPluginError[source]

Bases: fobi.exceptions.BaseException

Base error for form elements and handers.

exception fobi.exceptions.FormElementPluginError[source]

Bases: fobi.exceptions.FormPluginError

Raised when form element plugin error occurs.

exception fobi.exceptions.FormHandlerPluginError[source]

Bases: fobi.exceptions.FormPluginError

Raised when form handler plugin error occurs.

exception fobi.exceptions.FormCallbackError[source]

Bases: fobi.exceptions.FormPluginError

Raised when form callback error occurs.

fobi.form_importers module

fobi.form_utils module

fobi.forms module

fobi.helpers module

fobi.models module

fobi.settings module

  • RESTRICT_PLUGIN_ACCESS (bool): If set to True, (Django) permission system for fobi plugins is enabled.
  • FORM_ELEMENT_PLUGINS_MODULE_NAME (str): Name of the module to placed in the (external) apps in which the fobi form element plugin code should be implemented and registered.
  • FORM_HANDLER_PLUGINS_MODULE_NAME (str): Name of the module to placed in the (external) apps in which the fobi form handler plugin code should be implemented and registered.
  • FORM_CALLBACKS_MODULE_NAME (str): Name of the module to placed in the (external) apps in which the fobi form callback code should be implemented and registered.
  • FORM_HANDLER_PLUGINS_EXECUTION_ORDER (tuple): Order in which the form handler plugins are to be executed.
  • DEBUG

fobi.test module

fobi.utils module

fobi.validators module

fobi.validators.url_exists(url, local=False)[source]

Check if URL exists.

Parameters:
  • url (str) –
  • local (bool) –
Return bool:

fobi.views module

fobi.widgets module

class fobi.widgets.NumberInput(attrs=None)[source]

Bases: django.forms.widgets.TextInput

input_type = u'number'
media
class fobi.widgets.BooleanRadioSelect(*args, **kwargs)[source]

Bases: django.forms.widgets.RadioSelect

Boolean radio select for Django.

Example:
>>> class DummyForm(forms.Form):
>>>     agree = forms.BooleanField(label=_("Agree?"), required=False, widget=BooleanRadioSelect)
media

Module contents