1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717#
18- # $Id: cgi_client.py,v 1.97 2002-01-11 23:22:29 richard Exp $
18+ # $Id: cgi_client.py,v 1.98 2002-01-14 02:20:14 richard Exp $
1919
2020__doc__ = """
2121WWW request handler (also used in the stand-alone server).
@@ -44,21 +44,7 @@ class Client:
4444 'anonymous' user exists, the user is logged in using that user (though
4545 there is no cookie). This allows them to modify the database, and all
4646 modifications are attributed to the 'anonymous' user.
47-
48-
49- Customisation
50- -------------
51- FILTER_POSITION - one of 'top', 'bottom', 'top and bottom'
52- ANONYMOUS_ACCESS - one of 'deny', 'allow'
53- ANONYMOUS_REGISTER - one of 'deny', 'allow'
54-
55- from the roundup class:
56- INSTANCE_NAME - defaults to 'Roundup issue tracker'
57-
5847 '''
59- FILTER_POSITION = 'bottom' # one of 'top', 'bottom', 'top and bottom'
60- ANONYMOUS_ACCESS = 'deny' # one of 'deny', 'allow'
61- ANONYMOUS_REGISTER = 'deny' # one of 'deny', 'allow'
6248
6349 def __init__ (self , instance , request , env , form = None ):
6450 self .instance = instance
@@ -104,7 +90,7 @@ def pagehead(self, title, message=None):
10490 message = _ ('<div class="system-msg">%(message)s</div>' )% locals ()
10591 else :
10692 message = ''
107- style = open (os .path .join (self .TEMPLATES , 'style.css' )).read ()
93+ style = open (os .path .join (self .instance . TEMPLATES , 'style.css' )).read ()
10894 user_name = self .user or ''
10995 if self .user == 'admin' :
11096 admin_links = _ (' | <a href="list_classes">Class List</a>' \
@@ -286,7 +272,7 @@ def list(self, sort=None, group=None, filter=None, columns=None,
286272 cn = self .classname
287273 cl = self .db .classes [cn ]
288274 self .pagehead (_ ('%(instancename)s: Index of %(classname)s' )% {
289- 'classname' : cn , 'instancename' : self .INSTANCE_NAME })
275+ 'classname' : cn , 'instancename' : self .instance . INSTANCE_NAME })
290276 if sort is None : sort = self .index_arg (':sort' )
291277 if group is None : group = self .index_arg (':group' )
292278 if filter is None : filter = self .index_arg (':filter' )
@@ -295,7 +281,7 @@ def list(self, sort=None, group=None, filter=None, columns=None,
295281 if show_customization is None :
296282 show_customization = self .customization_widget ()
297283
298- index = htmltemplate .IndexTemplate (self , self .TEMPLATES , cn )
284+ index = htmltemplate .IndexTemplate (self , self .instance . TEMPLATES , cn )
299285 index .render (filterspec , filter , columns , sort , group ,
300286 show_customization = show_customization )
301287 self .pagefoot ()
@@ -342,7 +328,8 @@ def shownode(self, message=None):
342328 nodeid = self .nodeid
343329
344330 # use the template to display the item
345- item = htmltemplate .ItemTemplate (self , self .TEMPLATES , self .classname )
331+ item = htmltemplate .ItemTemplate (self , self .instance .TEMPLATES ,
332+ self .classname )
346333 item .render (nodeid )
347334
348335 self .pagefoot ()
@@ -561,7 +548,7 @@ def newnode(self, message=None):
561548 self .nodeid = nid
562549 self .pagehead ('%s: %s' % (self .classname .capitalize (), nid ),
563550 message )
564- item = htmltemplate .ItemTemplate (self , self .TEMPLATES ,
551+ item = htmltemplate .ItemTemplate (self , self .instance . TEMPLATES ,
565552 self .classname )
566553 item .render (nid )
567554 self .pagefoot ()
@@ -575,7 +562,7 @@ def newnode(self, message=None):
575562 self .classname .capitalize ()}, message )
576563
577564 # call the template
578- newitem = htmltemplate .NewItemTemplate (self , self .TEMPLATES ,
565+ newitem = htmltemplate .NewItemTemplate (self , self .instance . TEMPLATES ,
579566 self .classname )
580567 newitem .render (self .form )
581568
@@ -609,7 +596,7 @@ def newuser(self, message=None):
609596 self .classname .capitalize ()}, message )
610597
611598 # call the template
612- newitem = htmltemplate .NewItemTemplate (self , self .TEMPLATES ,
599+ newitem = htmltemplate .NewItemTemplate (self , self .instance . TEMPLATES ,
613600 self .classname )
614601 newitem .render (self .form )
615602
@@ -647,7 +634,7 @@ def newfile(self, message=None):
647634
648635 self .pagehead (_ ('New %(classname)s' )% {'classname' :
649636 self .classname .capitalize ()}, message )
650- newitem = htmltemplate .NewItemTemplate (self , self .TEMPLATES ,
637+ newitem = htmltemplate .NewItemTemplate (self , self .instance . TEMPLATES ,
651638 self .classname )
652639 newitem .render (self .form )
653640 self .pagefoot ()
@@ -707,7 +694,7 @@ def showuser(self, message=None):
707694 self .pagehead (_ ('User: %(user)s' )% {'user' : node_user }, message )
708695
709696 # use the template to display the item
710- item = htmltemplate .ItemTemplate (self , self .TEMPLATES , 'user' )
697+ item = htmltemplate .ItemTemplate (self , self .instance . TEMPLATES , 'user' )
711698 item .render (self .nodeid )
712699 self .pagefoot ()
713700
@@ -760,7 +747,7 @@ def login(self, message=None, newuser_form=None, action='index'):
760747 <td><input type="submit" value="Log In"></td></tr>
761748</form>
762749''' )% locals ())
763- if self .user is None and self .ANONYMOUS_REGISTER == 'deny' :
750+ if self .user is None and self .instance . ANONYMOUS_REGISTER == 'deny' :
764751 self .write ('</table>' )
765752 self .pagefoot ()
766753 return
@@ -953,7 +940,7 @@ def main(self):
953940 if action == 'newuser_action' :
954941 # if we don't have a login and anonymous people aren't allowed to
955942 # register, then spit up the login form
956- if self .ANONYMOUS_REGISTER == 'deny' and self .user is None :
943+ if self .instance . ANONYMOUS_REGISTER == 'deny' and self .user is None :
957944 if action == 'login' :
958945 self .login () # go to the index after login
959946 else :
@@ -968,7 +955,7 @@ def main(self):
968955 action = 'index'
969956
970957 # no login or registration, make sure totally anonymous access is OK
971- elif self .ANONYMOUS_ACCESS == 'deny' and self .user is None :
958+ elif self .instance . ANONYMOUS_ACCESS == 'deny' and self .user is None :
972959 if action == 'login' :
973960 self .login () # go to the index after login
974961 else :
@@ -1058,7 +1045,7 @@ def pagehead(self, title, message=None):
10581045 message = _ ('<div class="system-msg">%(message)s</div>' )% locals ()
10591046 else :
10601047 message = ''
1061- style = open (os .path .join (self .TEMPLATES , 'style.css' )).read ()
1048+ style = open (os .path .join (self .instance . TEMPLATES , 'style.css' )).read ()
10621049 user_name = self .user or ''
10631050 if self .user == 'admin' :
10641051 admin_links = _ (' | <a href="list_classes">Class List</a>' \
@@ -1178,6 +1165,14 @@ def parsePropsFromForm(db, cl, form, nodeid=0):
11781165
11791166#
11801167# $Log: not supported by cvs2svn $
1168+ # Revision 1.97 2002/01/11 23:22:29 richard
1169+ # . #502437 ] rogue reactor and unittest
1170+ # in short, the nosy reactor was modifying the nosy list. That code had
1171+ # been there for a long time, and I suspsect it was there because we
1172+ # weren't generating the nosy list correctly in other places of the code.
1173+ # We're now doing that, so the nosy-modifying code can go away from the
1174+ # nosy reactor.
1175+ #
11811176# Revision 1.96 2002/01/10 05:26:10 richard
11821177# missed a parsePropsFromForm in last update
11831178#
0 commit comments