Package StagingAddOn :: Package content :: Module staging_tool :: Class StagingTool
[hide private]
[frames] | no frames]

Class StagingTool



Products.ATContentTypes.content.folder.ATFolder --+
                                                  |
                                                 StagingTool

This is the main tool used by StagingAddOn.

Instance Methods [hide private]
  canSetDefaultPage(self)
  exclude_from_nav(self)
  _setId(self, id)
  doNothing(self, *args, **kwargs)
  reindexObject(self, *args, **kwargs)
  unindexObject(self, *args, **kwargs)
  indexObject(self, *args, **kwargs)
  reindex_object(self, *args, **kwargs)
  unindex_object(self, *args, **kwargs)
  index_object(self, *args, **kwargs)
  Title(self)
  createNewVersion(self, obj, redirect=True)
Create a new version for obj and return the created object.
  isAllowedToCreateNewVersion(self, obj, raise_exceptions=False)
Return True iff the current user is allowed to create a new version of obj.
  promoteVersion(self, obj, comment='')
Swap currently published and new (obj) versions by renaming both, archive the currently published one, and return a tuple which contains the new published version and the old one.
  showPortlet(self, obj)
Return True iff the staging portlet should be shown on obj.
  getConfigFor(self, obj)
Return the StagingAddOn configuration for obj or None if it cannot be found.
  getVersions(self, obj, sortFunc=None)
Return versions of obj which are accessible by the current user.
  getStatus(self, obj)
Return status of obj.
  isCurrentVersion(self, obj)
Return True iff ``obj is the the current version.
  isTheNewVersion(self, obj)
Return True iff obj is a new version of another item.
  isAnOldVersion(self, obj)
Return True iff obj is an old version of another item.
  hasNewVersion(self, obj)
Return True iff obj has a new version.
  getNewVersion(self, obj)
Return the new version of obj or None if none exists or if the current user cannot access it.
  _getNewVersion(self, obj, unrestricted=False)
Return the new version of obj' or ``None if none exists or if the current user cannot access it.
  getCurrentVersion(self, obj)
Return the current version of obj, or None if none could be found.
  _getCurrentVersion(self, obj, unrestricted=False)
Return the current version of obj, or None if the referenced one could not be found or if the current user cannot access it.
  getVersionNumber(self, obj)
Return the version number of obj.
  installStagingFor(self, workflow_id='plone_workflow', published_id=('published',), publish_id=('publish',), archive_id='', expires=False)
Install staging configuration for workflow_id.
  uninstallStagingFor(self, workflow_id='plone_workflow')
Remove staging configuration for workflow_id.
  _duplicateObject(self, obj, new_id)
Duplicate object, try to rename it with new_id and return the copy.
  _copyReferenceFieldValues(self, orig, copy)
Copy values of ReferenceField``s of ``orig to copy.
  _updateBackReferences(self, old, new)
Update items which have references to old so that they instead have references to new.
  _getUID(self, obj)
Return an UID for obj.
  _generateIdForNewVersion(self, current_id)
Generate an id for the new version of an object whose id is current_id.
  _generateIdForOldVersion(self, current_id)
Generate an id for an old version of an object whose id is current_id.
  _removeWorkflowHistory(self, obj)
Remove workflow history of obj.

Class Variables [hide private]
  __implements__ = ATFolder.__implements__
  portal_type = 'StagingAddOnTool'
  meta_type = 'StagingAddOnTool'
  archetype_name = 'Staging tool'
  content_icon = 'staging_tool.gif'
  default_view = 'base_view'
  immediate_view = 'base_view'
  suppl_views = ()
  _at_rename_after_creation = False
  global_allow = False
  allow_discussion = False
  filter_content_types = True
  allowed_content_types = 'StagingAddOnConfiguration',
  actions = tuple(actions)
  schema = ATFolderSchema.copy()
  security = ClassSecurityInfo()
  decPrivate = security.declarePrivate
  decProtected = security.declareProtected
  decPublic = security.declarePublic

Method Details [hide private]

canSetDefaultPage(self)

 
None

exclude_from_nav(self)

 
None

_setId(self, id)

 
None

doNothing(self, *args, **kwargs)

 
None

reindexObject(self, *args, **kwargs)

 
None

unindexObject(self, *args, **kwargs)

 
None

indexObject(self, *args, **kwargs)

 
None

reindex_object(self, *args, **kwargs)

 
None

unindex_object(self, *args, **kwargs)

 
None

index_object(self, *args, **kwargs)

 
None

Title(self)

 
None

createNewVersion(self, obj, redirect=True)

 

Create a new version for obj and return the created object.

If redirect is True, the method redirects to the new version. (In this case, it does not return anything.)

If the current user cannot create an object in the same container as obj, the Unauthorized exception will be raised.

If obj is not the current version, the NotCurrentVersion exception is raised.

If a new version has already been created, the NewVersionAlreadyExists exception is raised.

isAllowedToCreateNewVersion(self, obj, raise_exceptions=False)

 

Return True iff the current user is allowed to create a new version of obj.

If raise_exceptions is True, exceptions may be raisen.

promoteVersion(self, obj, comment='')

 

Swap currently published and new (obj) versions by renaming both, archive the currently published one, and return a tuple which contains the new published version and the old one.

If the current version cannot be found, we do nothing and return None.

showPortlet(self, obj)

 

Return True iff the staging portlet should be shown on obj.

It checks if there is a staging configuration for the workflow of the displayed content.

getConfigFor(self, obj)

 
Return the StagingAddOn configuration for obj or None if it cannot be found.

getVersions(self, obj, sortFunc=None)

 

Return versions of obj which are accessible by the current user.

All versions of obj are returned, including obj itself. If sortFunc is provided, the method uses it to sort the items.

Warning: only viewable items are returned.

getStatus(self, obj)

 

Return status of obj.

Status can be "current version", "new version" or "old version".

isCurrentVersion(self, obj)

 
Return True iff ``obj is the the current version.

isTheNewVersion(self, obj)

 
Return True iff obj is a new version of another item.

isAnOldVersion(self, obj)

 
Return True iff obj is an old version of another item.

hasNewVersion(self, obj)

 

Return True iff obj has a new version.

This method actually checks if the reference to the new version still references an object.

getNewVersion(self, obj)

 
Return the new version of obj or None if none exists or if the current user cannot access it.

_getNewVersion(self, obj, unrestricted=False)

 

Return the new version of obj' or ``None if none exists or if the current user cannot access it.

If unrestricted is True, no security check is done: if a new version exists, it is returned, even if the current user cannot access it.

getCurrentVersion(self, obj)

 
Return the current version of obj, or None if none could be found.

_getCurrentVersion(self, obj, unrestricted=False)

 

Return the current version of obj, or None if the referenced one could not be found or if the current user cannot access it.

If unrestricted is True, no security check is done: if the current version exists, it is returned, even if the current user cannot access it.

getVersionNumber(self, obj)

 

Return the version number of obj.

Default is 1.

installStagingFor(self, workflow_id='plone_workflow', published_id=('published',), publish_id=('publish',), archive_id='', expires=False)

 
Install staging configuration for workflow_id.

uninstallStagingFor(self, workflow_id='plone_workflow')

 
Remove staging configuration for workflow_id.

_duplicateObject(self, obj, new_id)

 

Duplicate object, try to rename it with new_id and return the copy.

The current way of duplicating the object is:

  1. Copy and paste the object.
  2. Try to rename the copy as requested.
  3. Manually copy value of reference fields.
  4. Set creation date of the copy.
  5. Remove workflow history of the copy.

_copyReferenceFieldValues(self, orig, copy)

 

Copy values of ReferenceField``s of ``orig to copy.

orig and copy should obvisouly have the same schema.

_updateBackReferences(self, old, new)

 
Update items which have references to old so that they instead have references to new.

_getUID(self, obj)

 

Return an UID for obj.

This is only a wrapper around CMFUid's portal_uidhandler.

_generateIdForNewVersion(self, current_id)

 
Generate an id for the new version of an object whose id is current_id.

_generateIdForOldVersion(self, current_id)

 
Generate an id for an old version of an object whose id is current_id.

_removeWorkflowHistory(self, obj)

 
Remove workflow history of obj.

Class Variable Details [hide private]

__implements__

None
Value:
ATFolder.__implements__                                                
      

portal_type

None
Value:
'StagingAddOnTool'                                                     
      

meta_type

None
Value:
'StagingAddOnTool'                                                     
      

archetype_name

None
Value:
'Staging tool'                                                         
      

content_icon

None
Value:
'staging_tool.gif'                                                     
      

default_view

None
Value:
'base_view'                                                            
      

immediate_view

None
Value:
'base_view'                                                            
      

suppl_views

None
Value:
()                                                                     
      

_at_rename_after_creation

None
Value:
False                                                                  
      

global_allow

None
Value:
False                                                                  
      

allow_discussion

None
Value:
False                                                                  
      

filter_content_types

None
Value:
True                                                                   
      

allowed_content_types

None
Value:
'StagingAddOnConfiguration',                                           
      

actions

None
Value:
tuple(actions)                                                         
      

schema

None
Value:
ATFolderSchema.copy()                                                  
      

security

None
Value:
ClassSecurityInfo()                                                    
      

decPrivate

None
Value:
security.declarePrivate                                                
      

decProtected

None
Value:
security.declareProtected                                              
      

decPublic

None
Value:
security.declarePublic