[Checkins] SVN: grok/trunk/src/grok/ Bring back a utility function
from grokcore.component that isn't used there at all.
Philipp von Weitershausen
philikon at philikon.de
Fri May 2 18:26:26 EDT 2008
Log message for revision 86144:
Bring back a utility function from grokcore.component that isn't used there at all.
Changed:
A grok/trunk/src/grok/tests/util/public_methods_from_class.py
U grok/trunk/src/grok/util.py
-=-
Copied: grok/trunk/src/grok/tests/util/public_methods_from_class.py (from rev 86143, grokcore.component/trunk/src/grokcore/component/tests/util/public_methods_from_class.py)
===================================================================
--- grok/trunk/src/grok/tests/util/public_methods_from_class.py (rev 0)
+++ grok/trunk/src/grok/tests/util/public_methods_from_class.py 2008-05-02 22:26:25 UTC (rev 86144)
@@ -0,0 +1,27 @@
+"""
+ >>> methods = util.public_methods_from_class(A)
+ >>> sorted([m.__name__ for m in methods])
+ ['should_also_be_public', 'should_be_public']
+
+"""
+import grokcore.component.util as util
+
+class A(object):
+
+ def __init__(self):
+ pass # this method is ignored
+
+ def __call__(self):
+ pass # this method is ignored
+
+ def __double_underscored(self):
+ pass # this method is ignored
+
+ def _single_underscored(self):
+ pass # this method is ignored
+
+ def should_be_public(self):
+ pass # this method is found
+
+ def should_also_be_public(self):
+ pass # this method is found
Modified: grok/trunk/src/grok/util.py
===================================================================
--- grok/trunk/src/grok/util.py 2008-05-02 22:22:58 UTC (rev 86143)
+++ grok/trunk/src/grok/util.py 2008-05-02 22:26:25 UTC (rev 86144)
@@ -32,11 +32,14 @@
# grokkers that use these utility functions)
from grokcore.component.util import check_adapts
from grokcore.component.util import determine_class_directive
-from grokcore.component.util import public_methods_from_class
from grokcore.component.util import sort_components
from grokcore.component.util import determine_module_component
from grokcore.component.util import determine_class_component
+def public_methods_from_class(factory):
+ return [m for m in methods_from_class(factory) if \
+ not m.__name__.startswith('_')]
+
def make_checker(factory, view_factory, permission, method_names=None):
"""Make a checker for a view_factory associated with factory.
More information about the Checkins
mailing list