[Checkins] SVN: Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/plugins/exportimport.py SimpleXMLExportImport could not be reused outside Products.PluggableAuthService

Godefroid Chapelle gotcha at bubblenet.be
Sun Jan 31 11:24:19 EST 2010


Log message for revision 108674:
  SimpleXMLExportImport could not be reused outside Products.PluggableAuthService
  because of the way the path to 'xml' directory was computed.
  

Changed:
  U   Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/plugins/exportimport.py

-=-
Modified: Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/plugins/exportimport.py
===================================================================
--- Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/plugins/exportimport.py	2010-01-31 15:50:05 UTC (rev 108673)
+++ Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/plugins/exportimport.py	2010-01-31 16:24:19 UTC (rev 108674)
@@ -54,6 +54,8 @@
 
 $Id$
 """
+import os, sys
+
 from xml.dom.minidom import parseString
 
 from Acquisition import Implicit
@@ -70,6 +72,10 @@
     from Products.PageTemplates.PageTemplateFile \
         import PageTemplateFile as PageTemplateResource
 
+def getPackagePath(instance):
+    module = sys.modules[instance.__module__]
+    return os.path.dirname(module.__file__)
+
 class SimpleXMLExportImport(Implicit):
     """ Base for plugins whose configuration can be dumped to an XML file.
 
@@ -95,8 +101,9 @@
     def export(self, export_context, subdir, root=False):
         """ See IFilesystemExporter.
         """
+        package_path = getPackagePath(self)
         template = PageTemplateResource('xml/%s' % self._FILENAME,
-                                        globals()).__of__(self.context)
+                                        package_path).__of__(self.context)
         info = self._getExportInfo()
         export_context.writeDataFile('%s.xml' % self.context.getId(),
                                      template(info=info),
@@ -209,7 +216,7 @@
                     'title': ginfo['title'],
                     'description': ginfo['description'],
                    }
-            info['principals'] = self._listGroupPrincipals(group_id) 
+            info['principals'] = self._listGroupPrincipals(group_id)
             group_info.append(info)
         return {'title': self.context.title,
                 'groups': group_info,
@@ -260,7 +267,7 @@
                     'title': rinfo['title'],
                     'description': rinfo['description'],
                    }
-            info['principals'] = self._listRolePrincipals(role_id) 
+            info['principals'] = self._listRolePrincipals(role_id)
             role_info.append(info)
 
         return {'title': self.context.title,



More information about the checkins mailing list