Package trac :: Module resource :: Class IResourceManager

Class IResourceManager

source code

    object --+    
             |    
core.Interface --+
                 |
                IResourceManager

Instance Methods
basestring generator
get_resource_realms()
Return resource realms managed by the component.
source code
 
get_resource_url(resource, href, **kwargs)
Return the canonical URL for displaying the given resource.
source code
 
get_resource_description(resource, format='default', context=None, **kwargs)
Return a string representation of the resource, according to the format.
source code
bool
resource_exists(resource)
Check whether the given resource exists physically.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

get_resource_url(resource, href, **kwargs)

source code 

Return the canonical URL for displaying the given resource.

Note that if there's no special rule associated to this realm for creating URLs (i.e. the standard convention of using realm/id applies), then it's OK to not define this method.

Parameters:
  • resource - a Resource
  • href - an Href used for creating the URL

get_resource_description(resource, format='default', context=None, **kwargs)

source code 

Return a string representation of the resource, according to the format.

Additional keyword arguments can be given as extra information for some formats.

For example, the ticket with the id 123 is represented as:
  • '#123' in 'compact' format,
  • 'Ticket #123' for the default format.
  • 'Ticket #123 (closed defect): This is the summary' for the 'summary' format

Note that it is also OK to not define this method if there's no special way to represent the resource, in which case the standard representations 'realm:id' (in compact mode) or 'Realm id' (in default mode) will be used.

Parameters:
  • resource - the Resource to describe
  • format - the kind of description wanted. Typical formats are: 'default', 'compact' or 'summary'.
  • context (ResourceContext) - an optional rendering context to allow rendering rich output (like markup containing links)

resource_exists(resource)

source code 

Check whether the given resource exists physically.

Attempting to retrieve the model object for a non-existing resource should raise a ResourceNotFound exception. (''since 0.11.8'')

Returns: bool