Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
CMFCore.FSObject.BadFile Class Reference
Inheritance diagram for CMFCore.FSObject.BadFile:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.FSObject.BadFile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def manage_showError
def getFileContents
def getExceptionText
def manage_doCustomize
def get_size
def getModTime
def getObjectFSPath

Public Attributes

 exc_str
 file_contents
 id

Static Public Attributes

string meta_type = 'Bad File'
string icon = 'p_/broken'
string BAD_FILE_VIEW
tuple manage_options = ({'label':'Error', 'action':'manage_showError'},)
tuple security = ClassSecurityInfo()
tuple showError = Globals.HTML( BAD_FILE_VIEW )
string title = ''

Private Member Functions

def _readFile

Detailed Description

    Represent a file which was not readable or parseable
    as its intended type.

Definition at line 205 of file FSObject.py.


Constructor & Destructor Documentation

def CMFCore.FSObject.BadFile.__init__ (   self,
  id,
  filepath,
  exc_str = '',
  fullname = None,
  properties = None 
)

Definition at line 234 of file FSObject.py.

00234 
00235                 , fullname=None, properties=None):
00236         id = fullname or id # Use the whole filename.
00237         self.exc_str = exc_str
00238         self.file_contents = ''
00239         FSObject.__init__(self, id, filepath, fullname, properties)


Member Function Documentation

def CMFCore.FSObject.BadFile._readFile (   self,
  reparse 
) [private]
Read the data from the filesystem.

Reimplemented from CMFCore.FSObject.FSObject.

Definition at line 250 of file FSObject.py.

00250 
00251     def _readFile(self, reparse):
00252         """Read the data from the filesystem.
00253         """
00254         try:
00255             file = open(self._filepath, 'rb')
00256             try:
00257                 data = self.file_contents = file.read()
00258             finally:
00259                 file.close()
00260         except:  # No errors of any sort may propagate
00261             data = self.file_contents = None #give up
00262         return data

Here is the caller graph for this function:

def CMFCore.FSObject.FSObject.get_size (   self) [inherited]
Get the size of the underlying file.

Definition at line 183 of file FSObject.py.

00183 
00184     def get_size(self):
00185         """Get the size of the underlying file."""
00186         return path.getsize(self._filepath)

Here is the caller graph for this function:

    Return the exception thrown while reading or parsing
    the file.

Definition at line 271 of file FSObject.py.

00271 
00272     def getExceptionText( self ):
00273         """
00274             Return the exception thrown while reading or parsing
00275             the file.
00276         """
00277         return self.exc_str
00278 
00279 Globals.InitializeClass( BadFile )
    Return the contents of the file, if we could read it.

Definition at line 264 of file FSObject.py.

00264 
00265     def getFileContents( self ):
00266         """
00267             Return the contents of the file, if we could read it.
00268         """
00269         return self.file_contents

def CMFCore.FSObject.FSObject.getModTime (   self) [inherited]
Return the last_modified date of the file we represent.

Returns a DateTime instance.

Definition at line 188 of file FSObject.py.

00188 
00189     def getModTime(self):
00190         """Return the last_modified date of the file we represent.
00191 
00192         Returns a DateTime instance.
00193         """
00194         self._updateFromFS()
00195         return DateTime(self._file_mod_time)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.FSObject.FSObject.getObjectFSPath (   self) [inherited]
Return the path of the file we represent

Definition at line 197 of file FSObject.py.

00197 
00198     def getObjectFSPath(self):
00199         """Return the path of the file we represent"""
00200         self._updateFromFS()
00201         return self._filepath
00202 
00203 Globals.InitializeClass(FSObject)
00204 

Here is the call graph for this function:

def CMFCore.FSObject.FSObject.manage_doCustomize (   self,
  folder_path,
  RESPONSE = None,
  root = None,
  obj = None 
) [inherited]
Makes a ZODB Based clone with the same data.

Calls _createZODBClone for the actual work.

Definition at line 80 of file FSObject.py.

00080 
00081                            root=None, obj=None):
00082         """Makes a ZODB Based clone with the same data.
00083 
00084         Calls _createZODBClone for the actual work.
00085         """
00086 
00087         if obj is None:
00088             obj = self._createZODBClone()
00089         parent = aq_parent(aq_inner(self))
00090 
00091         # Preserve cache manager associations
00092         cachemgr_id = self.ZCacheable_getManagerId()
00093         if ( cachemgr_id and
00094              getattr(obj, 'ZCacheable_setManagerId', None) is not None ):
00095             obj.ZCacheable_setManagerId(cachemgr_id)
00096 
00097         # If there are proxy roles we preserve them
00098         proxy_roles = getattr(aq_base(self), '_proxy_roles', None)
00099         if proxy_roles is not None and isinstance(proxy_roles, tuple):
00100             obj._proxy_roles = tuple(self._proxy_roles)
00101 
00102         # Also, preserve any permission settings that might have come
00103         # from a metadata file or from fiddling in the ZMI
00104         old_info = [x[:2] for x in self.ac_inherited_permissions(1)]
00105         for old_perm, value in old_info:
00106             p = Permission(old_perm, value, self)
00107             acquired = int(isinstance(p.getRoles(default=[]), list))
00108             rop_info = self.rolesOfPermission(old_perm)
00109             roles = [x['name'] for x in rop_info if x['selected'] != '']
00110             try:
00111                 # if obj is based on OFS.ObjectManager an acquisition context is
00112                 # required for _subobject_permissions()
00113                 obj.__of__(parent).manage_permission(old_perm, roles=roles,
00114                                                      acquire=acquired)
00115             except ValueError:
00116                 # The permission was invalid, never mind
00117                 pass
00118 
00119         skins_tool_namegetter = getattr(self, 'getSkinsFolderName', None)
00120         if skins_tool_namegetter is not None:
00121             skins_tool_name = skins_tool_namegetter()
00122         else:
00123             skins_tool_name = 'portal_skins'
00124 
00125         id = obj.getId()
00126         fpath = tuple( folder_path.split('/') )
00127         if root is None:
00128             portal_skins = getToolByName(self, skins_tool_name)
00129         else:
00130             portal_skins = root
00131         if folder_path == '.':
00132             fpath = ()
00133         folder = portal_skins.restrictedTraverse(fpath)
00134         if id in folder.objectIds():
00135             # we cant catch the badrequest so
00136             # we'll that to check before hand
00137             obj = folder._getOb(id)
00138             if RESPONSE is not None:
00139                 RESPONSE.redirect('%s/manage_main?manage_tabs_message=%s' % (
00140                     obj.absolute_url(), html_quote("An object with this id already exists")
00141                     ))
00142         else:
00143             folder._verifyObjectPaste(obj, validate_src=0)
00144             folder._setObject(id, obj)
00145 
00146             if RESPONSE is not None:
00147                 RESPONSE.redirect('%s/%s/manage_main' % (
00148                 folder.absolute_url(), id))
00149 
00150         if RESPONSE is not None:
00151             RESPONSE.redirect('%s/%s/manage_main' % (
00152                 folder.absolute_url(), id))

Here is the call graph for this function:

def CMFCore.FSObject.BadFile.manage_showError (   self,
  REQUEST 
)

Definition at line 244 of file FSObject.py.

00244 
00245     def manage_showError( self, REQUEST ):
00246         """
00247         """
00248         return self.showError( self, REQUEST )


Member Data Documentation

Initial value:
"""\
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<h2> Bad Filesystem Object: &dtml-getId; </h2>

<h3> File Contents </h3>
<pre>
<dtml-var getFileContents>
</pre>

<h3> Exception </h3>
<pre>
<dtml-var getExceptionText>
</pre>
<dtml-var manage_page_footer>
"""

Definition at line 214 of file FSObject.py.

Definition at line 236 of file FSObject.py.

Definition at line 237 of file FSObject.py.

string CMFCore.FSObject.BadFile.icon = 'p_/broken' [static]

Definition at line 212 of file FSObject.py.

Definition at line 68 of file FSObject.py.

tuple CMFCore.FSObject.BadFile.manage_options = ({'label':'Error', 'action':'manage_showError'},) [static]

Definition at line 231 of file FSObject.py.

string CMFCore.FSObject.BadFile.meta_type = 'Bad File' [static]

Definition at line 211 of file FSObject.py.

tuple CMFCore.FSObject.BadFile.security = ClassSecurityInfo() [static]

Reimplemented from CMFCore.FSObject.FSObject.

Definition at line 240 of file FSObject.py.

tuple CMFCore.FSObject.BadFile.showError = Globals.HTML( BAD_FILE_VIEW ) [static]

Definition at line 242 of file FSObject.py.

string CMFCore.FSObject.FSObject.title = '' [static, inherited]

Definition at line 49 of file FSObject.py.


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