@@ -851,11 +851,25 @@ def handleListCGIValue(value):
851851 else :
852852 return value .value .split (',' )
853853
854- # XXX This is starting to look a lot (in data terms) like the client object
855- # itself!
856854class HTMLRequest :
857855 ''' The *request*, holding the CGI form and environment.
858856
857+ "form" the CGI form as a cgi.FieldStorage
858+ "env" the CGI environment variables
859+ "url" the current URL path for this request
860+ "base" the base URL for this instance
861+ "user" a HTMLUser instance for this user
862+ "classname" the current classname (possibly None)
863+ "template_type" the current template type (suffix, also possibly None)
864+
865+ Index args:
866+ "columns" dictionary of the columns to display in an index page
867+ "sort" index sort column (direction, column name)
868+ "group" index grouping property (direction, column name)
869+ "filter" properties to filter the index on
870+ "filterspec" values to filter the index on
871+ "search_text" text to perform a full-text search on for an index
872+
859873 '''
860874 def __init__ (self , client ):
861875 self .client = client
@@ -864,6 +878,7 @@ def __init__(self, client):
864878 self .form = client .form
865879 self .env = client .env
866880 self .base = client .base
881+ self .url = client .url
867882 self .user = HTMLUser (client )
868883
869884 # store the current class name and action
@@ -933,6 +948,7 @@ def __str__(self):
933948 d ['env' ] = e
934949 return '''
935950form: %(form)s
951+ url: %(url)r
936952base: %(base)r
937953classname: %(classname)r
938954template_type: %(template_type)r
@@ -971,6 +987,7 @@ def indexargs_form(self, columns=1, sort=1, group=1, filter=1,
971987 return '\n ' .join (l )
972988
973989 def indexargs_href (self , url , args ):
990+ ''' embed the current index args in a URL '''
974991 l = ['%s=%s' % (k ,v ) for k ,v in args .items ()]
975992 if self .columns :
976993 l .append (':columns=%s' % (',' .join (self .columns .keys ())))
@@ -1040,6 +1057,9 @@ def batch(self):
10401057 # return the batch object
10411058 return Batch (self .client , self .classname , l , size , start )
10421059
1060+
1061+ # extend the standard ZTUtils Batch object to remove dependency on
1062+ # Acquisition and add a couple of useful methods
10431063class Batch (ZTUtils .Batch ):
10441064 def __init__ (self , client , classname , l , size , start , end = 0 , orphan = 0 , overlap = 0 ):
10451065 self .client = client
0 commit comments