[Zope-CVS] SVN: PluggableAuthService/trunk/plugins/ Rename HTTPBasicAuthHelperExportImport to TitleOnlyExportImport.

Tres Seaver tseaver at palladion.com
Wed Nov 16 00:26:22 EST 2005


Log message for revision 40150:
  Rename HTTPBasicAuthHelperExportImport to TitleOnlyExportImport.

Changed:
  U   PluggableAuthService/trunk/plugins/exportimport.py
  U   PluggableAuthService/trunk/plugins/tests/test_exportimport.py
  D   PluggableAuthService/trunk/plugins/xml/basicauth.xml
  A   PluggableAuthService/trunk/plugins/xml/titleonly.xml

-=-
Modified: PluggableAuthService/trunk/plugins/exportimport.py
===================================================================
--- PluggableAuthService/trunk/plugins/exportimport.py	2005-11-16 05:17:27 UTC (rev 40149)
+++ PluggableAuthService/trunk/plugins/exportimport.py	2005-11-16 05:26:22 UTC (rev 40150)
@@ -297,11 +297,11 @@
                 'map': user_map
                }
 
-class HTTPBasicAuthHelperExportImport(SimpleXMLExportImport):
-    """ Adapter for dumping / loading HTTPBasicAuthHelper to an XML file.
+class TitleOnlyExportImport(SimpleXMLExportImport):
+    """ Adapter for dumping / loading title-only plugins to an XML file.
     """
-    _FILENAME = 'basicauth.xml'
-    _ROOT_TAGNAME = 'basic-auth'
+    _FILENAME = 'titleonly.xml'
+    _ROOT_TAGNAME = 'plug-in'
 
     def _purgeContext(self):
         pass

Modified: PluggableAuthService/trunk/plugins/tests/test_exportimport.py
===================================================================
--- PluggableAuthService/trunk/plugins/tests/test_exportimport.py	2005-11-16 05:17:27 UTC (rev 40149)
+++ PluggableAuthService/trunk/plugins/tests/test_exportimport.py	2005-11-16 05:26:22 UTC (rev 40150)
@@ -789,18 +789,26 @@
             self.assertEqual(len(plugin._domain_map), 0)
             self.assertEqual(plugin.title, None)
 
-    class HTTPBasicAuthHelperExportImportTests(_TestBase):
+    class TitleOnlyExportImportTests(_TestBase):
 
         def _getTargetClass(self):
             from Products.PluggableAuthService.plugins.exportimport \
-                import HTTPBasicAuthHelperExportImport
-            return HTTPBasicAuthHelperExportImport
+                import TitleOnlyExportImport
+            return TitleOnlyExportImport
 
         def _makePlugin(self, id, *args, **kw):
-            from Products.PluggableAuthService.plugins.HTTPBasicAuthHelper \
-                import HTTPBasicAuthHelper
-            return HTTPBasicAuthHelper(id, *args, **kw)
+            from OFS.SimpleItem import SimpleItem
 
+            class _Plugin(SimpleItem):
+                title = None
+
+                def __init__(self, id, title=None):
+                    self._setId(id)
+                    if title is not None:
+                        self.title = title
+
+            return _Plugin(id, *args, **kw)
+
         def test_listExportableItems(self):
             plugin = self._makePlugin('lEI').__of__(self.root)
             adapter = self._makeOne(plugin)
@@ -832,7 +840,7 @@
             self.assertEqual( len( context._wrote ), 1 )
             filename, text, content_type = context._wrote[ 0 ]
             self.assertEqual( filename, 'plugins/no_title.xml' )
-            self._compareDOM( text, _BASIC_AUTH_TEMPLATE_NO_TITLE )
+            self._compareDOM( text, _TITLE_ONLY_TEMPLATE_NO_TITLE )
             self.assertEqual( content_type, 'text/xml' )
 
         def test_export_with_title(self):
@@ -847,7 +855,7 @@
             self.assertEqual( len( context._wrote ), 1 )
             filename, text, content_type = context._wrote[ 0 ]
             self.assertEqual( filename, 'plugins/with_title.xml' )
-            self._compareDOM( text, _BASIC_AUTH_TEMPLATE % TITLE )
+            self._compareDOM( text, _TITLE_ONLY_TEMPLATE % TITLE )
             self.assertEqual( content_type, 'text/xml' )
 
         def test_import_with_title(self):
@@ -857,8 +865,7 @@
 
             context = DummyImportContext(plugin)
             context._files['plugins/with_title.xml'
-                          ] = _BASIC_AUTH_TEMPLATE % (TITLE,
-                                                      )
+                          ] = _TITLE_ONLY_TEMPLATE % TITLE
             adapter.import_(context, 'plugins', False)
 
             self.assertEqual( plugin.title, TITLE )
@@ -871,7 +878,7 @@
 
             context = DummyImportContext(plugin)
             context._files['plugins/no_title.xml'
-                          ] = _BASIC_AUTH_TEMPLATE_NO_TITLE
+                          ] = _TITLE_ONLY_TEMPLATE_NO_TITLE
 
             adapter.import_(context, 'plugins', False)
 
@@ -884,7 +891,7 @@
             unittest.makeSuite(ZODBRoleManagerExportImportTests),
             unittest.makeSuite(CookieAuthHelperExportImportTests),
             unittest.makeSuite(DomainAuthHelperExportImportTests),
-            unittest.makeSuite(HTTPBasicAuthHelperExportImportTests),
+            unittest.makeSuite(TitleOnlyExportImportTests),
                         ))
         return suite
 
@@ -1005,14 +1012,14 @@
 </domain-auth>
 """
 
-_BASIC_AUTH_TEMPLATE_NO_TITLE = """\
+_TITLE_ONLY_TEMPLATE_NO_TITLE = """\
 <?xml version="1.0" ?>
-<basic-auth />
+<plug-in />
 """
 
-_BASIC_AUTH_TEMPLATE = """\
+_TITLE_ONLY_TEMPLATE = """\
 <?xml version="1.0" ?>
-<basic-auth title="%s" />
+<plug-in title="%s" />
 """
 
 if __name__ == '__main__':

Deleted: PluggableAuthService/trunk/plugins/xml/basicauth.xml
===================================================================
--- PluggableAuthService/trunk/plugins/xml/basicauth.xml	2005-11-16 05:17:27 UTC (rev 40149)
+++ PluggableAuthService/trunk/plugins/xml/basicauth.xml	2005-11-16 05:26:22 UTC (rev 40150)
@@ -1,6 +0,0 @@
-<?xml version="1.0" ?>
-<basic-auth xmlns:tal="http://xml.zope.org/namespaces/tal"
-            title="%s"
-            tal:define="info options/info"
-            tal:attributes="title info/title;
-                           "/>

Copied: PluggableAuthService/trunk/plugins/xml/titleonly.xml (from rev 40149, PluggableAuthService/trunk/plugins/xml/basicauth.xml)
===================================================================
--- PluggableAuthService/trunk/plugins/xml/basicauth.xml	2005-11-16 05:17:27 UTC (rev 40149)
+++ PluggableAuthService/trunk/plugins/xml/titleonly.xml	2005-11-16 05:26:22 UTC (rev 40150)
@@ -0,0 +1,5 @@
+<?xml version="1.0" ?>
+<plug-in xmlns:tal="http://xml.zope.org/namespaces/tal"
+         title="%s"
+         tal:define="info options/info"
+         tal:attributes="title info/title" />



More information about the Zope-CVS mailing list