Skip to content

Commit

Permalink
Merged mgmt interface quick fix branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Jan 8, 2001
1 parent 57adf01 commit 2b0f135
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions DT_In.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,11 @@
''' #'

__rcs_id__='$Id: DT_In.py,v 1.42 2000/12/18 22:59:06 adam Exp $'
__version__='$Revision: 1.42 $'[11:-2]
__rcs_id__='$Id: DT_In.py,v 1.43 2001/01/08 22:46:57 brian Exp $'
__version__='$Revision: 1.43 $'[11:-2]

from DT_Util import ParseError, parse_params, name_param, str
from DT_Util import render_blocks, InstanceDict, ValidationError
from DT_Util import render_blocks, InstanceDict, ValidationError, VSEval, expr_globals
from string import find, atoi, join, split
import ts_regex
from DT_InSV import sequence_variables, opt
Expand All @@ -408,21 +408,28 @@ class InClass:
expr=sort=batch=mapping=None
start_name_re=None
reverse=None
sort_expr=reverse_expr=None

def __init__(self, blocks):
tname, args, section = blocks[0]
args=parse_params(args, name='', start='1',end='-1',size='10',
orphan='3',overlap='1',mapping=1,
skip_unauthorized=1,
previous=1, next=1, expr='', sort='',
reverse=1)
reverse=1, sort_expr='', reverse_expr='')
self.args=args
has_key=args.has_key

if has_key('sort'):
self.sort=sort=args['sort']
if sort=='sequence-item': self.sort=''

if has_key('sort_expr'):
self.sort_expr=VSEval.Eval(args['sort_expr'], expr_globals)

if has_key('reverse_expr'):
self.reverse_expr=VSEval.Eval(args['reverse_expr'], expr_globals)

if has_key('reverse'):
self.reverse=args['reverse']

Expand Down Expand Up @@ -484,15 +491,21 @@ def renderwb(self, md):
raise 'InError', (
'Strings are not allowed as input to the in tag.')


section=self.section
params=self.args

mapping=self.mapping

if self.sort is not None:
if self.sort_expr is not None:
self.sort=self.sort_expr.eval(md)
sequence=self.sort_sequence(sequence)
elif self.sort is not None:
sequence=self.sort_sequence(sequence)

if self.reverse is not None:
if self.reverse_expr is not None and self.reverse_expr.eval(md):
sequence=self.reverse_sequence(sequence)
elif self.reverse is not None:
sequence=self.reverse_sequence(sequence)

next=previous=0
Expand Down Expand Up @@ -644,12 +657,18 @@ def renderwob(self, md):
section=self.section
mapping=self.mapping

if self.sort is not None:

if self.sort_expr is not None:
self.sort=self.sort_expr.eval(md)
sequence=self.sort_sequence(sequence)
elif self.sort is not None:
sequence=self.sort_sequence(sequence)

if self.reverse is not None:
if self.reverse_expr is not None and self.reverse_expr.eval(md):
sequence=self.reverse_sequence(sequence)

elif self.reverse is not None:
sequence=self.reverse_sequence(sequence)

vars=sequence_variables(sequence)
kw=vars.data
kw['mapping']=mapping
Expand Down

0 comments on commit 2b0f135

Please sign in to comment.