Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 5309:20084e2b48c3
Fix bug where unsetting a text value triggered an exception because
None has no replace operation.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 25 Oct 2017 23:07:35 -0400 |
| parents | 53a853c06e9a |
| children | 5a014410f254 |
comparison
equal
deleted
inserted
replaced
| 5308:534b8bebfb1d | 5309:20084e2b48c3 |
|---|---|
| 1560 | 1560 |
| 1561 Different web clients send different line ending values, but | 1561 Different web clients send different line ending values, but |
| 1562 other systems (eg. email) don't necessarily handle those line | 1562 other systems (eg. email) don't necessarily handle those line |
| 1563 endings. Our solution is to convert all line endings to LF. | 1563 endings. Our solution is to convert all line endings to LF. |
| 1564 """ | 1564 """ |
| 1565 text = text.replace('\r\n', '\n') | 1565 if text is not None: |
| 1566 return text.replace('\r', '\n') | 1566 text = text.replace('\r\n', '\n') |
| 1567 return text.replace('\r', '\n') | |
| 1568 return text | |
| 1567 | 1569 |
| 1568 def rawToHyperdb(db, klass, itemid, propname, value, **kw): | 1570 def rawToHyperdb(db, klass, itemid, propname, value, **kw): |
| 1569 """ Convert the raw (user-input) value to a hyperdb-storable value. The | 1571 """ Convert the raw (user-input) value to a hyperdb-storable value. The |
| 1570 value is for the "propname" property on itemid (may be None for a | 1572 value is for the "propname" property on itemid (may be None for a |
| 1571 new item) of "klass" in "db". | 1573 new item) of "klass" in "db". |
