Base class for request/session
raised when find_one_entity() can not return one and only one entity
base class containing stuff shared by server session and web request
request/session is the main resources accessor, mainly through it’s vreg attribute:
|Attribute vreg:||the instance’s registry|
|the instance’s schema|
|the instance’s configuration|
return the root url of the instance
return an absolute URL using params dictionary key/values as URL parameters. Values are automatically URL quoted, and the publishing method to use may be specified or will be guessed.
if __secure__ argument is True, the request will try to build a https url.
raises ValueError if None is found in arguments
return encoded params to incorporate them in a URL
add a new entity of the given type
Example (in a shell session):
>>> c = create_entity('Company', name=u'Logilab') >>> create_entity('Person', firstname=u'John', surname=u'Doe', ... works_for=c)
return a tuple (type, sourceuri, extid) for the entity with id <eid>
return a result set for the given eid without doing actual query (we have the eid, we can suppose it exists and user has access to the entity)
return a guaranteed empty result
raise an exception if the given rql is not a select query
return an entity instance for the given eid. No query is done
return a fake result set for a particular entity type
find entities of the given type and attribute values.
>>> users = find('CWGroup', name=u"users").one() >>> groups = find('CWGroup').entities()
return a string for a date time according to instance’s configuration
return a string for floating point number according to instance’s configuration
return a string for a time according to instance’s configuration
cachename should be dotted names as in :
get a datetime or time from a string (according to etype) Datetime formatted as Date are accepted
return a displayablye value (i.e. unicode string)
return value of the property with the given key, giving priority to user specific value if any, else using site value
return the given url with newparams inserted. If any new params is already specified in the url, it’s overriden by the new value
newparams may only be mono-valued.
install i18n configuration for lang translation.
Raises KeyError if translation doesn’t exist.
return a list of (key, val) found in the url quoted query string
urllib.quote is not unicode safe, use this method to do the necessary encoding / decoding. Also it’s designed to quote each part of a url path and so the ‘/’ character will be encoded as well.
returns a unicode unquoted string
decoding is based on self.encoding which is the encoding used in url_quote
returns a dictionary with this user’s information.
The keys are :
Select object with the given id (__oid) then render it. If the object isn’t selectable, try to select fallback object if __fallback_oid is specified.
If specified initargs is expected to be a dictionary containing arguments that should be given to selection (hence to object’s __init__ as well), but not to render(). Other arbitrary keyword arguments will be given to selection and to render(), and so should be handled by object’s call or cell_call method..