|
2 | 2 | """ |
3 | 3 |
|
4 | 4 | todo = ''' |
5 | | -- Most methods should have a "default" arg to supply a value |
6 | | - when none appears in the hyperdb or request. |
| 5 | +- Most methods should have a "default" arg to supply a value |
| 6 | + when none appears in the hyperdb or request. |
7 | 7 | - Multilink property additions: change_note and new_upload |
8 | 8 | - Add class.find() too |
9 | 9 | - NumberHTMLProperty should support numeric operations |
@@ -174,7 +174,7 @@ class RoundupPageTemplate(PageTemplate.PageTemplate): |
174 | 174 |
|
175 | 175 | - the url |
176 | 176 | - the current index information (``filterspec``, ``filter`` args, |
177 | | - ``properties``, etc) parsed out of the form. |
| 177 | + ``properties``, etc) parsed out of the form. |
178 | 178 | - methods for easy filterspec link generation |
179 | 179 | - *user*, the current user node as an HTMLItem instance |
180 | 180 | - *form*, the current CGI form information as a FieldStorage |
@@ -550,7 +550,7 @@ def classhelp(self, properties=None, label='(list)', width='500', |
550 | 550 | height='400', property=''): |
551 | 551 | ''' Pop up a javascript window with class help |
552 | 552 |
|
553 | | - This generates a link to a popup window which displays the |
| 553 | + This generates a link to a popup window which displays the |
554 | 554 | properties indicated by "properties" of the class named by |
555 | 555 | "classname". The "properties" should be a comma-separated list |
556 | 556 | (eg. 'id,name,description'). Properties defaults to all the |
@@ -665,7 +665,7 @@ def designator(self): |
665 | 665 | def is_retired(self): |
666 | 666 | """Is this item retired?""" |
667 | 667 | return self._klass.is_retired(self._nodeid) |
668 | | - |
| 668 | + |
669 | 669 | def submit(self, label="Submit Changes"): |
670 | 670 | """Generate a submit button. |
671 | 671 |
|
@@ -715,7 +715,7 @@ def history(self, direction='descending', dre=re.compile('^\d+$')): |
715 | 715 | id = self._klass.get(self._nodeid, prop_n, None) |
716 | 716 | current[prop_n] = '<a href="%s%s">%s</a>'%( |
717 | 717 | classname, id, current[prop_n]) |
718 | | - |
| 718 | + |
719 | 719 | for id, evt_date, user, action, args in history: |
720 | 720 | date_s = str(evt_date.local(timezone)).replace("."," ") |
721 | 721 | arg_s = '' |
@@ -1078,7 +1078,7 @@ def hyperlinked(self): |
1078 | 1078 |
|
1079 | 1079 | def plain(self, escape=0, hyperlink=0): |
1080 | 1080 | '''Render a "plain" representation of the property |
1081 | | - |
| 1081 | +
|
1082 | 1082 | - "escape" turns on/off HTML quoting |
1083 | 1083 | - "hyperlink" turns on/off in-text hyperlinking of URLs, email |
1084 | 1084 | addresses and designators |
@@ -1190,7 +1190,7 @@ def field(self, size = 30): |
1190 | 1190 | return self.plain() |
1191 | 1191 |
|
1192 | 1192 | def confirm(self, size = 30): |
1193 | | - ''' Render a second form edit field for the property, used for |
| 1193 | + ''' Render a second form edit field for the property, used for |
1194 | 1194 | confirmation that the user typed the password correctly. Generates |
1195 | 1195 | a field with name "@confirm@name". |
1196 | 1196 |
|
@@ -1325,7 +1325,7 @@ def field(self, size=30): |
1325 | 1325 | if self.is_edit_ok(): |
1326 | 1326 | value = '"'.join(value.split('"')) |
1327 | 1327 | return self.input(name=self._formname,value=value,size=size) |
1328 | | - |
| 1328 | + |
1329 | 1329 | return self.plain() |
1330 | 1330 |
|
1331 | 1331 | def reldate(self, pretty=1): |
@@ -1491,9 +1491,9 @@ def menu(self, size=None, height=None, showid=0, additional=[], |
1491 | 1491 | if value is None: |
1492 | 1492 | s = 'selected="selected" ' |
1493 | 1493 | l.append(_('<option %svalue="-1">- no selection -</option>')%s) |
1494 | | - if linkcl.getprops().has_key('order'): |
| 1494 | + if linkcl.getprops().has_key('order'): |
1495 | 1495 | sort_on = ('+', 'order') |
1496 | | - else: |
| 1496 | + else: |
1497 | 1497 | if sort_on is None: |
1498 | 1498 | sort_on = ('+', linkcl.labelprop()) |
1499 | 1499 | else: |
@@ -1548,7 +1548,7 @@ def __init__(self, *args, **kwargs): |
1548 | 1548 | fail_ok=1) |
1549 | 1549 | sortfun = make_sort_function(self._db, self._prop.classname) |
1550 | 1550 | self._value.sort(sortfun) |
1551 | | - |
| 1551 | + |
1552 | 1552 | def __len__(self): |
1553 | 1553 | ''' length of the multilink ''' |
1554 | 1554 | return len(self._value) |
@@ -1727,9 +1727,13 @@ class ShowDict: |
1727 | 1727 | ''' A convenience access to the :columns index parameters |
1728 | 1728 | ''' |
1729 | 1729 | def __init__(self, columns): |
1730 | | - self.columns = {} |
1731 | | - for col in columns: |
1732 | | - self.columns[col] = 1 |
| 1730 | + if columns: |
| 1731 | + self.columns = {} |
| 1732 | + for col in columns: |
| 1733 | + self.columns[col] = 1 |
| 1734 | + else: |
| 1735 | + self.__getitem__ = lambda name: 1 |
| 1736 | + |
1733 | 1737 | def __getitem__(self, name): |
1734 | 1738 | return self.columns.has_key(name) |
1735 | 1739 |
|
@@ -1863,7 +1867,7 @@ def _post_init(self): |
1863 | 1867 | def updateFromURL(self, url): |
1864 | 1868 | ''' Parse the URL for query args, and update my attributes using the |
1865 | 1869 | values. |
1866 | | - ''' |
| 1870 | + ''' |
1867 | 1871 | env = {'QUERY_STRING': url} |
1868 | 1872 | self.form = cgi.FieldStorage(environ=env) |
1869 | 1873 |
|
@@ -2081,7 +2085,7 @@ def __getitem__(self, index): |
2081 | 2085 | if index < 0: |
2082 | 2086 | if index + self.end < self.first: raise IndexError, index |
2083 | 2087 | return self._sequence[index + self.end] |
2084 | | - |
| 2088 | + |
2085 | 2089 | if index >= self.length: |
2086 | 2090 | raise IndexError, index |
2087 | 2091 |
|
@@ -2143,3 +2147,4 @@ def html_quote(self, html): |
2143 | 2147 | '''HTML-quote the supplied text.''' |
2144 | 2148 | return cgi.escape(url) |
2145 | 2149 |
|
| 2150 | +# vim: set et sts=4 sw=4 : |
0 commit comments