Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
GenericSetup.context.SnapshotImportContext Class Reference
Inheritance diagram for GenericSetup.context.SnapshotImportContext:
Inheritance graph
[legend]
Collaboration diagram for GenericSetup.context.SnapshotImportContext:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def readDataFile
def getLastModified
def isDirectory
def listDirectory
def shouldPurge
def getSite
def getSetupTool
def getEncoding
def getLogger
def listNotes
def clearNotes

Static Public Attributes

tuple security = ClassSecurityInfo()

Private Member Functions

def _getSnapshotFolder

Private Attributes

 _snapshot_id
 _encoding
 _should_purge

Detailed Description

Definition at line 550 of file context.py.


Constructor & Destructor Documentation

def GenericSetup.context.SnapshotImportContext.__init__ (   self,
  tool,
  snapshot_id,
  should_purge = False,
  encoding = None 
)

Definition at line 561 of file context.py.

00561 
00562                 ):
00563 
00564         BaseContext.__init__( self, tool, encoding )
00565         self._snapshot_id = snapshot_id
00566         self._encoding = encoding
00567         self._should_purge = bool( should_purge )


Member Function Documentation

def GenericSetup.context.SnapshotImportContext._getSnapshotFolder (   self,
  subdir = None 
) [private]
Return the appropriate snapshot (sub)folder.

Definition at line 656 of file context.py.

00656 
00657     def _getSnapshotFolder( self, subdir=None ):
00658 
00659         """ Return the appropriate snapshot (sub)folder.
00660         """
00661         path = [ 'snapshots', self._snapshot_id ]
00662 
00663         if subdir is not None:
00664             path.extend( subdir.split( '/' ) )
00665 
00666         return self._tool.restrictedTraverse( path )
00667 
00668 InitializeClass( SnapshotImportContext )

Here is the caller graph for this function:

def GenericSetup.context.BaseContext.clearNotes (   self) [inherited]
See ISetupContext.

Definition at line 172 of file context.py.

00172 
00173     def clearNotes(self):
00174 
00175         """ See ISetupContext.
00176         """
00177         self._messages[:] = []
00178 

See ISetupContext.

Definition at line 152 of file context.py.

00152 
00153     def getEncoding( self ):
00154 
00155         """ See ISetupContext.
00156         """
00157         return self._encoding

Here is the caller graph for this function:

See IImportContext.

Definition at line 595 of file context.py.

00595 
00596     def getLastModified( self, path ):
00597 
00598         """ See IImportContext.
00599         """
00600         try:
00601             snapshot = self._getSnapshotFolder()
00602             object = snapshot.restrictedTraverse( path )
00603         except ( AttributeError, KeyError ):
00604             return None
00605         else:
00606             return object.bobobase_modification_time()

Here is the call graph for this function:

def GenericSetup.context.BaseContext.getLogger (   self,
  name 
) [inherited]
See ISetupContext.

Reimplemented from GenericSetup.context.SetupEnviron.

Definition at line 159 of file context.py.

00159 
00160     def getLogger( self, name ):
00161         """ See ISetupContext.
00162         """
00163         return self._loggers.setdefault(name, Logger(name, self._messages))

See ISetupContext.

Definition at line 145 of file context.py.

00145 
00146     def getSetupTool( self ):
00147 
00148         """ See ISetupContext.
00149         """
00150         return self._tool

def GenericSetup.context.BaseContext.getSite (   self) [inherited]
See ISetupContext.

Definition at line 138 of file context.py.

00138 
00139     def getSite( self ):
00140 
00141         """ See ISetupContext.
00142         """
00143         return aq_self(self._site)

See IImportContext.

Definition at line 608 of file context.py.

00608 
00609     def isDirectory( self, path ):
00610 
00611         """ See IImportContext.
00612         """
00613         try:
00614             snapshot = self._getSnapshotFolder()
00615             object = snapshot.restrictedTraverse( str( path ) )
00616         except ( AttributeError, KeyError ):
00617             return None
00618         else:
00619             folderish = getattr( object, 'isPrincipiaFolderish', False )
00620             return bool( folderish )

Here is the call graph for this function:

def GenericSetup.context.SnapshotImportContext.listDirectory (   self,
  path,
  skip = (),
  skip_suffixes = () 
)
See IImportContext.

Definition at line 622 of file context.py.

00622 
00623     def listDirectory(self, path, skip=(), skip_suffixes=()):
00624 
00625         """ See IImportContext.
00626         """
00627         try:
00628             snapshot = self._getSnapshotFolder()
00629             subdir = snapshot.restrictedTraverse( path )
00630         except ( AttributeError, KeyError ):
00631             return None
00632         else:
00633             if not getattr( subdir, 'isPrincipiaFolderish', False ):
00634                 return None
00635 
00636             names = []
00637             for name in subdir.objectIds():
00638                 if name in skip:
00639                     continue
00640                 if [s for s in skip_suffixes if name.endswith(s)]:
00641                     continue
00642                 names.append(name)
00643 
00644             return names

Here is the call graph for this function:

def GenericSetup.context.BaseContext.listNotes (   self) [inherited]
See ISetupContext.

Definition at line 165 of file context.py.

00165 
00166     def listNotes(self):
00167 
00168         """ See ISetupContext.
00169         """
00170         return self._messages[:]

def GenericSetup.context.SnapshotImportContext.readDataFile (   self,
  filename,
  subdir = None 
)
See IImportContext.

Definition at line 569 of file context.py.

00569 
00570     def readDataFile( self, filename, subdir=None ):
00571 
00572         """ See IImportContext.
00573         """
00574         if subdir is not None:
00575             filename = '/'.join( ( subdir, filename ) )
00576 
00577         sep = filename.rfind('/')
00578         if sep != -1:
00579             subdir = filename[:sep]
00580             filename = filename[sep+1:]
00581         try:
00582             snapshot = self._getSnapshotFolder( subdir )
00583             object = snapshot._getOb( filename )
00584         except ( AttributeError, KeyError ):
00585             return None
00586 
00587         try:
00588             data = object.read()
00589             if isinstance(data, unicode):
00590                 data = data.encode('utf-8')
00591             return data
00592         except AttributeError:
00593             return object.manage_FTPget()

Here is the call graph for this function:

See IImportContext.

Reimplemented from GenericSetup.context.SetupEnviron.

Definition at line 646 of file context.py.

00646 
00647     def shouldPurge( self ):
00648 
00649         """ See IImportContext.
00650         """
00651         return self._should_purge


Member Data Documentation

Reimplemented from GenericSetup.context.BaseContext.

Definition at line 565 of file context.py.

Reimplemented from GenericSetup.context.BaseContext.

Definition at line 566 of file context.py.

Definition at line 564 of file context.py.

tuple GenericSetup.context.SnapshotImportContext.security = ClassSecurityInfo() [static]

Reimplemented from GenericSetup.context.BaseContext.

Definition at line 554 of file context.py.


The documentation for this class was generated from the following file: