[Twisted-Python] autoincrement in axiom

Hi, Is there a way to use autoincrement in axiom ? I need a property in my model that reflects the last row id after every insert operation. Also, is it safe to use non-db variables in axiom model ? something like class test1(Item): name = attributes.text() surname = "my non db variable" The interpretor does throw an error but that can be overcome by using self.__dict__['surname'] = "non db" . Just wanted to know if this is recommended or not sorry, if this' already been answered; i did search but couldn't find the answer. Thanks

On Mon, Mar 1, 2010 at 1:31 AM, code prophecy <codeprophecy1@gmail.com> wrote:
Is there a way to use autoincrement in axiom ? I need a property in my model that reflects the last row id after every insert operation.
There isn't currently any way to have an autoincrement attribute. However, the storeID attribute is unique across every Item in a Store; perhaps this is sufficient for your purposes?
Also, is it safe to use non-db variables in axiom model ? something like
class test1(Item): name = attributes.text()
surname = "my non db variable"
The interpretor does throw an error but that can be overcome by using self.__dict__['surname'] = "non db" . Just wanted to know if this is recommended or not
You should declare the attribute like this: surname = attributes.inmemory() Axiom will then allow you to set the attribute, which will not be persisted in the database. -- mithrandi, i Ainil en-Balandor, a faer Ambar
participants (2)
-
code prophecy
-
Tristan Seligmann