Mercurial > p > roundup > code
changeset 3992:fe2af84a5ca5
allow binary data for "content" props through rawToHyperdb
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 18 Aug 2008 06:21:53 +0000 |
| parents | 13161539e5bd |
| children | 1eba65a4b0aa |
| files | CHANGES.txt roundup/hyperdb.py test/test_xmlrpc.py |
| diffstat | 3 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Mon Aug 18 06:03:06 2008 +0000 +++ b/CHANGES.txt Mon Aug 18 06:21:53 2008 +0000 @@ -20,6 +20,7 @@ - Session API and cleanup thanks anatoly t. - Make WSGI handler threadsafe (sf #1968027) - Improved URL matching RE (sf #2038858) +- Allow binary file content submission via XML-RPC (sf #1995623) 2008-03-01 1.4.4
--- a/roundup/hyperdb.py Mon Aug 18 06:03:06 2008 +0000 +++ b/roundup/hyperdb.py Mon Aug 18 06:21:53 2008 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: hyperdb.py,v 1.131 2007-09-27 06:18:53 jpend Exp $ +# $Id: hyperdb.py,v 1.132 2008-08-18 06:21:53 richard Exp $ """Hyperdatabase implementation, especially field types. """ @@ -53,8 +53,12 @@ def __init__(self, indexme='no', required=False): super(String, self).__init__(required) self.indexme = indexme == 'yes' - def from_raw(self, value, **kw): + def from_raw(self, value, propname='', **kw): """fix the CRLF/CR -> LF stuff""" + if propname == 'content': + # Why oh why wasn't the FileClass content property a File + # type from the beginning? + return value return fixNewlines(value) def sort_repr (self, cls, val, name): if not val:
--- a/test/test_xmlrpc.py Mon Aug 18 06:03:06 2008 +0000 +++ b/test/test_xmlrpc.py Mon Aug 18 06:21:53 2008 +0000 @@ -69,6 +69,12 @@ results = self.server.display('joe', 'random', issueid, 'title') self.assertEqual(results['title'], 'foo') + def testFileCreate(self): + results = self.server.create('joe', 'random', 'file', 'content=hello\r\nthere') + fileid = 'file' + results + results = self.server.display('joe', 'random', fileid, 'content') + self.assertEqual(results['content'], 'hello\r\nthere') + def testAuthUnknown(self): # Unknown user (caught in XMLRPC frontend). self.assertRaises(Unauthorised, self.server.list,
