# HG changeset patch # User Richard Jones # Date 1219040513 0 # Node ID fe2af84a5ca5a213ea79217760fd3ad196a4f09d # Parent 13161539e5bd49e0f61135b5003016fd08ee76b8 allow binary data for "content" props through rawToHyperdb diff -r 13161539e5bd -r fe2af84a5ca5 CHANGES.txt --- 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 diff -r 13161539e5bd -r fe2af84a5ca5 roundup/hyperdb.py --- 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: diff -r 13161539e5bd -r fe2af84a5ca5 test/test_xmlrpc.py --- 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,