Skip to content

Commit

Permalink
Now check security of items, and new skip_unauthorized attr.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Apr 8, 1998
1 parent 07c425a commit e313dfa
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions DT_In.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
''' #'

__rcs_id__='$Id: DT_In.py,v 1.23 1998/04/02 17:37:36 jim Exp $'
__rcs_id__='$Id: DT_In.py,v 1.24 1998/04/08 17:45:59 jim Exp $'

############################################################################
# Copyright
Expand Down Expand Up @@ -350,7 +350,7 @@
# (540) 371-6909
#
############################################################################
__version__='$Revision: 1.23 $'[11:-2]
__version__='$Revision: 1.24 $'[11:-2]

from DT_Util import *
from string import find, atoi, join
Expand Down Expand Up @@ -378,6 +378,7 @@ 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='')
self.args=args
has_key=args.has_key
Expand Down Expand Up @@ -510,6 +511,7 @@ def renderwb(self, md):
else:
result = []
append=result.append
validate=md.validate
for index in range(first,end):
if index==first and index > 0:
pstart,pend,psize=opt(None,index+overlap,
Expand Down Expand Up @@ -538,6 +540,17 @@ def renderwb(self, md):
if index==last: kw['sequence-end']=1

client=sequence[index]

if validate is not None:
try: vv=validate(sequence,sequence,index,client,md)
except: vv=0
if not vv:
if (params.has_key('skip_unauthorized') and
params['skip_unauthorized']):
if index==first: kw['sequence-start']=0
continue
raise ValidationError, index

kw['sequence-index']=index
if type(client)==TupleType and len(client)==2:
client=client[1]
Expand Down Expand Up @@ -595,9 +608,21 @@ def renderwob(self, md):
try:
result = []
append=result.append
validate=md.validate
for index in range(l):
if index==last: kw['sequence-end']=1
client=sequence[index]

if validate is not None:
try: vv=validate(sequence,sequence,index,client,md)
except: vv=0
if not vv:
if (self.args.has_key('skip_unauthorized') and
self.args['skip_unauthorized']):
if index==1: kw['sequence-start']=0
continue
raise ValidationError, index

kw['sequence-index']=index
if type(client)==TupleType and len(client)==2:
client=client[1]
Expand Down Expand Up @@ -665,6 +690,9 @@ def int_param(params,md,name,default=0):

############################################################################
# $Log: DT_In.py,v $
# Revision 1.24 1998/04/08 17:45:59 jim
# Now check security of items, and new skip_unauthorized attr.
#
# Revision 1.23 1998/04/02 17:37:36 jim
# Major redesign of block rendering. The code inside a block tag is
# compiled as a template but only the templates blocks are saved, and
Expand Down

0 comments on commit e313dfa

Please sign in to comment.