Back to index

plone3  3.1.7
Classes | Functions | Variables
ZopeVersionControl.Utility Namespace Reference

Classes

class  VersionInfo
class  ReadOnlyJar
class  VersionControlError

Functions

def isAVersionableResource
def _findUserId
def _findPath
def _findModificationTime

Variables

tuple _dtmldir = os.path.join( package_home( globals() ), 'dtml' )
string use_vc_permission = 'Use version control'

Class Documentation

class ZopeVersionControl::Utility::VersionControlError

Definition at line 105 of file Utility.py.


Function Documentation

Find the last modification time for a version-controlled object.
   The modification time reflects the latest modification time of
   the object or any of its persistent subobjects that are not
   themselves version-controlled objects. Note that this will
   return None if the object has no modification time.

Definition at line 118 of file Utility.py.

00118 
00119 def _findModificationTime(object):
00120     """Find the last modification time for a version-controlled object.
00121        The modification time reflects the latest modification time of
00122        the object or any of its persistent subobjects that are not
00123        themselves version-controlled objects. Note that this will
00124        return None if the object has no modification time."""
00125 
00126     mtime = getattr(object, '_p_mtime', None)
00127     if mtime is None:
00128         return None
00129 
00130     latest = mtime
00131     conn = object._p_jar
00132     load = conn._storage.load
00133     version = conn._version
00134     refs = referencesf
00135 
00136     oids=[object._p_oid]
00137     done_oids={}
00138     done=done_oids.has_key
00139     first = 1
00140 
00141     while oids:
00142         oid=oids[0]
00143         del oids[0]
00144         if done(oid):
00145             continue
00146         done_oids[oid]=1
00147         try: p, serial = load(oid, version)
00148         except: pass # invalid reference!
00149         else:
00150             if first is not None:
00151                 first = None
00152             else:
00153                 if p.find('U\x0b__vc_info__') == -1:
00154                     mtime = TimeStamp(serial).timeTime()
00155                     if mtime > latest:
00156                         latest = mtime
00157             refs(p, oids)
00158 
00159     return latest
00160 

Here is the call graph for this function:

def ZopeVersionControl.Utility._findPath (   object) [private]

Definition at line 114 of file Utility.py.

00114 
00115 def _findPath(object):
00116     path = object.getPhysicalPath()
00117     return '/'.join(path)

Here is the caller graph for this function:

Definition at line 110 of file Utility.py.

00110 
00111 def _findUserId():
00112     user = getSecurityManager().getUser()
00113     return user.getUserName()

Here is the call graph for this function:

Here is the caller graph for this function:

True if an object is versionable.

To qualify, the object must be persistent (have its own db record), and
must not have an true attribute named '__non_versionable__'.

Definition at line 34 of file Utility.py.

00034 
00035 def isAVersionableResource(obj):
00036     """ True if an object is versionable.
00037 
00038     To qualify, the object must be persistent (have its own db record), and
00039     must not have an true attribute named '__non_versionable__'."""
00040 
00041     if getattr(obj, '__non_versionable__', 0):
00042         return 0
00043     return hasattr(obj, '_p_oid')

Here is the caller graph for this function:


Variable Documentation

tuple ZopeVersionControl.Utility._dtmldir = os.path.join( package_home( globals() ), 'dtml' )

Definition at line 29 of file Utility.py.

string ZopeVersionControl.Utility.use_vc_permission = 'Use version control'

Definition at line 31 of file Utility.py.