My favorites | Sign in
Project Logo
                
Details: Show all Hide all

Last 30 days

  • Dec 02, 2009
    r63 (coerce any non-string values instead of just int ) committed by mark.r.roach   -   coerce any non-string values instead of just int
    coerce any non-string values instead of just int
  • Nov 17, 2009
    issue 9 (Encoding problem) Status changed by mark.r.roach   -   This was fixed with r53 http://code.google.com/p/pyactiveresource/source/detail?r=53
    Status: Fixed
  • Nov 17, 2009
    issue 10 (Saving an array of dicts fails) Status changed by mark.r.roach   -   Hi, Josh. Thanks for the patch. I have applied it along with some tests for this case.
    Status: Fixed
    Hi, Josh. Thanks for the patch. I have applied it along with some tests for this case.
    Status: Fixed
  • Nov 17, 2009
    r62 (Handle attributes which are lists of dictionaries ) committed by mark.r.roach   -   Handle attributes which are lists of dictionaries
    Handle attributes which are lists of dictionaries
  • Nov 17, 2009
    issue 5 (pyactiveresource does not handle nested attributes correctly) commented on by nickesk   -   Of course that should be "Slice.new(Hash.from_xml(xml)['slice'])" above
    Of course that should be "Slice.new(Hash.from_xml(xml)['slice'])" above
  • Nov 17, 2009
    issue 5 (pyactiveresource does not handle nested attributes correctly) Status changed by nickesk   -   The workaround above isn't exactly "correct" as it adds a "value" element to the array, which is not the behavior of Ruby ARes, which preserves the array format. >> class Slice < ActiveResource::Base >> self.site = 'http://localhost:3000' >> end >> xml = '''...''' >> site = Site.new(Hash.from_xml(xml)['site']) >> site.addresses => ["173.45.XXX.XXX", "172.21.XXX.XXX"] However as Mark mentions, to_xml blows up on the address Array >> site.to_xml RuntimeError: Not all elements respond to to_xml ... So this is a problem with the server's XML not being ARes-compliant. PyARes is a port of the Ruby implementation, so this should be reported upstream if you feel this is really a bug.
    Status: WontFix
    The workaround above isn't exactly "correct" as it adds a "value" element to the array, which is not the behavior of Ruby ARes, which preserves the array format. >> class Slice < ActiveResource::Base >> self.site = 'http://localhost:3000' >> end >> xml = '''...''' >> site = Site.new(Hash.from_xml(xml)['site']) >> site.addresses => ["173.45.XXX.XXX", "172.21.XXX.XXX"] However as Mark mentions, to_xml blows up on the address Array >> site.to_xml RuntimeError: Not all elements respond to to_xml ... So this is a problem with the server's XML not being ARes-compliant. PyARes is a port of the Ruby implementation, so this should be reported upstream if you feel this is really a bug.
    Status: WontFix
  • Nov 17, 2009
    issue 5 (pyactiveresource does not handle nested attributes correctly) commented on by osvaldsson   -   I'm running into this exact same problem, was there any proper fix yet or should I just use the workaround above? /Oli
    I'm running into this exact same problem, was there any proper fix yet or should I just use the workaround above? /Oli

Earlier this year

  • Nov 09, 2009
    issue 10 (Saving an array of dicts fails) commented on by josh.rickard   -   Oops, had some whitespace issues in the original attachment.
    Oops, had some whitespace issues in the original attachment.
  • Nov 09, 2009
    issue 10 (Saving an array of dicts fails) reported by josh.rickard   -   What steps will reproduce the problem? 1. attempt to save an active resource object that has an array of dict objects: record.some_value = [{"x": 1, "y": 2}, {"x": 3, "y": 4}] record.save >> errors out because pyactiveresource tries to run to_dict on a dict What is the expected output? What do you see instead? It should save without errors. What version of the product are you using? On what operating system? OSX, Ubuntu I'm very new to python but I've attached a patch that has worked for me. I'm sure it could be re-written with more elegance.
    What steps will reproduce the problem? 1. attempt to save an active resource object that has an array of dict objects: record.some_value = [{"x": 1, "y": 2}, {"x": 3, "y": 4}] record.save >> errors out because pyactiveresource tries to run to_dict on a dict What is the expected output? What do you see instead? It should save without errors. What version of the product are you using? On what operating system? OSX, Ubuntu I'm very new to python but I've attached a patch that has worked for me. I'm sure it could be re-written with more elegance.
  • Sep 30, 2009
    r61 (Make _find_class_for into a classmethod ) committed by mark.r.roach   -   Make _find_class_for into a classmethod
    Make _find_class_for into a classmethod
  • Sep 16, 2009
    r60 (Always use split_options to sanitize the option keys ) committed by mark.r.roach   -   Always use split_options to sanitize the option keys
    Always use split_options to sanitize the option keys
  • Sep 16, 2009
    r59 (Convert integers to strings ) committed by mark.r.roach   -   Convert integers to strings
    Convert integers to strings
  • Sep 16, 2009
    r58 (Avoid infinite recursion on missing self.attributes ) committed by mark.r.roach   -   Avoid infinite recursion on missing self.attributes
    Avoid infinite recursion on missing self.attributes
  • Sep 01, 2009
    r57 (Add a test for type parsing ) committed by mark.r.roach   -   Add a test for type parsing
    Add a test for type parsing
  • Sep 01, 2009
    r56 (handle unrecognized "type" on elements with children ) committed by mark.r.roach   -   handle unrecognized "type" on elements with children
    handle unrecognized "type" on elements with children
  • Jul 21, 2009
    r55 (whitespace cleanup ) committed by mark.r.roach   -   whitespace cleanup
    whitespace cleanup
  • Jul 21, 2009
    r54 (Add custom serializer support ) committed by mark.r.roach   -   Add custom serializer support
    Add custom serializer support
  • Jun 26, 2009
    r53 (Allow unicode query strings ) committed by mark.r.roach   -   Allow unicode query strings
    Allow unicode query strings
  • Jun 25, 2009
    issue 9 (Encoding problem) reported by timothee.peignier   -   What steps will reproduce the problem? 1. Use a unicode value (with an accent) as a url param What is the expected output? What do you see instead? Urlencoding should work flawlessly, instead there is an encoding error : File "/env/lib/python2.5/site-packages/pyactiveresource/activeresource.py", line 359, in find_first resources = cls._find_every(from_=from_, **kwargs) File "/env/lib/python2.5/site-packages/pyactiveresource/activeresource.py", line 473, in _find_every path = from_ + cls._query_string(kwargs) File "/env/lib/python2.5/site-packages/pyactiveresource/activeresource.py", line 521, in _query_string return '?' + urllib.urlencode(query_options) File "/usr/lib/python2.5/urllib.py", line 1250, in urlencode v = quote_plus(str(v)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 6: ordinal not in range(128) I've attached a patch that fix it (without unit test and a bit hackish).
    What steps will reproduce the problem? 1. Use a unicode value (with an accent) as a url param What is the expected output? What do you see instead? Urlencoding should work flawlessly, instead there is an encoding error : File "/env/lib/python2.5/site-packages/pyactiveresource/activeresource.py", line 359, in find_first resources = cls._find_every(from_=from_, **kwargs) File "/env/lib/python2.5/site-packages/pyactiveresource/activeresource.py", line 473, in _find_every path = from_ + cls._query_string(kwargs) File "/env/lib/python2.5/site-packages/pyactiveresource/activeresource.py", line 521, in _query_string return '?' + urllib.urlencode(query_options) File "/usr/lib/python2.5/urllib.py", line 1250, in urlencode v = quote_plus(str(v)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 6: ordinal not in range(128) I've attached a patch that fix it (without unit test and a bit hackish).
  • Jun 19, 2009
    r52 (Add a reload method ) committed by mark.r.roach   -   Add a reload method
    Add a reload method
  • Jun 19, 2009
    issue 8 (Parsing ISO 8601 datetime ) Status changed by mark.r.roach   -   I have added a link to the dateutil and pyxml packages when there is a parse error.
    Status: Fixed
    I have added a link to the dateutil and pyxml packages when there is a parse error.
    Status: Fixed
  • Jun 19, 2009
    r51 (Add a notice to timestamp parse failures ) committed by mark.r.roach   -   Add a notice to timestamp parse failures
    Add a notice to timestamp parse failures
  • Jun 19, 2009
    issue 8 (Parsing ISO 8601 datetime ) commented on by mark.r.roach   -   It would probably be wise for us to give people a hint about installing extra packages when parsing fails.
    It would probably be wise for us to give people a hint about installing extra packages when parsing fails.
  • Jun 19, 2009
    issue 7 (Encoding trouble) changed by mark.r.roach   -   Thanks for the patch, Timothee. I have fixed that in subversion.
    Status: Fixed
    Owner: mark.r.roach
    Thanks for the patch, Timothee. I have fixed that in subversion.
    Status: Fixed
    Owner: mark.r.roach
  • Jun 19, 2009
    r50 (Use unicode() instead of str() in util.to_xml() ) committed by mark.r.roach   -   Use unicode() instead of str() in util.to_xml()
    Use unicode() instead of str() in util.to_xml()
  • Jun 19, 2009
    issue 8 (Parsing ISO 8601 datetime ) commented on by timothee.peignier   -   My bad, I've not check date_parse import.
    My bad, I've not check date_parse import.
  • Jun 19, 2009
    issue 8 (Parsing ISO 8601 datetime ) reported by timothee.peignier   -   Datetime parsing in utils.xml_to_dict fail hard at parsing ISO 6601 datetime in the wild. For example: Highrise API is using a format like this : "2009-05-01T10:23:40Z" which is valid iso format but doesn't match format '%Y-%m-%dT%H:%M:%S+0000' use in xml_to_dict.
    Datetime parsing in utils.xml_to_dict fail hard at parsing ISO 6601 datetime in the wild. For example: Highrise API is using a format like this : "2009-05-01T10:23:40Z" which is valid iso format but doesn't match format '%Y-%m-%dT%H:%M:%S+0000' use in xml_to_dict.
  • Jun 19, 2009
    issue 7 (Encoding trouble) reported by timothee.peignier   -   What steps will reproduce the problem? 1. Save a object with a text value encoded in utf-8 (with accents) What is the expected output? What do you see instead? Saving the object without trouble, instead there is an encoding error : /env/lib/python2.5/site-packages/pyactiveresource/util.py in to_xml(obj, root, pretty, header) 234 element = ET.SubElement(root_element, key) 235 if value is not None: --> 236 element.text = str(value) 237 if isinstance(value, bool): 238 element.text = element.text.lower() UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 53: ordinal not in range(128) I've attached a patch that fix it (without unit test).
    What steps will reproduce the problem? 1. Save a object with a text value encoded in utf-8 (with accents) What is the expected output? What do you see instead? Saving the object without trouble, instead there is an encoding error : /env/lib/python2.5/site-packages/pyactiveresource/util.py in to_xml(obj, root, pretty, header) 234 element = ET.SubElement(root_element, key) 235 if value is not None: --> 236 element.text = str(value) 237 if isinstance(value, bool): 238 element.text = element.text.lower() UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 53: ordinal not in range(128) I've attached a patch that fix it (without unit test).
  • May 27, 2009
    r49 (Remove useless scrub_name method ) committed by mark.r.roach   -   Remove useless scrub_name method
    Remove useless scrub_name method
  • May 26, 2009
    issue 6 (Posts with no data have no Content-Length or Content-Type) commented on by mattjo...@workhorsy.org   -   I just tested on webrick again. If there is a Content-Length, but no Content-Type the server seems to try and guess the mime type. It guesses application/xml with xml posts. But with other types like jpeg, it sometimes gets application/octet-stream or image/jpeg. Other times it ignores the data completely. Essentially, it may work fine with no Content-Type, because pyactiveresource just uses XML. But once, or if it is updated to do other types of POST and PUT operations, it should be included. For example, right now, if you want to upload a 10 MB file with POST, you need to base64 it and put it inside xml. Ideally you would just attach the raw file to the bottom of the http request and say the content type is image/jpeg. So it is one of those grey areas. Where it does not matter now, but may later.
    I just tested on webrick again. If there is a Content-Length, but no Content-Type the server seems to try and guess the mime type. It guesses application/xml with xml posts. But with other types like jpeg, it sometimes gets application/octet-stream or image/jpeg. Other times it ignores the data completely. Essentially, it may work fine with no Content-Type, because pyactiveresource just uses XML. But once, or if it is updated to do other types of POST and PUT operations, it should be included. For example, right now, if you want to upload a 10 MB file with POST, you need to base64 it and put it inside xml. Ideally you would just attach the raw file to the bottom of the http request and say the content type is image/jpeg. So it is one of those grey areas. Where it does not matter now, but may later.
  • May 26, 2009
    issue 6 (Posts with no data have no Content-Length or Content-Type) Status changed by mark.r.roach   -  
    Status: Fixed
    Status: Fixed
  • May 26, 2009
    r48 (Add content-type and content-length to PUT/POST requests ) committed by mark.r.roach   -   Add content-type and content-length to PUT/POST requests
    Add content-type and content-length to PUT/POST requests
  • May 26, 2009
    issue 6 (Posts with no data have no Content-Length or Content-Type) commented on by mark.r.roach   -   From my testing, it doesn't look like content-type is needed as long as content-length is specified. Can you confirm this?
    From my testing, it doesn't look like content-type is needed as long as content-length is specified. Can you confirm this?
  • May 23, 2009
    issue 6 (Posts with no data have no Content-Length or Content-Type) commented on by mark.r.roach   -   Thanks, Matt. This looks good. I'll commit it on tues.
    Thanks, Matt. This looks good. I'll commit it on tues.
  • May 21, 2009
    issue 6 (Posts with no data have no Content-Length or Content-Type) reported by mattjo...@workhorsy.org   -   Many web servers puke when they get a HTTP POST or PUT with no Content-Length and Content-Type. For example the Ruby on Rails Webrick development server throws when they are missing. In pyactiveresource, if you do a POST or PUT with no data the Content-Length and Content-Type headers are missing. Here is a svn patch to fix this. It just uses the default content type and a length of zero, when there is no data.
    Many web servers puke when they get a HTTP POST or PUT with no Content-Length and Content-Type. For example the Ruby on Rails Webrick development server throws when they are missing. In pyactiveresource, if you do a POST or PUT with no data the Content-Length and Content-Type headers are missing. Here is a svn patch to fix this. It just uses the default content type and a length of zero, when there is no data.
  • May 12, 2009
    r47 (Re-enable the tests for dictionaries returned for uris which...) committed by mark.r.roach   -   Re-enable the tests for dictionaries returned for uris which expect arrays
    Re-enable the tests for dictionaries returned for uris which expect arrays
  • May 01, 2009
    r46 (ensure that multiple writes set .attributes appropriately ) committed by mark.r.roach   -   ensure that multiple writes set .attributes appropriately
    ensure that multiple writes set .attributes appropriately
  • Apr 09, 2009
    r45 (Fix tests to handle user/password == '' ) committed by mark.r.roach   -   Fix tests to handle user/password == ''
    Fix tests to handle user/password == ''
  • Apr 09, 2009
    r44 (Fix xml_to_dict to handle children whose type differs from t...) committed by mark.r.roach   -   Fix xml_to_dict to handle children whose type differs from their parent
    Fix xml_to_dict to handle children whose type differs from their parent
  • Apr 03, 2009
    issue 5 (pyactiveresource does not handle nested attributes correctly) commented on by mark.r.roach   -   Hi, Alex. Sorry to have missed this report. I need to make these things go to the mailing list. Hm, that's an interesting one. I think slicehost might be using an older version of rails because Ruby's ActiveResource 2 doesn't like that xml either: >> s.attributes => {"name"=>"cloudkick0", "status"=>"active", "addresses"=>["173.45.XXX.XXX", "172.21.XXX.XXX"], "id"=>0, "progress"=>100, "bw_out"=>0.69, "bw_in"=>0.62, "image_id"=>11, "ip_address"=>"173.45.XXX.XXX", "flavor_id"=>4} >> s.to_xml RuntimeError: Not all elements respond to to_xml A solution I have used to handle older servers is to subclass the Connection class with one that does horrible regex hacks on the xml before/after encoding/decoding.
    Hi, Alex. Sorry to have missed this report. I need to make these things go to the mailing list. Hm, that's an interesting one. I think slicehost might be using an older version of rails because Ruby's ActiveResource 2 doesn't like that xml either: >> s.attributes => {"name"=>"cloudkick0", "status"=>"active", "addresses"=>["173.45.XXX.XXX", "172.21.XXX.XXX"], "id"=>0, "progress"=>100, "bw_out"=>0.69, "bw_in"=>0.62, "image_id"=>11, "ip_address"=>"173.45.XXX.XXX", "flavor_id"=>4} >> s.to_xml RuntimeError: Not all elements respond to to_xml A solution I have used to handle older servers is to subclass the Connection class with one that does horrible regex hacks on the xml before/after encoding/decoding.
  • Mar 22, 2009
    r43 (Update version and Dev Status classifier) committed by jared.kuolt   -   Update version and Dev Status classifier
    Update version and Dev Status classifier
  • Mar 22, 2009
    r42 (Check for boolean value in to_xml) committed by jared.kuolt   -   Check for boolean value in to_xml
    Check for boolean value in to_xml
  • Feb 24, 2009
    issue 5 (pyactiveresource does not handle nested attributes correctly) reported by alexpolvi   -   When using pyactiveresource with the slicehost API, it incorrectly handles nested elements in the response text. For example, a response from api.slicehost.com/slices.xml: <slice> <name>cloudkick0</name> <status>active</status> <addresses type="array"> <address>173.45.XXX.XXX</address> <address>172.21.XXX.XXX</address> </addresses> <id type="integer">ZZZZZ</id> <progress type="integer">100</progress> <bw-out type="float">0.69</bw-out> <bw-in type="float">0.62</bw-in> <image-id type="integer">11</image-id> <ip-address>173.45.XXX.XXX</ip-address> <flavor-id type="integer">4</flavor-id> </slice> Calling to_xml() on this Slice object returns: <slice> <status>active</status> <name>cloudkick0</name> <bw-in>0.62</bw-in> <bw-out>0.69</bw-out> <image-id type="integer">11</image-id> <flavor-id type="integer">4</flavor-id> <progress type="integer">100</progress> <ip-address>173.45.XXX.XXX</ip-address> <id type="integer">ZZZZZ</id> <addresses type="array"> <address /> <address /> </addresses> </slice> You'll notice the address elements are no longer there. Applying this patch sort of makes it work: --- activeresource.py.old 2009-02-24 11:32:18.000000000 -0800 +++ activeresource.py 2009-02-24 11:32:20.000000000 -0800 @@ -858,7 +858,7 @@ attr = klass(value) elif isinstance(value, list): klass = self._find_class_for(util.singularize(key)) - attr = [klass(child) for child in value] + attr = [klass({'value': child}) for child in value] else: attr = value # Store the actual value in the attributes dictionary Now the result is: <slice> <status>active</status> <name>cloudkick0</name> <bw-in>0.62</bw-in> <bw-out>0.69</bw-out> <image-id type="integer">11</image-id> <flavor-id type="integer">4</flavor-id> <progress type="integer">100</progress> <ip-address>173.45.XXX.XXX</ip-address> <id type="integer">ZZZZZ</id> <addresses type="array"> <address> <value>173.45.XXX.XXX</value> </address> <address> <value>172.21.XXX.XXX</value> </address> </addresses> </slice> This is still incorrect, but at least we can access that data. Any ideas of a proper fix? Thanks!
    When using pyactiveresource with the slicehost API, it incorrectly handles nested elements in the response text. For example, a response from api.slicehost.com/slices.xml: <slice> <name>cloudkick0</name> <status>active</status> <addresses type="array"> <address>173.45.XXX.XXX</address> <address>172.21.XXX.XXX</address> </addresses> <id type="integer">ZZZZZ</id> <progress type="integer">100</progress> <bw-out type="float">0.69</bw-out> <bw-in type="float">0.62</bw-in> <image-id type="integer">11</image-id> <ip-address>173.45.XXX.XXX</ip-address> <flavor-id type="integer">4</flavor-id> </slice> Calling to_xml() on this Slice object returns: <slice> <status>active</status> <name>cloudkick0</name> <bw-in>0.62</bw-in> <bw-out>0.69</bw-out> <image-id type="integer">11</image-id> <flavor-id type="integer">4</flavor-id> <progress type="integer">100</progress> <ip-address>173.45.XXX.XXX</ip-address> <id type="integer">ZZZZZ</id> <addresses type="array"> <address /> <address /> </addresses> </slice> You'll notice the address elements are no longer there. Applying this patch sort of makes it work: --- activeresource.py.old 2009-02-24 11:32:18.000000000 -0800 +++ activeresource.py 2009-02-24 11:32:20.000000000 -0800 @@ -858,7 +858,7 @@ attr = klass(value) elif isinstance(value, list): klass = self._find_class_for(util.singularize(key)) - attr = [klass(child) for child in value] + attr = [klass({'value': child}) for child in value] else: attr = value # Store the actual value in the attributes dictionary Now the result is: <slice> <status>active</status> <name>cloudkick0</name> <bw-in>0.62</bw-in> <bw-out>0.69</bw-out> <image-id type="integer">11</image-id> <flavor-id type="integer">4</flavor-id> <progress type="integer">100</progress> <ip-address>173.45.XXX.XXX</ip-address> <id type="integer">ZZZZZ</id> <addresses type="array"> <address> <value>173.45.XXX.XXX</value> </address> <address> <value>172.21.XXX.XXX</value> </address> </addresses> </slice> This is still incorrect, but at least we can access that data. Any ideas of a proper fix? Thanks!
  • Jan 26, 2009
    r41 (Bless version as 1.0) committed by jared.kuolt   -   Bless version as 1.0
    Bless version as 1.0
  • Jan 22, 2009
    r40 (Fix for r38 stupidity) committed by jared.kuolt   -   Fix for r38 stupidity
    Fix for r38 stupidity
  • Jan 22, 2009
    r39 (Add version 0.4) committed by jared.kuolt   -   Add version 0.4
    Add version 0.4
  • Jan 22, 2009
    issue 4 (Trunk causes 401 on slicehost) Status changed by jared.kuolt   -   Fixed in r38
    Status: Verified
    Fixed in r38
    Status: Verified
  • Jan 22, 2009
    r38 (Allow user and/or pass in auth (used to only work with both)) committed by jared.kuolt   -   Allow user and/or pass in auth (used to only work with both)
    Allow user and/or pass in auth (used to only work with both)
  • Jan 12, 2009
    issue 4 (Trunk causes 401 on slicehost) reported by a...@polvi.net   -   I was using pyactiveresource from trunk (r37), and was getting 401 unauthorized calls on all api calls. Installing from easy_install fixed the problem: Best match: pyactiveresource 0.3 Downloading http://pypi.python.org/packages/source/p/pyactiveresource/pyactiveresource-0.3.tar.gz#md5=c9feebf27d98333a821ec4e05a2d7e7a Processing pyactiveresource-0.3.tar.gz sample app: import pyactiveresource from pyactiveresource.activeresource import ActiveResource api_password = 'f5....80' api_site = 'https://%s@api.slicehost.com/' % api_password print api_site class Slice(ActiveResource): _site = api_site s = Slice.find() print s
    I was using pyactiveresource from trunk (r37), and was getting 401 unauthorized calls on all api calls. Installing from easy_install fixed the problem: Best match: pyactiveresource 0.3 Downloading http://pypi.python.org/packages/source/p/pyactiveresource/pyactiveresource-0.3.tar.gz#md5=c9feebf27d98333a821ec4e05a2d7e7a Processing pyactiveresource-0.3.tar.gz sample app: import pyactiveresource from pyactiveresource.activeresource import ActiveResource api_password = 'f5....80' api_site = 'https://%s@api.slicehost.com/' % api_password print api_site class Slice(ActiveResource): _site = api_site s = Slice.find() print s
  • Jan 05, 2009
    r37 (Make attributes optional. ) committed by mark.r.roach   -   Make attributes optional.
    Make attributes optional.
 
Hosted by Google Code