summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 93bc945)
raw | patch | inline | side by side (parent: 93bc945)
author | gmcm <gmcm@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 27 Jun 2002 15:38:53 +0000 (15:38 +0000) | ||
committer | gmcm <gmcm@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 27 Jun 2002 15:38:53 +0000 (15:38 +0000) |
the bound methods from the globals dict).
Use cl.filter instead of cl.list followed by sortfunc. For some
backends (Metakit), filter can sort at C speeds, cutting >10 secs
off of filling in the <select...> box for assigned_to when you
have 600+ users.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@822 57a73879-2fb5-44c3-a270-3262357dd7e2
Use cl.filter instead of cl.list followed by sortfunc. For some
backends (Metakit), filter can sort at C speeds, cutting >10 secs
off of filling in the <select...> box for assigned_to when you
have 600+ users.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@822 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/htmltemplate.py | patch | blob | history |
index ecdfc074d7a911d98245aed15a36c641c5eea295..e245597fef39718571228c0c14f54736ce0b2ec0 100644 (file)
--- a/roundup/htmltemplate.py
+++ b/roundup/htmltemplate.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: htmltemplate.py,v 1.93 2002-06-27 12:05:25 gmcm Exp $
+# $Id: htmltemplate.py,v 1.94 2002-06-27 15:38:53 gmcm Exp $
__doc__ = """
Template engine.
"""
import os, re, StringIO, urllib, cgi, errno, types, urllib
-
import hyperdb, date
from i18n import _
self.cl = None
self.properties = None
+ def clear(self):
+ for key in TemplateFunctions.__dict__.keys():
+ if key[:3] == 'do_':
+ del self.globals[key[3:]]
+
def do_plain(self, property, escape=0, lookup=1):
''' display a String property directly;
elif isinstance(propclass, hyperdb.Password):
s = '<input type="password" name="%s" size="%s">'%(property, size)
elif isinstance(propclass, hyperdb.Link):
- sortfunc = self.make_sort_function(propclass.classname)
linkcl = self.db.classes[propclass.classname]
- options = linkcl.list()
- options.sort(sortfunc)
+ if linkcl.getprops().has_key('order'):
+ sort_on = 'order'
+ else:
+ sort_on = linkcl.labelprop()
+ options = linkcl.filter(None, {}, [sort_on], [])
# TODO: make this a field display, not a menu one!
l = ['<select name="%s">'%property]
k = linkcl.labelprop(1)
# display
if isinstance(propclass, hyperdb.Multilink):
linkcl = self.db.classes[propclass.classname]
- options = linkcl.list()
- options.sort(sortfunc)
+ if linkcl.getprops().has_key('order'):
+ sort_on = 'order'
+ else:
+ sort_on = linkcl.labelprop()
+ options = linkcl.filter(None, {}, [sort_on], [])
height = height or min(len(options), 7)
l = ['<select multiple name="%s" size="%s">'%(property, height)]
k = linkcl.labelprop(1)
if value is None:
s = 'selected '
l.append(_('<option %svalue="-1">- no selection -</option>')%s)
- options = linkcl.list()
- options.sort(sortfunc)
+ if linkcl.getprops().has_key('order'):
+ sort_on = 'order'
+ else:
+ sort_on = linkcl.labelprop()
+ options = linkcl.filter(None, {}, [sort_on], [])
for optionid in options:
option = linkcl.get(optionid, k)
s = ''
return ''
if m.group('display'):
command = m.group('command')
- return eval(command, self.globals, self.locals)
+ return eval(command, self.globals, self.locals)
return '*** unhandled match: %s'%str(m.groupdict())
class IndexTemplate(TemplateFunctions):
self.filterspec = filterspec
w = self.client.write
-
# get the filter template
try:
filter_template = open(os.path.join(self.templates,
w('</form>\n')
self.db = self.cl = self.properties = None
+ self.clear()
def node_matches(self, match, colspan):
''' display the files and messages for a node that matched a
def filter_section(self, template, search_text, filter, columns, group,
all_filters, all_columns, show_customization):
-
w = self.client.write
# wrap the template in a single table to ensure the whole widget
w(replace.go(s))
w('</form>')
self.cl = self.db = self.properties = None
+ self.clear()
class NewItemTemplate(TemplateFunctions):
w(replace.go(s))
w('</form>')
self.cl = self.db = None
+ self.clear()
#
# $Log: not supported by cvs2svn $
+# Revision 1.93 2002/06/27 12:05:25 gmcm
+# Default labelprops to id.
+# In history, make sure there's a .item before making a link / multilink into an href.
+# Also in history, cgi.escape String properties.
+# Clean up some of the reference cycles.
+#
# Revision 1.92 2002/06/11 04:57:04 richard
# Added optional additional property to display in a Multilink form menu.
#