1- # $Id: client.py,v 1.86 2003-02-16 22:57:09 richard Exp $
1+ # $Id: client.py,v 1.87 2003-02-17 00:39:28 richard Exp $
22
33__doc__ = """
44WWW request handler (also used in the stand-alone server).
@@ -83,29 +83,26 @@ class Client:
8383 Special form variables:
8484 Note that in various places throughout this code, special form
8585 variables of the form :<name> are used. The colon (":") part may
86- actually be one of several characters from the set:
87-
88- : @ +
89-
86+ actually be one of either ":" or "@".
9087 '''
9188
9289 #
9390 # special form variables
9491 #
95- FV_TEMPLATE = re .compile (r'[@+ :]template' )
96- FV_OK_MESSAGE = re .compile (r'[@+ :]ok_message' )
97- FV_ERROR_MESSAGE = re .compile (r'[@+ :]error_message' )
92+ FV_TEMPLATE = re .compile (r'[@:]template' )
93+ FV_OK_MESSAGE = re .compile (r'[@:]ok_message' )
94+ FV_ERROR_MESSAGE = re .compile (r'[@:]error_message' )
9895
9996 # specials for parsePropsFromForm
100- FV_REQUIRED = re .compile (r'[@+ :]required' )
101- FV_ADD = re .compile (r'([@+ :])add\1' )
102- FV_REMOVE = re .compile (r'([@+ :])remove\1' )
103- FV_CONFIRM = re .compile (r'.+[@+ :]confirm' )
104- FV_LINK = re .compile (r'([@+ :])link\1(.+)' )
97+ FV_REQUIRED = re .compile (r'[@:]required' )
98+ FV_ADD = re .compile (r'([@:])add\1' )
99+ FV_REMOVE = re .compile (r'([@:])remove\1' )
100+ FV_CONFIRM = re .compile (r'.+[@:]confirm' )
101+ FV_LINK = re .compile (r'([@:])link\1(.+)' )
105102
106103 # deprecated
107- FV_NOTE = re .compile (r'[@+ :]note' )
108- FV_FILE = re .compile (r'[@+ :]file' )
104+ FV_NOTE = re .compile (r'[@:]note' )
105+ FV_FILE = re .compile (r'[@:]file' )
109106
110107 # Note: index page stuff doesn't appear here:
111108 # columns, sort, sortdir, filter, group, groupdir, search_text,
@@ -755,6 +752,7 @@ def newItemAction(self):
755752 special form values.
756753 '''
757754 # parse the props from the form
755+ # XXX reinstate exception handling
758756# try:
759757 if 1 :
760758 props , links = self .parsePropsFromForm ()
@@ -763,6 +761,7 @@ def newItemAction(self):
763761# return
764762
765763 # handle the props - edit or create
764+ # XXX reinstate exception handling
766765# try:
767766 if 1 :
768767 # create the context here
@@ -785,7 +784,7 @@ def newItemAction(self):
785784 self .db .commit ()
786785
787786 # redirect to the new item's page
788- raise Redirect , '%s%s%s?: ok_message=%s' % (self .base , self .classname ,
787+ raise Redirect , '%s%s%s?@ ok_message=%s' % (self .base , self .classname ,
789788 nid , urllib .quote (messages ))
790789
791790 def newItemPermission (self , props ):
@@ -910,6 +909,7 @@ def searchAction(self):
910909 _ ('You do not have permission to search %s' % self .classname ))
911910
912911 # add a faked :filter form variable for each filtering prop
912+ # XXX migrate to new : @ +
913913 props = self .db .classes [self .classname ].getprops ()
914914 for key in self .form .keys ():
915915 if not props .has_key (key ): continue
@@ -1004,6 +1004,7 @@ def retirePermission(self):
10041004 def showAction (self ):
10051005 ''' Show a node
10061006 '''
1007+ # XXX allow : @ +
10071008 t = self .form [':type' ].value
10081009 n = self .form [':number' ].value
10091010 url = '%s%s%s' % (self .db .config .TRACKER_WEB , t , n )
@@ -1097,7 +1098,7 @@ def parsePropsFromForm(self, num_re=re.compile('^\d+$')):
10971098 ''' Pull properties for the given class out of the form.
10981099
10991100 In the following, <bracketed> values are variable, ":" may be
1100- any of : @ + and other text "required" is fixed.
1101+ one of ":" or "@", and other text "required" is fixed.
11011102
11021103 Properties are specified as form variables
11031104 <designator>:<propname>
@@ -1126,7 +1127,7 @@ def parsePropsFromForm(self, num_re=re.compile('^\d+$')):
11261127 [classname|designator] will be set/appended the id of the
11271128 newly created item of class <classname>.
11281129
1129- Note: the colon may be one of: : @ +
1130+ Note: the colon may be either ":" or "@".
11301131
11311132 Any of the form variables may be prefixed with a classname or
11321133 designator.
@@ -1158,7 +1159,7 @@ def parsePropsFromForm(self, num_re=re.compile('^\d+$')):
11581159 # generate the regexp for detecting
11591160 # <classname|designator>[@:+]property
11601161 classes = '|' .join (db .classes .keys ())
1161- self .FV_ITEMSPEC = re .compile (r'(%s)([-\d]+)[@+ :](.+)$' % classes )
1162+ self .FV_ITEMSPEC = re .compile (r'(%s)([-\d]+)[@:](.+)$' % classes )
11621163 self .FV_DESIGNATOR = re .compile (r'(%s)([-\d]+)' % classes )
11631164
11641165 # these indicate the default class / item
0 commit comments