kotti.util

Inheritance Diagram

Inheritance diagram of kotti.util

class kotti.util.LinkRenderer(name, predicate=None)[source]

Bases: kotti.util.LinkBase

A menu link that renders a view to render the link.

selected(context, request)[source]

Returns True if the Link’s url, based on its name, matches the request url

If the link name is ‘’, it will be selected for all urls ending in ‘/’

class kotti.util.LinkParent(title, children)[source]

Bases: kotti.util.LinkBase

A menu link that renders sublinks in a dropdown.

selected(context, request)[source]

Returns True if the Link’s url, based on its name, matches the request url

If the link name is ‘’, it will be selected for all urls ending in ‘/’

exception kotti.util.DontCache[source]

Bases: exceptions.Exception

class kotti.util.LRUCacheSetItem(size)[source]

Bases: repoze.lru.LRUCache

kotti.util.extract_from_settings(prefix, settings=None)[source]
>>> settings = {
...     'kotti_twitter.foo_bar': '1', 'kotti.spam_eggs': '2'}
>>> print extract_from_settings('kotti_twitter.', settings)
{'foo_bar': '1'}
kotti.util.extract_depot_settings(prefix='kotti.depot.', settings=None)[source]

Merges items from a dictionary that have keys that start with prefix to a list of dictionaries.

Parameters:prefix (string) – A dotted string representing the prefix for the common values
Value settings:A dictionary with settings. Result is extracted from this
kotti.util.title_to_name(title, blacklist=(), max_length=None)[source]

If max_length is None, fallback to the name column size (kotti.resources.Node)

kotti.util.camel_case_to_name(text)[source]
>>> camel_case_to_name('FooBar')
'foo_bar'
>>> camel_case_to_name('TXTFile')
'txt_file'
>>> camel_case_to_name ('MyTXTFile')
'my_txt_file'
>>> camel_case_to_name('froBOZ')
'fro_boz'
>>> camel_case_to_name('f')
'f'