-
Notifications
You must be signed in to change notification settings - Fork 55
Populating _id with a url results in document that cannot be deleted #32
Comments
@ewann, This is definitely a bug. I added an internal FogBugz case to track it. It will likely be fixed for the beta release. For now you can get around the problem by manually fetching the document while encoding the import urllib
doc = Document(db, urllib.quote(unencoded, safe=''))
doc.fetch()
doc.delete()
del doc |
thanks. In case anyone follows along behind, here is I suspect the same bug, differently manifest:
Backtrace:
|
I'm not sure that this is exactly the same as your original issue. Here you are getting a conflict originating from the Document One other thing that may be an issue is my original proposed "work around". For example when you do: my_document = my_database[urllib.quote('Mm5kMTQ0ODQxNTY0MC45OA==', safe='')]
...
my_document = my_database['Mm5kMTQ0ODQxNTY0MC45OA=='] You actually are unknowingly adding two members to the locally cached import urllib
doc = Document(db, urllib.quote(unencoded, safe=''))
doc.fetch()
doc.delete()
del doc This is a safer work around that does not cause any unwanted side effects. |
This comment is for our internal purposes to fix the bug in a future release. Not a work around. To resolve the issue I propose that we change the Document.document_url() method to wrap self._document_id in a call to urllib.quote() using the safe='' argument. As in: @property
def document_url(self):
"""constructs and returns the document URL"""
if self._document_id is None:
return None
return posixpath.join(
self._database_host,
urllib.quote_plus(self._database_name),
urllib.quote(self._document_id, safe='') # <-- This is the fix!!!
) The fix needs to be thoroughly tested and test case(s) added as well. |
This bug is resolved and the fix should be made available with the 2.0.0b1 release. |
I don't know if this is a bug or feature request. Either way, to repro:
The text was updated successfully, but these errors were encountered: