Custom primary key cannot be set

Issue #28 wontfix
imbolc
created an issue

on pypi version

{{{

!python

import doqu db = doqu.get_db(backend='docu.ext.tokyo_cabinet', path='var/doqu.tct') db.clear() obj = doqu.Document(a='b') obj.save(db, 'key') u'1' }}}

Comments (4)

  1. Andy Mikhaylenko repo owner

    Thanks for the report. I'm sure this will be fixed in the next release. Per-backend tests for storage and query adapters already exist (and the discovered bugs are fixed). I just haven't had the time to add the new code to the repo yet.

  2. Andy Mikhaylenko repo owner

    Take a look at the method signature:

    Document.save(self, storage=None, keep_key=False)
    

    Note that this code:

    obj.save(db, 'key')
    

    is actually equivalent to:

    obj.save(db, keep_key=True)
    

    There's currently no way to explicitly set the key via Document class. However, this works perfectly with and without Document involved:

    db.save(obj, 'key')
    
  3. Log in to comment