[Checkins] SVN: zope.introspector/trunk/src/zope/introspector/code.py Provide filesystem path of File as attribute.

Uli Fouquet uli at gnufix.de
Sun Aug 10 22:04:25 EDT 2008


Log message for revision 89615:
  Provide filesystem path of File as attribute.

Changed:
  U   zope.introspector/trunk/src/zope/introspector/code.py

-=-
Modified: zope.introspector/trunk/src/zope/introspector/code.py
===================================================================
--- zope.introspector/trunk/src/zope/introspector/code.py	2008-08-11 01:43:35 UTC (rev 89614)
+++ zope.introspector/trunk/src/zope/introspector/code.py	2008-08-11 02:04:25 UTC (rev 89615)
@@ -136,13 +136,14 @@
     def __init__(self, dotted_name, name):
         super(File, self).__init__(dotted_name)
         self.name = name
+        module_info = module_info_from_dotted_name(self.dotted_name)
+        self.path = module_info.getResourcePath(self.name)
 
     def exists(self):
         """Check whether the file is a file we want to consider."""
-        module_info = module_info_from_dotted_name(self.dotted_name)
-        path = module_info.getResourcePath(self.name)
-        return (os.path.isfile(path) and
-                os.path.splitext(path)[1].lower() in ['.rst', '.txt', '.zcml'])
+        return (os.path.isfile(self.path) and
+                os.path.splitext(self.path)[1].lower() in [
+                    '.rst', '.txt', '.zcml'])
 
 class Class(Code):
     pass



More information about the Checkins mailing list