Changeset 3406 for pykota/trunk/cgi-bin
- Timestamp:
- 08/20/08 23:41:53 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/cgi-bin/dumpykota.cgi
r3333 r3406 128 128 version.__version__, _("PyKota Data Dumper"), \ 129 129 _("Dump"), _("Please click on the above button")) ] 130 content.append(self.htmlListDataTypes(self.options. get("data", "")))131 content.append(u"<br />") 132 content.append(self.htmlListFormats(self.options. get("format", "")))130 content.append(self.htmlListDataTypes(self.options.data)) 131 content.append(u"<br />") 132 content.append(self.htmlListFormats(self.options.format)) 133 133 content.append(u"<br />") 134 134 content.append(self.htmlFilterInput(" ".join(self.arguments))) 135 135 content.append(u"<br />") 136 content.append(self.htmlOrderbyInput(self.options. get("orderby", "")))137 content.append(u"<br />") 138 content.append(self.htmlSumCheckbox(self.options. get("sum", "")))136 content.append(self.htmlOrderbyInput(self.options.orderby)) 137 content.append(u"<br />") 138 content.append(self.htmlSumCheckbox(self.options.sum)) 139 139 content.append(footer % (_("Dump"), 140 140 version.__doc__, … … 190 190 try : 191 191 if self.form.has_key("datatype") : 192 self.options ["data"]= self.form["datatype"].value192 self.options.data = self.form["datatype"].value 193 193 if self.form.has_key("format") : 194 self.options ["format"]= self.form["format"].value194 self.options.format = self.form["format"].value 195 195 if self.form.has_key("filter") : 196 196 self.arguments = self.form["filter"].value.split() 197 197 if self.form.has_key("sum") : 198 self.options ["sum"]= self.form["sum"].value198 self.options.sum = self.form["sum"].value 199 199 if self.form.has_key("orderby") : 200 self.options ["orderby"]= self.form["orderby"].value200 self.options.orderby = self.form["orderby"].value 201 201 # when no authentication is done, or when the remote username 202 202 # is 'root' (even if not run as root of course), then unrestricted … … 212 212 # can not dump any data as they like, we restrict them 213 213 # to their own datas. 214 if self.options ["data"]not in ["printers", "pmembers", "groups", "gpquotas"] :214 if self.options.data not in ["printers", "pmembers", "groups", "gpquotas"] : 215 215 self.arguments.append("username=%s" % remuser) 216 216 217 217 fname = "error" 218 218 ctype = "text/plain" 219 if self.options ["format"]in ("csv", "ssv") :219 if self.options.format in ("csv", "ssv") : 220 220 #ctype = "application/vnd.sun.xml.calc" # OpenOffice.org 221 221 ctype = "text/comma-separated-values" 222 222 fname = "dump.csv" 223 elif self.options ["format"]== "tsv" :223 elif self.options.format == "tsv" : 224 224 #ctype = "application/vnd.sun.xml.calc" # OpenOffice.org 225 225 ctype = "text/tab-separated-values" 226 226 fname = "dump.tsv" 227 elif self.options ["format"]== "xml" :227 elif self.options.format == "xml" : 228 228 ctype = "text/xml" 229 229 fname = "dump.xml" 230 elif self.options ["format"]== "cups" :230 elif self.options.format == "cups" : 231 231 ctype = "text/plain" 232 232 fname = "page_log" … … 240 240 self.guiDisplay() 241 241 242 class FakeCommandLineOptions : 243 """A class to fake command line options.""" 244 output = "-" 245 data = "history" 246 format = "cups" 247 sum = None 248 orderby = None 249 242 250 if __name__ == "__main__" : 243 251 utils.reinitcgilocale() … … 245 253 admin.deferredInit() 246 254 admin.form = cgi.FieldStorage() 247 admin.options = { "output" : "-", 248 "data" : "history", 249 "format" : "cups", 250 "sum" : None, 251 "orderby" : None, 252 } 255 admin.options = FakeCommandLineOptions() 253 256 admin.arguments = [] 254 257 admin.guiAction()