allow parameters in view calls in messages; these are stored in view.options
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@4209 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
ff389c1b2f
commit
51b53f3169
1 changed files with 10 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,6 +22,7 @@ Message instance and related classes.
|
||||||
$Id$
|
$Id$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from cgi import parse_qs
|
||||||
from string import Template
|
from string import Template
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
|
@ -57,8 +58,14 @@ class DataProvider(object):
|
||||||
if key.startswith('@@'):
|
if key.startswith('@@'):
|
||||||
if client is None:
|
if client is None:
|
||||||
return '$' + key
|
return '$' + key
|
||||||
view = self.getView(key[2:])
|
viewName = key[2:]
|
||||||
|
params = {}
|
||||||
|
if '?' in viewName:
|
||||||
|
viewName, params = viewName.split('?', 1)
|
||||||
|
params = parse_qs(params)
|
||||||
|
view = self.getView(viewName)
|
||||||
if view is not None:
|
if view is not None:
|
||||||
|
view.options = params
|
||||||
return view()
|
return view()
|
||||||
else:
|
else:
|
||||||
return key
|
return key
|
||||||
|
@ -153,4 +160,4 @@ class MessageInstance(Instance):
|
||||||
|
|
||||||
class MessageTemplate(Template):
|
class MessageTemplate(Template):
|
||||||
|
|
||||||
idpattern = r'@{0,2}[_a-z][_.|a-z0-9]*[_a-z0-9]+'
|
idpattern = r'@{0,2}[_a-z][_.|a-z0-9]*[_a-z0-9?&=]+'
|
||||||
|
|
Loading…
Add table
Reference in a new issue