implement passthrough_except(), which doesn't require a full list of vars for every invocation
This commit is contained in:
parent
7ade70b997
commit
4cf009fb7f
1 changed files with 16 additions and 0 deletions
|
|
@ -58,6 +58,22 @@ def passthrough(template, *vars):
|
|||
else:
|
||||
return ''
|
||||
|
||||
def passthrough_except(template, *exclude):
|
||||
"""
|
||||
Construct a string suitable for use as URL
|
||||
parameters. The template calling this method must have
|
||||
previously used
|
||||
#attr _PASSTHROUGH = ...
|
||||
to define the list of variable names to be passed-through.
|
||||
Any variables names passed in will be excluded from the
|
||||
list of variables in the output string.
|
||||
"""
|
||||
passvars = []
|
||||
for var in template._PASSTHROUGH:
|
||||
if not var in exclude:
|
||||
passvars.append(var)
|
||||
return passthrough(template, *passvars)
|
||||
|
||||
def sortByKeyFunc(key, noneGreatest=False):
|
||||
"""Return a function to sort a list of maps by the given key.
|
||||
If the key starts with '-', sort in reverse order. If noneGreatest
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue