[Checkins] SVN: Products.PluggableAuthService/trunk/ - Fixed xml templates directory path computation to allow reuse of
Jens Vagelpohl
jens at dataflake.org
Sun Jan 31 16:08:38 EST 2010
Log message for revision 108680:
- Fixed xml templates directory path computation to allow reuse of
``SimpleXMLExportImport`` class outside ``Products.PluggableAuthService``.
(Forgotten forward-port from 1.6 branch)
Changed:
U Products.PluggableAuthService/trunk/CHANGES.txt
U Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/exportimport.py
-=-
Modified: Products.PluggableAuthService/trunk/CHANGES.txt
===================================================================
--- Products.PluggableAuthService/trunk/CHANGES.txt 2010-01-31 19:59:54 UTC (rev 108679)
+++ Products.PluggableAuthService/trunk/CHANGES.txt 2010-01-31 21:08:38 UTC (rev 108680)
@@ -4,7 +4,10 @@
1.7.0 (unreleased)
------------------
+- Fixed xml templates directory path computation to allow reuse of
+ ``SimpleXMLExportImport`` class outside ``Products.PluggableAuthService``.
+
1.7.0b2 (2010-01-31)
--------------------
Modified: Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/exportimport.py
===================================================================
--- Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/exportimport.py 2010-01-31 19:59:54 UTC (rev 108679)
+++ Products.PluggableAuthService/trunk/Products/PluggableAuthService/plugins/exportimport.py 2010-01-31 21:08:38 UTC (rev 108680)
@@ -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