nti.site.interfaces module¶
Site interfaces.
-
interface
nti.site.interfaces.
IHostPolicyFolder
[source]¶ Extends:
zope.site.interfaces.IFolder
A folder that should always have a site manager, and thus is a site, representing a policy for the host name. Persistent configuration related to that host should reside in this folder.
-
interface
nti.site.interfaces.
IHostPolicySiteManager
[source]¶ Extends:
zope.site.interfaces.ILocalSiteManager
A persistent local site manager that is tied to a site name. It should always have two bases, a non-persistent global IComponents configured through
z3c.baseregistry
and the persistent main dataserver site manager, in that order. This should be the site manager for anIHostPolicyFolder
-
interface
nti.site.interfaces.
IHostSitesFolder
[source]¶ Extends:
zope.site.interfaces.IFolder
A container for the sites, each of which should be an
IHostPolicyFolder
-
lastSynchronized
¶ The timestamp at which this object was last synchronized .
Implementation: nti.schema.field.Number
Read Only: False Required: True Default Value: 0.0 Allowed Type: numbers.Number
-
-
interface
nti.site.interfaces.
IMainApplicationFolder
[source]¶ Extends:
zope.site.interfaces.IFolder
The folder representing the application. The set of persistent components will be installed beneath this folder, and this folder will be an Site (with a site manager).
This may be the same thing as the root folder. As an implementation note, though, this is typically beneath the root folder and named something application specific (e.g., “dataserver2”).
-
interface
nti.site.interfaces.
ISiteMapping
[source]¶ Maps a site name to an alternate site. Useful when we do not want full fledged persistent sites. Should only be used after checking for an existing site.
-
get_target_site
(self)¶ Returns the target site as defined by this mapping.
:raises a
SiteNotFoundError
object if no site found
-
target_site_name
¶ The target site name
Implementation: zope.schema.TextLine
Read Only: False Required: True Default Value: None Allowed Type: unicode
-
source_site_name
¶ The source site name
Implementation: zope.schema.TextLine
Read Only: False Required: True Default Value: None Allowed Type: unicode
-
-
interface
nti.site.interfaces.
ISiteTransactionRunner
[source]¶ Something that runs code within a transaction, properly setting up the ZODB, persistent site, and its environment.
-
__call__
(func, retries=0, sleep=None, site_names=(), side_effect_free=False, root_folder_name=u'nti.dataserver')¶ Runs the function given in
func
in a transaction and application local site manager (defaulting to the current site manager).Parameters: - func (function) – A function of zero parameters to run. If it has a docstring, that will be used as the transactions note. A transaction will be begun before this function executes, and committed after the function completes. This function may be rerun if retries are requested, so it should be prepared for that.
- retries (int) – The number of times to retry the
transaction and execution of
func
iftransaction.interfaces.TransientError
is raised when committing. Defaults to zero (so the job runs once). If you specify None, an implementation-specific number of retries will be used. - sleep (float) – If not none, then the greenlet running this function will sleep for this long between retry attempts.
- site_names – DEPRECATED. Sequence of strings giving the virtual host names to use. If you do not provide this argument, then the currently installed site will be maintained when the transaction is run. NOTE: The implementation of this may maintain either the site names or the actual site object.
- side_effect_free (bool) – If true (not the default), then the function is assummed to have no side effects that need to be committed; the transaction runner is free to abort/rollback or commit the transaction at its leisure.
- root_folder_name (str) – This names the folder that can be found in the root of the ZODB that will serve as the starting point to look for the persistent named site.
Returns: The value returned by the first successful invocation of
func
.
-
-
interface
nti.site.interfaces.
ITransactionSiteNames
[source]¶ An interface for a utility that return a list of the possible site names needed whenever transaction is run.
-
__call__
(*args, **kwargs)¶ Return the possible site names
-
-
exception
nti.site.interfaces.
InappropriateSiteError
[source]¶ Bases:
exceptions.LookupError
Raised if the installed site is not suitable to work with.
Currently no code in this package raises this exception.