Utilities

The grok.util module provides functions which are less commonly used, and so are not available for import directly from the grok module.

grok.util.application_url()

This function is also available as a method on the grok.View class.

grok.util.application_url(request, obj, name=None, skin=<object object>, data={})[source]

Return the URL of the nearest enclosing grok.Application.

Raises ValueError if no application can be found.

grok.util.applySkin()

grok.util.applySkin(request, skin, skin_type)[source]

Change the presentation skin for this request.

grok.util.getApplication()

This function is also availbale in the main grok namespace and can be called as grok.getApplication().

grok.util.getApplication()[source]

Return the nearest enclosing grokcore.site.Application.

Raises ValueError if no application can be found.

grok.util.safely_locate_maybe()

grok.util.safely_locate_maybe(obj, parent, name)[source]

Set an object’s __parent__ (and __name__) if the object’s __parent__ attribute doesn’t exist yet or is None.

If the object provides ILocation, __parent__ and __name__ will be set directly. A location proxy will be returned otherwise.