View Api Documentation

Loading

Here is partial documentation of the View Object.


You can access these functions by typing 

${view.function(arguments}

or 

${structure: view.function(arguments)}

The former escapes the html tags. 

 

CONTEXT

These are methods that operate on the view context, namely the object that the view is displaying. 

hasTrueAttribute(attribute) Returns True if the context has the attriuted, and teh value is True.

safeMethod(attribute) Returns the avalue of the attributed, or None if there is no attributed. 

isBTreeContainer(*args) Returns True if it is a BTree Container. 

implements (dottedName) Returns True if the context implements the interface. 

URLS

These are methods that generate URLS. 

 

slashViewName(item, viewName)  Returns the short (Canonical) URL for an item.   /itemName/viewName

shortURL(viewName="")  This is the slashView name for the context object.

IURLSegment(item) Returns the default manage view name for an object.  This is used in the managemetn view.  ZMI. 

url( *args) With no arguments, returns the URL for the view.  With one argument returns the URL for the object.  With two arguments returns the url for the object with the appended view name. 

objectHref(obj,name) Returns an href string for an object, display the name. 

href(url,name,target=False) Returns an href string with an optional new target window. 

contextURL(name='"') Returns the url for the context object with an optional viewName

simpleUrl(item) Returns the URL for an item.  Only works on objects that are part of a ZODB tree.       

getDomain() Returns the current domain. 

domain(item) Returns the domain for an object, when multiple domains are present in the database.     

TREE

These are methods that operate on the entire tree. 

getRoot() Returns the root object. 

parents(item=None) Returns the parents of the context, or the item. 

parentalAcquire (name,context=None) Returns the object with the given name from among the parents of the context.

webClassAcquire(name,context=None)  Returns the object with the given name, for the webClass of the context.

acquireTitle() Looks up the first available title among the objects parents. 

acquireAttribute(attribute) Returns the attributed by looking it up among the parents.  

BREADCRUMBS

breadcrumbs() Returns the default breadcrumbs, no view defaults to index.

breadcrumbsParent() Returns the default breadcrumbs for the context parent. 

breadcrumbsIndex(item)  Returns the default breadcrumbs for the item.  No view defaults to index.

breadcrumbsManage() Returns the ./item/mange breadcrumbs. 

 

MISCELANEOUS

isAuthenticated() Returns True if the user is authenticated. 

urlEncode(str) Returns a string which can be passed in a URL. Uses urllib.parse.quote(str)

 debug(*args) Fires up the Python debugger.   You can pass it arguments to get their values.