diff options
| author | Chris McDonough <chrism@plope.com> | 2011-09-03 23:13:41 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-09-03 23:13:41 -0400 |
| commit | d94e4dada6baf4962af9fb57b4493998bf2862bd (patch) | |
| tree | 7c4e1fcf3da967ef2b0a667e7ae2e9ad6e117142 | |
| parent | b074e399b91f1facb17c03bcff4777f51fef4457 (diff) | |
| download | pyramid-d94e4dada6baf4962af9fb57b4493998bf2862bd.tar.gz pyramid-d94e4dada6baf4962af9fb57b4493998bf2862bd.tar.bz2 pyramid-d94e4dada6baf4962af9fb57b4493998bf2862bd.zip | |
credit and docstring cleanups
| -rw-r--r-- | pyramid/config/__init__.py | 63 |
1 files changed, 3 insertions, 60 deletions
diff --git a/pyramid/config/__init__.py b/pyramid/config/__init__.py index 03bb13f8c..89802513f 100644 --- a/pyramid/config/__init__.py +++ b/pyramid/config/__init__.py @@ -816,6 +816,7 @@ class Configurator( return app +# this class is licensed under the ZPL (stolen from Zope) class ActionState(object): def __init__(self): self.actions = [] @@ -838,65 +839,6 @@ class ActionState(object): def action(self, discriminator, callable=None, args=(), kw=None, order=0, includepath=(), info=''): """Add an action with the given discriminator, callable and arguments - - For testing purposes, the callable and arguments may be omitted. - In that case, a default noop callable is used. - - The discriminator must be given, but it can be None, to indicate that - the action never conflicts. - - Let's look at some examples: - - >>> c = ConfigurationContext() - - Normally, the context gets actions from subclasses. We'll provide - an actions attribute ourselves: - - >>> c.actions = [] - - We'll use a test callable that has a convenient string representation - - >>> from zope.configmachine.tests.directives import f - - >>> c.action(1, f, (1, ), {'x': 1}) - >>> c.actions - [(1, f, (1,), {'x': 1})] - - >>> c.action(None) - >>> c.actions - [(1, f, (1,), {'x': 1}), (None, None)] - - Now set the include path and info: - - >>> c.includepath = ('foo.zcml',) - >>> c.info = "?" - >>> c.action(None) - >>> c.actions[-1] - (None, None, (), {}, ('foo.zcml',), '?') - - We can add an order argument to crudely control the order - of execution: - - >>> c.action(None, order=99999) - >>> c.actions[-1] - (None, None, (), {}, ('foo.zcml',), '?', 99999) - - We can also pass an includepath argument, which will be used as the the - includepath for the action. (if includepath is None, self.includepath - will be used): - - >>> c.action(None, includepath=('abc',)) - >>> c.actions[-1] - (None, None, (), {}, ('abc',), '?') - - We can also pass an info argument, which will be used as the the - source line info for the action. (if info is None, self.info will be - used): - - >>> c.action(None, info='abc') - >>> c.actions[-1] - (None, None, (), {}, ('foo.zcml',), 'abc') - """ if kw is None: kw = {} @@ -916,7 +858,7 @@ class ActionState(object): >>> output = [] >>> def f(*a, **k): ... output.append(('f', a, k)) - >>> context = ConfigurationMachine() + >>> context = ActionState() >>> context.actions = [ ... (1, f, (1,)), ... (1, f, (11,), {}, ('x', )), @@ -974,6 +916,7 @@ class ActionState(object): if clear: del self.actions[:] +# this function is licensed under the ZPL (stolen from Zope) def resolveConflicts(actions): """Resolve conflicting actions |
