On 12/10/08, Gaetan de Menten <[EMAIL PROTECTED]> wrote: > > On Tue, Dec 9, 2008 at 18:42, Giovanni Marco Dall'Olio > <[EMAIL PROTECTED]> wrote: > > > Which is the most proper way to implement this behaviour? > > Is there any parameter that I should add when I declare the name Field ? > > Or, should I customize Individual.__init__? And how? > > > There is a recipe providing a similar (but a bit more explicit) pattern: > > http://elixir.ematia.de/trac/wiki/Recipes/GetByOrAddPattern#GetByorAddPattern >
Thank you very much. I am sorry, I must have missed it :(. > You could also provide the API you described above by moving that code > to/overriding the __new__ method on your class. > > > > p.s. I couldn't find any example on unique fields in elixir's > > documentation, so I sent you an example that I wrote for myself: > > - > http://elixir.ematia.de/trac/attachment/ticket/77/test_DuplicatedEntriesElixir.py > > > I don't think there should be any, see my comments in the ticket. ok, understood. Well, I am going to write a unittest for the get_by_or_add behaviour. Do you need it? p.s. this is up to you, but I think that it could be useful to add this method to the official Elixir Entity object. > -- > Gaƫtan de Menten > http://openhex.org > > > > -- My blog on bioinformatics (now in English): http://bioinfoblog.it --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
