PATCH: Two small issues
Mark Mitchell
mark at codesourcery.com
Thu Dec 1 08:32:44 UTC 2005
This patch fixes two small issues: (a) the name returned by
get_extension_class_name didn't match the user-visible name of
extension classes if the module name used an extended path, and (b)
Database.GetIds didn't have an implementation for the new generic
databases, even though that's easy to do.
Applied.
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
2005-11-30 Mark Mitchell <mark at codesourcery.com>
* qm/extension.py (get_extension_class_name): Use only the final
component of the module in forming the extension class name.
* qm/test/database.py (Database.GetIds): Handle generic
databases.
Index: qm/extension.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/extension.py,v
retrieving revision 1.19
diff -c -5 -p -r1.19 extension.py
*** qm/extension.py 21 Jul 2005 08:10:13 -0000 1.19
--- qm/extension.py 1 Dec 2005 08:21:24 -0000
*************** def get_extension_class_name(extension_c
*** 301,311 ****
returns -- The name of 'extension_class'. This is the name that
is used when users refer to the class."""
assert issubclass(extension_class, Extension)
! return extension_class.__module__ + "." + extension_class.__name__
def validate_arguments(extension_class, arguments):
"""Validate the 'arguments' to the 'extension_class'.
--- 301,312 ----
returns -- The name of 'extension_class'. This is the name that
is used when users refer to the class."""
assert issubclass(extension_class, Extension)
! module = extension_class.__module__.split(".")[-1]
! return module + "." + extension_class.__name__
def validate_arguments(extension_class, arguments):
"""Validate the 'arguments' to the 'extension_class'.
Index: qm/test/database.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/database.py,v
retrieving revision 1.46
diff -c -5 -p -r1.46 database.py
*** qm/test/database.py 14 Sep 2005 13:24:46 -0000 1.46
--- qm/test/database.py 1 Dec 2005 08:21:25 -0000
*************** class Database(qm.extension.Extension):
*** 896,905 ****
--- 896,911 ----
returns -- A list of all items of the indicated 'kind' located
within 'directory', as absolute labels.
Derived classes may override this method."""
+ if self._is_generic_database:
+ extensions = self.GetExtensions(directory, scan_subdirs)
+ extensions = filter(lambda e: e.kind == kind,
+ extensions.values())
+ return map(lambda e: e.GetId(), extensions)
+
return []
def GetItem(self, kind, item_id):
"""Return the item of the indicated 'kind' with indicated 'item_id'.
More information about the qmtest
mailing list