pyams_utils.interfaces
package ⊞¶
PyAMS_utils.interfaces module
This module defines generic constants and interfaces.
-
interface
pyams_utils.interfaces.
ICacheKeyValue
[source]¶ Interface used to get string representation of a given object as cache key
Several default adapters are given for objects (using their “id()”), strings (using string as key) and for persistent objects (using their persistent OID); you are free to provide your own adapters.
-
interface
pyams_utils.interfaces.
IObjectFactory
[source]¶ Object factory interface
This interface can be used to register an “interface’s object factory”. For a given interface, such factory can be used to get an instance of an object providing this interface; several factories can be registered for the same interface if they have distinct names. See
pyams_utils.factory
module.
-
interface
pyams_utils.interfaces.
IOptionalUtility
[source]¶ Marker interface for utilities that can be removed
-
exception
pyams_utils.interfaces.
MissingRequestError
[source]¶ Bases:
Exception
Error raised when no request is available
pyams_utils.interfaces.data
¶
PyAMS_utils data interface
This interface allows to define custom “data” properties on any object providing IObjectData interface. These properties are used to render “data” attributes into HTML code.
-
interface
pyams_utils.interfaces.data.
IObjectData
[source]¶ Object data generic interface
Objects providing this interface can create an ‘object_data’ dictionary attribute which will be used to create matching HTML data attributes.
-
object_data
¶ Data associated with this object
Implementation: zope.schema.Dict
Read Only: False Required: False Default Value: None Allowed Type: dict
-
pyams_utils.interfaces.inherit
¶
PyAMS_utils.interfaces.inherit module
This module defines interfaces which are used by the inherit
module
-
interface
pyams_utils.interfaces.inherit.
IInheritInfo
[source]¶ Extends:
pyramid.interfaces.ILocation
Inheritance info
-
target_interface
¶ Parent target interface
-
adapted_interface
¶ Context or parent adapted interface
-
parent
¶ First parent supporting target interface
-
can_inherit
¶ Can inherit from parent?
-
inherit
¶ Inherit from parent?
Implementation: zope.schema.Bool
Read Only: False Required: False Default Value: True Allowed Type: bool
-
no_inherit
¶ Don’t inherit from parent?
Implementation: zope.schema.Bool
Read Only: False Required: False Default Value: False Allowed Type: bool
-
inherit_from
¶ Parent from which adapted interface is inherited
-
pyams_utils.interfaces.intids
¶
PyAMS_utils.interfaces.intids module
Small set of interfaces used by IIntIds utilities.
pyams_utils.interfaces.site
¶
pyams_utils.interfaces.size
¶
PyAMS_utils.interfaces.size module
This module provides a simple interface for objects handling length attribute
pyams_utils.interfaces.tales
¶
PyAMS_utils.interfaces.tales module
TALES extensions are custom adapters which can be used to extend Chameleon and Zope templates.
-
interface
pyams_utils.interfaces.tales.
ITALESExtension
[source]¶ Custom TALES extension
These extensions will be registered throught adapters for (context, request, view) or (context, request).
-
render
(self, context=None)¶ Render extension
This method can return HTML code which will be inserted directly into an HTML template, but can also return any value which will be assigned to a local template variable.
-
pyams_utils.interfaces.text
¶
PyAMS_utils.interfaces.text module
This module provides a single interface used by HTML rendering adapters, which are used to convert any object to an HTML representation.
-
interface
pyams_utils.interfaces.text.
IHTMLRenderer
[source]¶ Text renderer interface
HTML renderers are implemented as adapters for a source object (which can be a string) and a request, so that you can easily implement custom renderers for any object and/or for any request layer.
-
label
¶ Optional renderer label
-
render
(self, **kwargs)¶ Render adapted text
-
pyams_utils.interfaces.timezone
¶
PyAMS_utils.interfaces.timezone module
This module provides timezone utility interface and schema field
-
interface
pyams_utils.interfaces.timezone.
IServerTimezone
[source]¶ Server timezone interface
-
timezone
¶ Server timezone
Default server timezone
Implementation: pyams_utils.schema.TimezoneField
Read Only: False Required: True Default Value: ‘GMT’
-
pyams_utils.interfaces.traversing
¶
PyAMS_utils.interfaces.traversing module
The IPathElements is used by an Hypatia index to store internal IDs of parents of a given objects; this allows to query catalog for objects which are located “inside” a given parent object, identified by it’s internal ID.
-
interface
pyams_utils.interfaces.traversing.
IPathElements
[source]¶ Path elements interface
-
parents
¶ Element parents
Internal IDs of parents objects
Implementation: zope.schema.List
Read Only: False Required: True Default Value: None Allowed Type: list
Value Type
Implementation: zope.schema.Int
Read Only: False Required: True Default Value: None Allowed Type: int
-
pyams_utils.interfaces.tree
¶
PyAMS_utils.interfaces.tree module
The interfaces provided by this module are used to manage trees.
-
interface
pyams_utils.interfaces.tree.
INode
[source]¶ Tree node interface
-
context
¶ Node’s context
-
label
¶ Node’s label
-
css_class
¶ Node’s CSS class
-
order
¶ Node’s order
-
get_level
(self)¶ Get depth level of current node
-
has_children
(self, filter_value=None)¶ Check if current node has children
-
get_children
(self, filter_value=None)¶ Get list of node children
-
pyams_utils.interfaces.url
¶
PyAMS_utils.interfaces.url module
These interfaces are used to define different types of URLs which can be used in a web site. These includes absolute URLs, canonical URLs and related URLs.
See PyAMS URL module
for a longer description.
pyams_utils.interfaces.zeo
¶
PyAMS_utils.interfaces.zeo module
This module provides interface definition for a ZEO connection
-
interface
pyams_utils.interfaces.zeo.
IZEOConnection
[source]¶ ZEO connection settings interface
-
name
¶ Connection name
Registration name of ZEO connection
Implementation: zope.schema.TextLine
Read Only: False Required: True Default Value: None Allowed Type: str
-
server_name
¶ ZEO server name
Hostname of ZEO server
Implementation: zope.schema.TextLine
Read Only: False Required: True Default Value: ‘localhost’ Allowed Type: str
-
server_port
¶ ZEO server port
Port number of ZEO server
Implementation: zope.schema.Int
Read Only: False Required: True Default Value: 8100 Allowed Type: int
-
storage
¶ ZEO server storage
Storage name on ZEO server
Implementation: zope.schema.TextLine
Read Only: False Required: True Default Value: ‘1’ Allowed Type: str
-
username
¶ ZEO user name
User name on ZEO server; only for ZEO server before 5.0
Implementation: zope.schema.TextLine
Read Only: False Required: False Default Value: None Allowed Type: str
-
password
¶ ZEO password
User password on ZEO server; only for ZEO server before 5.0
Implementation: zope.schema.Password
Read Only: False Required: False Default Value: None Allowed Type: str
-
server_realm
¶ ZEO server realm
Realm name on ZEO server; only for ZEO server before 5.0
Implementation: zope.schema.TextLine
Read Only: False Required: False Default Value: None Allowed Type: str
-
blob_dir
¶ BLOBs directory
Directory path for blob data
Implementation: zope.schema.TextLine
Read Only: False Required: False Default Value: None Allowed Type: str
Shared BLOBs directory ?
Flag whether the blob_dir is a server-shared filesystem that should be used instead of transferring blob data over zrpc.
Implementation: zope.schema.Bool
Read Only: False Required: True Default Value: False Allowed Type: bool
-
connection
¶ Current ZEO connection
-
get_settings
(self)¶ Get ZEO connection setting as a JSON dict
-
update
(self, settings)¶ Update internal fields with given settings dict
-
get_connection
(self, wait_timeout=30, get_storage=False)¶ Open ZEO connection with given settings
-