diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-05-31 21:47:24 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-05-31 21:47:24 +0000 |
| commit | ae84c6b33efdcf37f453967384cacc264ec877d9 (patch) | |
| tree | 2c62f5b18042ce08d33709e289ce2f058ea4bf70 /repoze/bfg/zcml.py | |
| parent | 59d1608a0613c6edc4123c6f0bda5b58a392a644 (diff) | |
| download | pyramid-ae84c6b33efdcf37f453967384cacc264ec877d9.tar.gz pyramid-ae84c6b33efdcf37f453967384cacc264ec877d9.tar.bz2 pyramid-ae84c6b33efdcf37f453967384cacc264ec877d9.zip | |
- The ``route`` ZCML directive now accepts ``request_type`` as an
alias for its ``condition_method`` argument for symmetry with the
``view`` directive.
Diffstat (limited to 'repoze/bfg/zcml.py')
| -rw-r--r-- | repoze/bfg/zcml.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/repoze/bfg/zcml.py b/repoze/bfg/zcml.py index 0f9d4a22b..bd12e926c 100644 --- a/repoze/bfg/zcml.py +++ b/repoze/bfg/zcml.py @@ -219,6 +219,7 @@ class IRouteDirective(Interface): absolute = Bool(title=u'absolute', required=False) member_name = TextLine(title=u'member_name', required=False) collection_name = TextLine(title=u'collection_name', required=False) + request_type = TextLine(title=u'request_type', required=False) condition_method = TextLine(title=u'condition_method', required=False) condition_subdomain = TextLine(title=u'condition_subdomain', required=False) condition_function = GlobalObject(title=u'condition_function', @@ -258,6 +259,11 @@ def connect_route(directive): 'collection_name':directive.parent_collection_name, } conditions = {} + + # request_type and condition_method are aliases; condition_method + # "wins" + if directive.request_type: + conditions['method'] = directive.request_type if directive.condition_method: conditions['method'] = directive.condition_method if directive.condition_subdomain: @@ -288,6 +294,7 @@ class Route(zope.configuration.config.GroupingContextDecorator): member_name = None collection_name = None condition_method = None + request_type = None condition_subdomain = None condition_function = None parent_member_name = None @@ -320,9 +327,11 @@ class Route(zope.configuration.config.GroupingContextDecorator): view(self.context, self.permission, IRoutesContext, self.view, self.name, None) + method = self.condition_method or self.request_type + self.context.action( discriminator = ('route', self.path, repr(self.requirements), - self.condition_method, self.condition_subdomain, + method, self.condition_subdomain, self.condition_function, self.subdomains), callable = connect_route, args = (self,), |
