[Checkins]
SVN: martian/branches/jw-philipp-using-ndir-directives/src/martian/util.py
Used the baseclass directive to determine whether a component
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Fri May 2 15:44:53 EDT 2008
Log message for revision 86126:
Used the baseclass directive to determine whether a component
is a baseclass.
Changed:
U martian/branches/jw-philipp-using-ndir-directives/src/martian/util.py
-=-
Modified: martian/branches/jw-philipp-using-ndir-directives/src/martian/util.py
===================================================================
--- martian/branches/jw-philipp-using-ndir-directives/src/martian/util.py 2008-05-02 19:44:13 UTC (rev 86125)
+++ martian/branches/jw-philipp-using-ndir-directives/src/martian/util.py 2008-05-02 19:44:53 UTC (rev 86126)
@@ -21,6 +21,7 @@
from zope import interface
+import martian
from martian.error import GrokError, GrokImportError
def not_unicode_or_ascii(value):
@@ -48,19 +49,11 @@
return sys._getframe(2).f_globals['__name__']
def is_baseclass(name, component):
- return (type(component) is type and
- class_annotation_nobase(component, 'grok.baseclass', False))
+ return (isclass(component) and martian.baseclass.get(component))
def class_annotation(obj, name, default):
return getattr(obj, '__%s__' % name.replace('.', '_'), default)
-def class_annotation_nobase(obj, name, default):
- """This will only look in the given class obj for the annotation.
-
- It will not look in the inheritance chain.
- """
- return obj.__dict__.get('__%s__' % name.replace('.', '_'), default)
-
def class_annotation_list(obj, name, default):
"""This will process annotations that are lists correctly in the face of
inheritance.
@@ -128,4 +121,4 @@
return frame.f_locals is frame.f_globals
def frame_is_class(frame):
- return '__module__' in frame.f_locals
+ return '__module__' in frame.f_locals
More information about the Checkins
mailing list