Mercurial > p > roundup > code
diff roundup/htmltemplate.py @ 755:49c9522675b9
can now just display a link/multilink id - useful for stylesheet stuff
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 31 May 2002 00:08:02 +0000 |
| parents | 51c425129b35 |
| children | 00d360a4978a |
line wrap: on
line diff
--- a/roundup/htmltemplate.py Thu May 30 23:58:14 2002 +0000 +++ b/roundup/htmltemplate.py Fri May 31 00:08:02 2002 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: htmltemplate.py,v 1.90 2002-05-25 07:16:24 rochecompaan Exp $ +# $Id: htmltemplate.py,v 1.91 2002-05-31 00:08:02 richard Exp $ __doc__ = """ Template engine. @@ -60,7 +60,7 @@ self.cl = None self.properties = None - def do_plain(self, property, escape=0): + def do_plain(self, property, escape=0, lookup=1): ''' display a String property directly; display a Date property in a specified time zone with an option to @@ -68,6 +68,8 @@ for a Link or Multilink property, display the key strings of the linked nodes (or the ids if the linked class has no key property) + when the lookup argument is true, otherwise just return the + linked ids ''' if not self.nodeid and self.form is None: return _('[Field: not called from item]') @@ -101,19 +103,23 @@ elif isinstance(propclass, hyperdb.Interval): value = str(value) elif isinstance(propclass, hyperdb.Link): - linkcl = self.db.classes[propclass.classname] - k = linkcl.labelprop() if value: - value = linkcl.get(value, k) + if lookup: + linkcl = self.db.classes[propclass.classname] + k = linkcl.labelprop() + value = linkcl.get(value, k) else: value = _('[unselected]') elif isinstance(propclass, hyperdb.Multilink): - linkcl = self.db.classes[propclass.classname] - k = linkcl.labelprop() - labels = [] - for v in value: - labels.append(linkcl.get(v, k)) - value = ', '.join(labels) + if lookup: + linkcl = self.db.classes[propclass.classname] + k = linkcl.labelprop() + labels = [] + for v in value: + labels.append(linkcl.get(v, k)) + value = ', '.join(labels) + else: + value = ', '.join(value) else: value = _('Plain: bad propclass "%(propclass)s"')%locals() if escape: @@ -1170,6 +1176,9 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.90 2002/05/25 07:16:24 rochecompaan +# Merged search_indexing-branch with HEAD +# # Revision 1.89 2002/05/15 06:34:47 richard # forgot to fix the templating for last change #
