Looks like for now the del db.mytable[id] syntax is incompatible with 
enable_record_versioning. By default, enable_record_versioning shortcuts 
the delete process via a _before_delete callback -- rather than deleting 
the record, it simply sets the is_active field to False. This causes the 
.delete() method to return 0, which makes the Table.__delitem__ method 
think the delete failed, leading to the exception.

Not sure of a good way around this. The .delete() method returns a 0 if 
either the delete fails or if any of the _before_delete callbacks returns a 
non-falsey value. There also does not appear to be a way to verify for 
certain that a particular table is being archived via 
enable_record_versioning.

Anthony

On Saturday, February 15, 2014 11:35:02 AM UTC-5, Horst Horst wrote:
>
> Hi Massimo,
>
> del db.piece[int(id)]
>
> doesn't work either. But I can definitely confirm that it depends on the
>
> auth.enable_record_versioning(db)
>
> being enabled in the model file. If I comment out the line, the error does 
> not occur, if I put it in, the error comes back.
>
>
>
> Am Samstag, 15. Februar 2014 05:09:54 UTC+1 schrieb Massimo Di Pierro:
>>
>> del table[id]
>>
>> is more picky. Raises an exception if id is not int and if the record 
>> does not exist.
>>
>> On Friday, 14 February 2014 16:23:04 UTC-6, Horst Horst wrote:
>>>
>>> I have a controller function for record deletion which worked reliably 
>>> for quite some time.
>>>
>>> Today I've added
>>>
>>>   added auth.enable_record_versioning(db)
>>>
>>> to my model file for the first time (my tables had auth.signature fields 
>>> already).
>>>
>>> Since then, I get 
>>>
>>>   <type 'exceptions.SyntaxError'> No such record: 230
>>>
>>> tickets whenever I call 
>>>
>>>   del db.piece[id]
>>>
>>> However,
>>>
>>>   db(db.piece.id == id).delete()
>>>
>>> works fine.
>>>
>>> (And yes, the records *do* exist.)
>>>
>>> I've found this thread here 
>>> https://groups.google.com/forum/#!topic/web2py/rNv8oARIttI where 
>>> someone appears to have a similar problem. (There's no conclusion though.)
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to