Jonathan LaCour wrote:
> 
> Well, if it were me, I'd just create a method called "reset" on the
> entity itself that either loops through the columns (which I really
> don't consider "hard" or complex), or just manually references the
> columns, and resets their values to some default state:
> 
>      class MyThing(Entity):
>          a = Field(String)
>          b = Field(Boolean)
>          c = Field(DateTime)
>          d = Field(Binary)
> 
>          def reset(self):
>              non_resettable_cols = ('id', 'c')
>              for column in self.table.c:
>                  if column.name in non_resettable_cols:
>                      continue
>                  setattr(self, column.name, None)

I think this will work great. Thanks!

Michael

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to