Mercurial > p > roundup > code
diff roundup/cgi/templating.py @ 3635:53987aa153d2
Transitive-property support.
- Fixed some of the pet-peeves from pep8
- Better parameter names for new _subselect method
- use new-style class for support.Proptree but needed a new-style class
for the property I introduced anyway.
- Fix a bug where searching did the wrong thing (interestingly enough
the same wrong thing for all backends): A search for
{'messages': ['1'], 'messages.author': ['2']}
would ignore the 'messages' part (messages being non-leaf node in
proptree). Fixed and added a regression test for this.
- Added the transitive searching to the SearchAction. New method
get_transitive_prop introduced in hyperdb that does the transitive
version of getprops()[name]. Fixed two tests to use the (faked) method
instead of getprop.
Now searching for transitive props via the web-interface works for me.
Thanks to alexander smishlajev for pointing me at the coding style.
Sorry for stepping on the peeves -- I'm using a different coding style
in most other projects I'm doing ...
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Thu, 13 Jul 2006 10:14:56 +0000 |
| parents | 1dbaa664be28 |
| children | f35ece8f8ff7 |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Sat Jul 08 18:28:18 2006 +0000 +++ b/roundup/cgi/templating.py Thu Jul 13 10:14:56 2006 +0000 @@ -2132,11 +2132,11 @@ self.filterspec = {} db = self.client.db if self.classname is not None: - props = db.getclass(self.classname).getprops() + cls = db.getclass (self.classname) for name in self.filter: if not self.form.has_key(name): continue - prop = props[name] + prop = cls.get_transitive_prop (name) fv = self.form[name] if (isinstance(prop, hyperdb.Link) or isinstance(prop, hyperdb.Multilink)): @@ -2314,11 +2314,12 @@ # finally, the remainder of the filter args in the request if self.classname and self.filterspec: - props = self.client.db.getclass(self.classname).getprops() + cls = self.client.db.getclass(self.classname) for k,v in self.filterspec.items(): if not args.has_key(k): if type(v) == type([]): - if isinstance(props[k], hyperdb.String): + prop = cls.get_transitive_prop(k) + if isinstance(prop, hyperdb.String): l.append('%s=%s'%(k, '%20'.join([q(i) for i in v]))) else: l.append('%s=%s'%(k, ','.join([q(i) for i in v])))
