Open source cms for mobile and desktop websites


nive.helper.ResolveName(name, base=None, raiseExcp=True)

Lookup python object by dotted python name. Wraps pyramid.DottedNameResolver.

returns object or None

nive.helper.ResolveAsset(name, base=None, raiseExcp=True)

Lookup asset path (template, json or any other file) and returns asset descriptor object or None.

nive.helper.ResolveConfiguration(conf, base=None)

Lookup configuration object by dotted python name. Returns interface and configuration object. Extends pyramid.DottedNameResolver with .json file support for configuration objects.

Supports the following cases:

  • Path and file name to .json file. requires type set to one of the configuration types: AppConf, FieldConf, DatabaseConf, RootConf, ObjectConf, ViewModuleConf, ViewConf, ToolConf, GroupConf
  • Dotted python name for configuration object including attribute name of configuration instance.
  • Dotted python name for object. Uses the convention to load the configuration from the ‘configuration’ attribute of the referenced object.
  • Configuration instance. Will just return it.

returns Interface, configuration

nive.helper.LoadConfiguration(conf, base=None)

same as ResolveConfiguration except only the configuration object is returned

nive.helper.FormatConfTestFailure(report, fmt='text')

Format configuration test() failure

returns string

nive.helper.ReplaceRenderer(viewModule, viewname, renderer)

Replace the renderer for a view in the given view module. :param viewModule: :param viewname: :param renderer: :return:


Extend the default pyramid json renderer with support for datetime and file storage objects. Call SetupJSONRenderer in the main function e.g.

config = Configurator(root_factory = getRoot, settings = settings)
nive.helper.ClassFactory(configuration, reloadClass=False, raiseError=True, base=None, storeConfAsStaticClassVar=False)

Creates a python class reference from configuration. Uses configuration.context as class and dynamically adds classes listed as configuration.extensions as base classes.

configuration requires

  • configuration.context
  • configuration.extensions [optional]

If reloadClass = False the class is cached as configuration._v_class.

storeConfAsStaticClassVar: experimental option. If true stores the configuration as part of the class.

nive.helper.GetClassRef(tag, reloadClass=False, raiseError=True, base=None)

Resolve class reference from python dotted string.

nive.helper.LoadListItems(fieldconf, app=None, obj=None, pool_type=None, force=False)

Load field list items for the given fieldconf. If force is False and fieldconf already contains list items, the existing fieldconf.listItems are returned. Set force=True to reload each time this function is called.

obj and pool_type are only used for workflow lookup.

returns dict list

© 2013 Nive GmbH