lanto03 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

Document.load() does not return None for non existent documents #214

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to load a Document from an empty cdb (e.g. mydoc = MyDoc.load(db, myid)
2. Test wether or not the document was loaded (e.g. if mydoc is None:)

What is the expected output? What do you see instead?
I would expect the if expression to eval to true but it fails

What version of the product are you using? On what operating system?
couchdb module 0.8, MacOS 10.8

Original issue reported on code.google.com by silvan.k...@web.de on 22 Aug 2012 at 7:56

GoogleCodeExporter commented 8 years ago
What's actual result you got for nonexisted id?

Original comment by kxepal on 22 Aug 2012 at 8:01

GoogleCodeExporter commented 8 years ago
str() produces (PeakTimes is the document type, the following was loaded by 
PeakTimes.load(id)):

<PeakTimes None@None {u'update_seq': 0, u'disk_size': 79, u'purge_seq': 0, 
u'doc_count': 0, u'compact_running': False, u'db_name': u'timeplanertestdb', 
u'doc_del_count': 0, u'instance_start_time': u'1345619141158717', 
u'committed_update_seq': 0, u'data_size': 0, u'disk_format_version': 6}>

Original comment by silvan.k...@web.de on 22 Aug 2012 at 1:46

GoogleCodeExporter commented 8 years ago
BTW, i'm using python 2.7.2

Original comment by silvan.k...@web.de on 22 Aug 2012 at 1:47

GoogleCodeExporter commented 8 years ago
Looks like you've got dbinfo instead of document. This information is available 
if you make GET request to database resource e.g http://localhost:5984/dbname . 
Could you provide some code snippet that reproduces problem to let me say 
what's wrong more directly?

Original comment by kxepal on 22 Aug 2012 at 3:04

GoogleCodeExporter commented 8 years ago
I will but as I'm going for a short vacation today this will happen next week 
(probably wednesday).
Sorry for the delay & thanks for looking into this!

Original comment by silvan.k...@web.de on 23 Aug 2012 at 8:18

GoogleCodeExporter commented 8 years ago
Hmm, classical case of murphy.
I just wrote an example which ran as expected. Rechecking with my application 
this now is running well, too, loading non existent documents produces a None 
value.
Probably shutdown/restart of the system & the DBMS solved this...
Should this issue pop up again i'll immediately provide an example & logs,
sorry i took your time.
Cheers

Original comment by silvan.k...@web.de on 29 Aug 2012 at 7:05

GoogleCodeExporter commented 8 years ago
Good to hear that! Closing issue, but if you'll get it once again feel free to 
report about - we'll reopen it.

Original comment by kxepal on 11 Oct 2012 at 11:40