Mercurial > p > roundup > code
comparison roundup/cgi/templating.py @ 3905:6733a7cce7f4
multiline pass through extra keywords args
extra keyword args get turned added to the textarea.
this allows users to do multiline(wrap='hard') per
http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/8436
| author | Justus Pendleton <jpend@users.sourceforge.net> |
|---|---|
| date | Sun, 16 Sep 2007 05:39:11 +0000 |
| parents | a90fa2e08a0a |
| children | e89bcb28f683 |
comparison
equal
deleted
inserted
replaced
| 3904:91008ec8f9a0 | 3905:6733a7cce7f4 |
|---|---|
| 1377 | 1377 |
| 1378 kwargs.setdefault("size", 30) | 1378 kwargs.setdefault("size", 30) |
| 1379 kwargs.update({"name": self._formname, "value": value}) | 1379 kwargs.update({"name": self._formname, "value": value}) |
| 1380 return self.input(**kwargs) | 1380 return self.input(**kwargs) |
| 1381 | 1381 |
| 1382 def multiline(self, escape=0, rows=5, cols=40): | 1382 def multiline(self, escape=0, rows=5, cols=40, **kwargs): |
| 1383 """ Render a multiline form edit field for the property. | 1383 """ Render a multiline form edit field for the property. |
| 1384 | 1384 |
| 1385 If not editable, just display the plain() value in a <pre> tag. | 1385 If not editable, just display the plain() value in a <pre> tag. |
| 1386 """ | 1386 """ |
| 1387 if not self.is_edit_ok(): | 1387 if not self.is_edit_ok(): |
| 1392 else: | 1392 else: |
| 1393 value = cgi.escape(str(self._value)) | 1393 value = cgi.escape(str(self._value)) |
| 1394 | 1394 |
| 1395 value = '"'.join(value.split('"')) | 1395 value = '"'.join(value.split('"')) |
| 1396 name = self._formname | 1396 name = self._formname |
| 1397 return ('<textarea name="%(name)s" id="%(name)s"' | 1397 passthrough_args = ' '.join(['%s="%s"' % (k, cgi.escape(str(v), True)) |
| 1398 for k,v in kwargs.items()]) | |
| 1399 return ('<textarea %(passthrough_args)s name="%(name)s" id="%(name)s"' | |
| 1398 ' rows="%(rows)s" cols="%(cols)s">' | 1400 ' rows="%(rows)s" cols="%(cols)s">' |
| 1399 '%(value)s</textarea>') % locals() | 1401 '%(value)s</textarea>') % locals() |
| 1400 | 1402 |
| 1401 def email(self, escape=1): | 1403 def email(self, escape=1): |
| 1402 """ Render the value of the property as an obscured email address | 1404 """ Render the value of the property as an obscured email address |
