Mercurial > p > roundup > code
comparison roundup/cgi/templating.py @ 3102:427e3aee2113 maint-0.7
quote full-text search text in URL generation
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 13 Jan 2005 05:13:54 +0000 |
| parents | f175dcd1ad47 |
| children | fa200651d4c6 |
comparison
equal
deleted
inserted
replaced
| 3096:f175dcd1ad47 | 3102:427e3aee2113 |
|---|---|
| 1991 return '\n'.join(l) | 1991 return '\n'.join(l) |
| 1992 | 1992 |
| 1993 def indexargs_url(self, url, args): | 1993 def indexargs_url(self, url, args): |
| 1994 ''' Embed the current index args in a URL | 1994 ''' Embed the current index args in a URL |
| 1995 ''' | 1995 ''' |
| 1996 q = urllib.quote | |
| 1996 sc = self.special_char | 1997 sc = self.special_char |
| 1997 l = ['%s=%s'%(k,v) for k,v in args.items()] | 1998 l = ['%s=%s'%(k,v) for k,v in args.items()] |
| 1998 | 1999 |
| 1999 # pull out the special values (prefixed by @ or :) | 2000 # pull out the special values (prefixed by @ or :) |
| 2000 specials = {} | 2001 specials = {} |
| 2018 val = self.group[1] | 2019 val = self.group[1] |
| 2019 l.append(sc+'group=%s'%val) | 2020 l.append(sc+'group=%s'%val) |
| 2020 if self.filter and not specials.has_key('filter'): | 2021 if self.filter and not specials.has_key('filter'): |
| 2021 l.append(sc+'filter=%s'%(','.join(self.filter))) | 2022 l.append(sc+'filter=%s'%(','.join(self.filter))) |
| 2022 if self.search_text and not specials.has_key('search_text'): | 2023 if self.search_text and not specials.has_key('search_text'): |
| 2023 l.append(sc+'search_text=%s'%self.search_text) | 2024 l.append(sc+'search_text=%s'%q(self.search_text)) |
| 2024 if not specials.has_key('pagesize'): | 2025 if not specials.has_key('pagesize'): |
| 2025 l.append(sc+'pagesize=%s'%self.pagesize) | 2026 l.append(sc+'pagesize=%s'%self.pagesize) |
| 2026 if not specials.has_key('startwith'): | 2027 if not specials.has_key('startwith'): |
| 2027 l.append(sc+'startwith=%s'%self.startwith) | 2028 l.append(sc+'startwith=%s'%self.startwith) |
| 2028 | 2029 |
| 2029 # finally, the remainder of the filter args in the request | 2030 # finally, the remainder of the filter args in the request |
| 2030 if self.classname and self.filterspec: | 2031 if self.classname and self.filterspec: |
| 2031 props = self.client.db.getclass(self.classname).getprops() | 2032 props = self.client.db.getclass(self.classname).getprops() |
| 2032 q = urllib.quote | |
| 2033 for k,v in self.filterspec.items(): | 2033 for k,v in self.filterspec.items(): |
| 2034 if not args.has_key(k): | 2034 if not args.has_key(k): |
| 2035 if type(v) == type([]): | 2035 if type(v) == type([]): |
| 2036 if isinstance(props[k], hyperdb.String): | 2036 if isinstance(props[k], hyperdb.String): |
| 2037 l.append('%s=%s'%(k, '%20'.join([q(i) for i in v]))) | 2037 l.append('%s=%s'%(k, '%20'.join([q(i) for i in v]))) |
