[CMF-checkins] SVN: CMF/trunk/CMFCore/ - simplified code: FS*
objects are now created with the full path as argument (makes
using expandpath obsolete)
Yvo Schubbe
y.2006_ at wcm-solutions.de
Mon Jul 10 04:13:22 EDT 2006
Log message for revision 69063:
- simplified code: FS* objects are now created with the full path as argument (makes using expandpath obsolete)
- related cleanup
Changed:
U CMF/trunk/CMFCore/DirectoryView.py
U CMF/trunk/CMFCore/FSDTMLMethod.py
U CMF/trunk/CMFCore/FSFile.py
U CMF/trunk/CMFCore/FSImage.py
U CMF/trunk/CMFCore/FSObject.py
U CMF/trunk/CMFCore/FSPageTemplate.py
U CMF/trunk/CMFCore/FSPropertiesObject.py
U CMF/trunk/CMFCore/FSPythonScript.py
U CMF/trunk/CMFCore/FSSTXMethod.py
U CMF/trunk/CMFCore/FSZSQLMethod.py
-=-
Modified: CMF/trunk/CMFCore/DirectoryView.py
===================================================================
--- CMF/trunk/CMFCore/DirectoryView.py 2006-07-10 07:45:31 UTC (rev 69062)
+++ CMF/trunk/CMFCore/DirectoryView.py 2006-07-10 08:13:21 UTC (rev 69063)
@@ -15,10 +15,10 @@
$Id$
"""
+import logging
import re
from os import path, listdir, stat
from sys import platform
-import logging
from warnings import warn
from AccessControl import ClassSecurityInfo
@@ -42,10 +42,8 @@
from utils import minimalpath
from utils import normalize
-
logger = logging.getLogger('CMFCore.DirectoryView')
-
__reload_module__ = 0
# Ignore filesystem artifacts
@@ -191,9 +189,9 @@
registry.registerDirectoryByPath(entry_filepath)
info = registry.getDirectoryInfo(entry_minimal_fp)
if info is not None:
- # Folders on the file system have no extension or
+ # Folders on the file system have no extension or
# meta_type, as a crutch to enable customizing what gets
- # created to represent a filesystem folder in a
+ # created to represent a filesystem folder in a
# DirectoryView we use a fake type "FOLDER". That way
# other implementations can register for that type and
# circumvent the hardcoded assumption that all filesystem
@@ -239,7 +237,7 @@
metadata = FSMetadata(entry_filepath)
metadata.read()
try:
- ob = t(name, entry_minimal_fp, fullname=entry,
+ ob = t(name, entry_filepath, fullname=entry,
properties=metadata.getProperties())
except:
import sys
@@ -252,7 +250,7 @@
val,
tb )
ob = BadFile( name,
- entry_minimal_fp,
+ entry_filepath,
exc_str='\r\n'.join(exc_lines),
fullname=entry )
finally:
Modified: CMF/trunk/CMFCore/FSDTMLMethod.py
===================================================================
--- CMF/trunk/CMFCore/FSDTMLMethod.py 2006-07-10 07:45:31 UTC (rev 69062)
+++ CMF/trunk/CMFCore/FSDTMLMethod.py 2006-07-10 08:13:21 UTC (rev 69063)
@@ -16,7 +16,8 @@
"""
import Globals
-from AccessControl import ClassSecurityInfo, getSecurityManager
+from AccessControl import ClassSecurityInfo
+from AccessControl import getSecurityManager
from AccessControl.DTML import RestrictedDTML
from AccessControl.Role import RoleManager
from OFS.Cache import Cacheable
@@ -28,19 +29,23 @@
from permissions import FTPAccess
from permissions import View
from permissions import ViewManagementScreens
+from utils import _checkConditionalGET
from utils import _dtmldir
-from utils import _setCacheHeaders, _checkConditionalGET
-from utils import expandpath
+from utils import _setCacheHeaders
+_marker = object()
-_marker = [] # Create a new marker object.
+class FSDTMLMethod(RestrictedDTML, RoleManager, FSObject, Globals.HTML):
-class FSDTMLMethod(RestrictedDTML, RoleManager, FSObject, Globals.HTML):
"""FSDTMLMethods act like DTML methods but are not directly
- modifiable from the management interface."""
+ modifiable from the management interface.
+ """
meta_type = 'Filesystem DTML Method'
+ _proxy_roles = ()
+ _cache_namespace_keys = ()
+ _reading = 0
manage_options=(
(
@@ -50,21 +55,15 @@
{'label':'Proxy', 'action':'manage_proxyForm',
'help':('OFSP','DTML-DocumentOrMethod_Proxy.stx')},
)
- +Cacheable.manage_options
+ + Cacheable.manage_options
)
- _proxy_roles=()
- _cache_namespace_keys=()
-
- # Use declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(View)
security.declareProtected(ViewManagementScreens, 'manage_main')
manage_main = Globals.DTMLFile('custdtml', _dtmldir)
- _reading = 0
-
def __init__(self, id, filepath, fullname=None, properties=None):
FSObject.__init__(self, id, filepath, fullname, properties)
# Normally called via HTML.__init__ but we don't need the rest that
@@ -76,13 +75,15 @@
return DTMLMethod(self.read(), __name__=self.getId())
def _readFile(self, reparse):
- fp = expandpath(self._filepath)
- file = open(fp, 'r') # not 'rb', as this is a text file!
+ """Read the data from the filesystem.
+ """
+ file = open(self._filepath, 'r') # not 'rb', as this is a text file!
try:
data = file.read()
finally:
file.close()
self.raw = data
+
if reparse:
self._reading = 1 # Avoid infinite recursion
try:
Modified: CMF/trunk/CMFCore/FSFile.py
===================================================================
--- CMF/trunk/CMFCore/FSFile.py 2006-07-10 07:45:31 UTC (rev 69062)
+++ CMF/trunk/CMFCore/FSFile.py 2006-07-10 08:13:21 UTC (rev 69063)
@@ -16,16 +16,16 @@
"""
import codecs
+
import Globals
from AccessControl import ClassSecurityInfo
-from DateTime import DateTime
from OFS.Cache import Cacheable
+from OFS.Image import File
try:
from zope.contenttype import guess_content_type
except ImportError:
# BBB: for Zope 2.9
from zope.app.content_types import guess_content_type
-from OFS.Image import File
from DirectoryView import registerFileExtension
from DirectoryView import registerMetaType
@@ -33,17 +33,21 @@
from permissions import FTPAccess
from permissions import View
from permissions import ViewManagementScreens
+from utils import _checkConditionalGET
from utils import _dtmldir
-from utils import _setCacheHeaders, _ViewEmulator
-from utils import expandpath, _FSCacheHeaders, _checkConditionalGET
+from utils import _FSCacheHeaders
+from utils import _setCacheHeaders
+from utils import _ViewEmulator
class FSFile(FSObject):
+
"""FSFiles act like images but are not directly
modifiable from the management interface."""
# Note that OFS.Image.File is not a base class because it is mutable.
meta_type = 'Filesystem File'
+ content_type = 'unknown/unknown'
manage_options=(
{'label':'Customize', 'action':'manage_main'},
@@ -52,14 +56,13 @@
security = ClassSecurityInfo()
security.declareObjectProtected(View)
+ security.declareProtected(ViewManagementScreens, 'manage_main')
+ manage_main = Globals.DTMLFile('custfile', _dtmldir)
+
def __init__(self, id, filepath, fullname=None, properties=None):
id = fullname or id # Use the whole filename.
FSObject.__init__(self, id, filepath, fullname, properties)
- security.declareProtected(ViewManagementScreens, 'manage_main')
- manage_main = Globals.DTMLFile('custfile', _dtmldir)
- content_type = 'unknown/unknown'
-
def _createZODBClone(self):
return File(self.getId(), '', self._readFile(1))
@@ -92,10 +95,14 @@
return content_type
def _readFile(self, reparse):
- fp = expandpath(self._filepath)
- file = open(fp, 'rb')
- try: data = file.read()
- finally: file.close()
+ """Read the data from the filesystem.
+ """
+ file = open(self._filepath, 'rb')
+ try:
+ data = file.read()
+ finally:
+ file.close()
+
if reparse or self.content_type == 'unknown/unknown':
self.ZCacheable_invalidate()
self.content_type=self._get_content_type(file, data, self.id)
Modified: CMF/trunk/CMFCore/FSImage.py
===================================================================
--- CMF/trunk/CMFCore/FSImage.py 2006-07-10 07:45:31 UTC (rev 69062)
+++ CMF/trunk/CMFCore/FSImage.py 2006-07-10 08:13:21 UTC (rev 69063)
@@ -16,29 +16,31 @@
"""
import Globals
-from DateTime import DateTime
from AccessControl import ClassSecurityInfo
from OFS.Cache import Cacheable
from OFS.Image import Image, getImageInfo
+from DirectoryView import registerFileExtension
+from DirectoryView import registerMetaType
+from FSObject import FSObject
from permissions import FTPAccess
from permissions import View
from permissions import ViewManagementScreens
-from DirectoryView import registerFileExtension
-from DirectoryView import registerMetaType
-from FSObject import FSObject
+from utils import _checkConditionalGET
from utils import _dtmldir
-from utils import _setCacheHeaders, _ViewEmulator
-from utils import expandpath, _FSCacheHeaders, _checkConditionalGET
+from utils import _FSCacheHeaders
+from utils import _setCacheHeaders
+from utils import _ViewEmulator
class FSImage(FSObject):
+
"""FSImages act like images but are not directly
modifiable from the management interface."""
# Note that OFS.Image.Image is not a base class because it is mutable.
meta_type = 'Filesystem Image'
-
+ content_type = 'unknown/unknown'
_data = None
manage_options=(
@@ -48,24 +50,25 @@
security = ClassSecurityInfo()
security.declareObjectProtected(View)
+ security.declareProtected(ViewManagementScreens, 'manage_main')
+ manage_main = Globals.DTMLFile('custimage', _dtmldir)
+
def __init__(self, id, filepath, fullname=None, properties=None):
id = fullname or id # Use the whole filename.
FSObject.__init__(self, id, filepath, fullname, properties)
- security.declareProtected(ViewManagementScreens, 'manage_main')
- manage_main = Globals.DTMLFile('custimage', _dtmldir)
- content_type = 'unknown/unknown'
-
def _createZODBClone(self):
return Image(self.getId(), '', self._readFile(1))
def _readFile(self, reparse):
- fp = expandpath(self._filepath)
- file = open(fp, 'rb')
+ """Read the data from the filesystem.
+ """
+ file = open(self._filepath, 'rb')
try:
data = self._data = file.read()
finally:
file.close()
+
if reparse or self.content_type == 'unknown/unknown':
self.ZCacheable_invalidate()
ct, width, height = getImageInfo( data )
@@ -93,7 +96,6 @@
Returns the contents of the file or image. Also, sets the
Content-Type HTTP header to the objects content type.
"""
-
self._updateFromFS()
view = _ViewEmulator().__of__(self)
@@ -140,7 +142,7 @@
return self.content_type
security.declareProtected(View, 'get_size')
- def get_size( self ):
+ def get_size(self):
"""
Return the size of the image.
"""
Modified: CMF/trunk/CMFCore/FSObject.py
===================================================================
--- CMF/trunk/CMFCore/FSObject.py 2006-07-10 07:45:31 UTC (rev 69062)
+++ CMF/trunk/CMFCore/FSObject.py 2006-07-10 08:13:21 UTC (rev 69063)
@@ -19,25 +19,25 @@
import Globals
from AccessControl import ClassSecurityInfo
-from AccessControl.Role import RoleManager
from AccessControl.Permission import Permission
-from Acquisition import Implicit
+from AccessControl.Role import RoleManager
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
+from Acquisition import Implicit
+from DateTime import DateTime
from OFS.Cache import Cacheable
from OFS.SimpleItem import Item
-from DateTime import DateTime
from Products.PythonScripts.standard import html_quote
from permissions import ManagePortal
from permissions import View
from permissions import ViewManagementScreens
-from utils import expandpath
from utils import getToolByName
class FSObject(Implicit, Item, RoleManager, Cacheable):
+
"""FSObject is a base class for all filesystem based look-alikes.
Subclasses of this class mimic ZODB based objects like Image and
@@ -47,13 +47,12 @@
# Always empty for FS based, non-editable objects.
title = ''
+ _file_mod_time = 0
+ _parsed = 0
security = ClassSecurityInfo()
security.declareObjectProtected(View)
- _file_mod_time = 0
- _parsed = 0
-
def __init__(self, id, filepath, fullname=None, properties=None):
if properties:
# Since props come from the filesystem, this should be
@@ -69,10 +68,11 @@
self.id = id
self.__name__ = id # __name__ is used in traceback reporting
self._filepath = filepath
- fp = expandpath(self._filepath)
- try: self._file_mod_time = stat(fp)[8]
- except: pass
+ try:
+ self._file_mod_time = stat(filepath)[8]
+ except:
+ pass
self._readFile(0)
security.declareProtected(ViewManagementScreens, 'manage_doCustomize')
@@ -87,7 +87,7 @@
# Preserve cache manager associations
cachemgr_id = self.ZCacheable_getManagerId()
- if ( cachemgr_id and
+ if ( cachemgr_id and
getattr(obj, 'ZCacheable_setManagerId', None) is not None ):
obj.ZCacheable_setManagerId(cachemgr_id)
@@ -150,7 +150,7 @@
def _readFile(self, reparse):
"""Read the data from the filesystem.
- Read the file indicated by exandpath(self._filepath), and parse the
+ Read the file indicated by self._filepath, and parse the
data if necessary. 'reparse' is set when reading the second
time and beyond.
"""
@@ -161,9 +161,10 @@
def _updateFromFS(self):
parsed = self._parsed
if not parsed or Globals.DevelopmentMode:
- fp = expandpath(self._filepath)
- try: mtime=stat(fp)[8]
- except: mtime=0
+ try:
+ mtime = stat(self._filepath)[8]
+ except:
+ mtime = 0
if not parsed or mtime != self._file_mod_time:
# if we have to read the file again, remove the cache
self.ZCacheable_invalidate()
@@ -174,8 +175,7 @@
security.declareProtected(View, 'get_size')
def get_size(self):
"""Get the size of the underlying file."""
- fp = expandpath(self._filepath)
- return path.getsize(fp)
+ return path.getsize(self._filepath)
security.declareProtected(View, 'getModTime')
def getModTime(self):
@@ -195,7 +195,8 @@
Globals.InitializeClass(FSObject)
-class BadFile( FSObject ):
+class BadFile(FSObject):
+
"""
Represent a file which was not readable or parseable
as its intended type.
@@ -240,17 +241,12 @@
"""
return self.showError( self, REQUEST )
- security.declarePrivate( '_readFile' )
- def _readFile( self, reparse ):
+ security.declarePrivate('_readFile')
+ def _readFile(self, reparse):
"""Read the data from the filesystem.
-
- Read the file indicated by exandpath(self._filepath), and parse the
- data if necessary. 'reparse' is set when reading the second
- time and beyond.
"""
try:
- fp = expandpath(self._filepath)
- file = open(fp, 'rb')
+ file = open(self._filepath, 'rb')
try:
data = self.file_contents = file.read()
finally:
Modified: CMF/trunk/CMFCore/FSPageTemplate.py
===================================================================
--- CMF/trunk/CMFCore/FSPageTemplate.py 2006-07-10 07:45:31 UTC (rev 69062)
+++ CMF/trunk/CMFCore/FSPageTemplate.py 2006-07-10 08:13:21 UTC (rev 69063)
@@ -18,7 +18,8 @@
import re
import Globals
-from AccessControl import getSecurityManager, ClassSecurityInfo
+from AccessControl import ClassSecurityInfo
+from AccessControl import getSecurityManager
from OFS.Cache import Cacheable
from Products.PageTemplates.PageTemplate import PageTemplate
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate, Src
@@ -30,11 +31,12 @@
from permissions import FTPAccess
from permissions import View
from permissions import ViewManagementScreens
-from utils import _setCacheHeaders, _checkConditionalGET
-from utils import expandpath
+from utils import _checkConditionalGET
+from utils import _dtmldir
+from utils import _setCacheHeaders
xml_detect_re = re.compile('^\s*<\?xml\s+(?:[^>]*?encoding=["\']([^"\'>]+))?')
-_marker = [] # Create a new marker object.
+_marker = object()
class FSPageTemplate(FSObject, Script, PageTemplate):
@@ -43,7 +45,6 @@
"""
meta_type = 'Filesystem Page Template'
-
_owner = None # Unowned
manage_options=(
@@ -51,14 +52,14 @@
{'label':'Customize', 'action':'manage_main'},
{'label':'Test', 'action':'ZScriptHTML_tryForm'},
)
- +Cacheable.manage_options
+ + Cacheable.manage_options
)
security = ClassSecurityInfo()
security.declareObjectProtected(View)
security.declareProtected(ViewManagementScreens, 'manage_main')
- manage_main = Globals.DTMLFile('dtml/custpt', globals())
+ manage_main = Globals.DTMLFile('custpt', _dtmldir)
# Declare security for unprotected PageTemplate methods.
security.declarePrivate('pt_edit', 'write')
@@ -78,8 +79,9 @@
# return 0
def _readFile(self, reparse):
- fp = expandpath(self._filepath)
- file = open(fp, 'rU') # not 'rb', as this is a text file!
+ """Read the data from the filesystem.
+ """
+ file = open(self._filepath, 'rU') # not 'rb', as this is a text file!
try:
data = file.read()
finally:
@@ -131,7 +133,7 @@
# no content
if _checkConditionalGET(self, extra_context):
return ''
-
+
result = FSPageTemplate.inheritedAttribute('pt_render')(
self, source, extra_context
)
Modified: CMF/trunk/CMFCore/FSPropertiesObject.py
===================================================================
--- CMF/trunk/CMFCore/FSPropertiesObject.py 2006-07-10 07:45:31 UTC (rev 69062)
+++ CMF/trunk/CMFCore/FSPropertiesObject.py 2006-07-10 08:13:21 UTC (rev 69063)
@@ -14,6 +14,7 @@
$Id$
"""
+
import Globals
from AccessControl import ClassSecurityInfo
from Acquisition import ImplicitAcquisitionWrapper
@@ -26,10 +27,10 @@
from FSObject import FSObject
from permissions import ViewManagementScreens
from utils import _dtmldir
-from utils import expandpath
-class FSPropertiesObject (FSObject, PropertyManager):
+class FSPropertiesObject(FSObject, PropertyManager):
+
"""FSPropertiesObjects simply hold properties."""
meta_type = 'Filesystem Properties Object'
@@ -85,13 +86,8 @@
def _readFile(self, reparse):
"""Read the data from the filesystem.
-
- Read the file (indicated by exandpath(self._filepath), and parse the
- data if necessary.
"""
- fp = expandpath(self._filepath)
-
- file = open(fp, 'r') # not 'rb', as this is a text file!
+ file = open(self._filepath, 'r') # not 'rb', as this is a text file!
try:
lines = file.readlines()
finally:
Modified: CMF/trunk/CMFCore/FSPythonScript.py
===================================================================
--- CMF/trunk/CMFCore/FSPythonScript.py 2006-07-10 07:45:31 UTC (rev 69062)
+++ CMF/trunk/CMFCore/FSPythonScript.py 2006-07-10 08:13:21 UTC (rev 69063)
@@ -35,20 +35,23 @@
from permissions import View
from permissions import ViewManagementScreens
from utils import _dtmldir
-from utils import expandpath
-_marker = []
+_marker = object()
class bad_func_code:
+
co_varnames = ()
co_argcount = 0
class CustomizedPythonScript(PythonScript):
+
""" Subclass which captures the "source" version's text.
"""
+
#meta_type = 'Customized Python Script' #(need permissions here)
+
security = ClassSecurityInfo()
def __init__(self, id, text):
@@ -79,7 +82,9 @@
InitializeClass(CustomizedPythonScript)
-class FSPythonScript (FSObject, Script):
+
+class FSPythonScript(FSObject, Script):
+
"""FSPythonScripts act like Python Scripts but are not directly
modifiable from the management interface."""
@@ -87,7 +92,6 @@
_params = _body = ''
_v_f = None
_proxy_roles = ()
-
_owner = None # Unowned
manage_options=(
@@ -100,32 +104,30 @@
+ Cacheable.manage_options
)
- # Use declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(View)
+
+ security.declareProtected(ViewManagementScreens, 'manage_main')
+ manage_main = DTMLFile('custpy', _dtmldir)
+
security.declareProtected(View, 'index_html',)
# Prevent the bindings from being edited TTW
security.declarePrivate('ZBindings_edit','ZBindingsHTML_editForm',
'ZBindingsHTML_editAction')
- security.declareProtected(ViewManagementScreens, 'manage_main')
- manage_main = DTMLFile('custpy', _dtmldir)
-
def _createZODBClone(self):
"""Create a ZODB (editable) equivalent of this object."""
- obj = CustomizedPythonScript(self.getId(), self.read())
- return obj
+ return CustomizedPythonScript(self.getId(), self.read())
def _readFile(self, reparse):
"""Read the data from the filesystem.
+ """
+ file = open(self._filepath, 'rU')
+ try:
+ data = file.read()
+ finally:
+ file.close()
- Read the file (indicated by exandpath(self._filepath), and parse the
- data if necessary.
- """
- fp = expandpath(self._filepath)
- file = open(fp, 'rU')
- try: data = file.read()
- finally: file.close()
if reparse:
self._write(data, reparse)
@@ -314,10 +316,12 @@
class FSPythonScriptTracebackSupplement:
+
"""Implementation of ITracebackSupplement
Makes script-specific info available in exception tracebacks.
"""
+
def __init__(self, script, line=-1):
self.object = script
# If line is set to -1, it means to use tb_lineno.
Modified: CMF/trunk/CMFCore/FSSTXMethod.py
===================================================================
--- CMF/trunk/CMFCore/FSSTXMethod.py 2006-07-10 07:45:31 UTC (rev 69062)
+++ CMF/trunk/CMFCore/FSSTXMethod.py 2006-07-10 08:13:21 UTC (rev 69063)
@@ -19,17 +19,17 @@
from AccessControl import ClassSecurityInfo
from StructuredText.StructuredText import HTML
-from permissions import FTPAccess
-from permissions import View
-from permissions import ViewManagementScreens
from DirectoryView import registerFileExtension
from DirectoryView import registerMetaType
from FSObject import FSObject
+from permissions import FTPAccess
+from permissions import View
+from permissions import ViewManagementScreens
from utils import _dtmldir
-from utils import expandpath
-class FSSTXMethod( FSObject ):
+class FSSTXMethod(FSObject):
+
"""
A chunk of StructuredText, rendered as a skin method of a
CMFSite.
@@ -49,10 +49,10 @@
)
security = ClassSecurityInfo()
- security.declareObjectProtected( View )
+ security.declareObjectProtected(View)
- security.declareProtected( ViewManagementScreens, 'manage_main')
- manage_main = Globals.DTMLFile( 'custstx', _dtmldir )
+ security.declareProtected(ViewManagementScreens, 'manage_main')
+ manage_main = Globals.DTMLFile('custstx', _dtmldir)
#
# FSObject interface
@@ -63,16 +63,14 @@
"""
raise NotImplementedError, "See next week's model."
- def _readFile( self, reparse ):
-
- fp = expandpath( self._filepath )
- file = open( fp, 'r' ) # not binary, we want CRLF munging here.
-
+ def _readFile(self, reparse):
+ """Read the data from the filesystem.
+ """
+ file = open(self._filepath, 'r') # not 'rb', as this is a text file!
try:
data = file.read()
finally:
file.close()
-
self.raw = data
if reparse:
Modified: CMF/trunk/CMFCore/FSZSQLMethod.py
===================================================================
--- CMF/trunk/CMFCore/FSZSQLMethod.py 2006-07-10 07:45:31 UTC (rev 69062)
+++ CMF/trunk/CMFCore/FSZSQLMethod.py 2006-07-10 08:13:21 UTC (rev 69063)
@@ -14,6 +14,7 @@
$Id$
"""
+
import logging
import Globals
@@ -27,13 +28,12 @@
from permissions import View
from permissions import ViewManagementScreens
from utils import _dtmldir
-from utils import expandpath
-
logger = logging.getLogger('CMFCore.FSZSQLMethod')
class FSZSQLMethod(SQL, FSObject):
+
"""FSZSQLMethods act like Z SQL Methods but are not directly
modifiable from the management interface."""
@@ -47,9 +47,7 @@
)
)
- # Use declarative security
security = ClassSecurityInfo()
-
security.declareObjectProtected(View)
# Make mutators private
@@ -84,11 +82,13 @@
return s
def _readFile(self, reparse):
- fp = expandpath(self._filepath)
- file = open(fp, 'r') # not 'rb', as this is a text file!
+ """Read the data from the filesystem.
+ """
+ file = open(self._filepath, 'r') # not 'rb', as this is a text file!
try:
data = file.read()
- finally: file.close()
+ finally:
+ file.close()
# parse parameters
parameters={}
@@ -103,7 +103,7 @@
if len(pair)!=2:
continue
parameters[pair[0].strip().lower()]=pair[1].strip()
-
+
# check for required parameters
try:
connection_id = ( parameters.get('connection id', '') or
More information about the CMF-checkins
mailing list