It worked! Thank you! Alina
On Jun 30, 3:20 pm, yoav glazner <[email protected]> wrote: > On Wed, Jun 30, 2010 at 8:06 PM, alina <[email protected]> wrote: > > Hi, > > > I have a project that uses SQLAlchemy and Elixir and I'm new at this > > so I have a question: > > is there a way to define a function that would return the value of a > > file and take the field name as a parameter? > > > Something like this: > > > class PersonReqs(Entity): > > ... > > def get_field_value(self, field_name) : > > return self.value(field_name) > > > Obviously that doesn't work, I get AttributeError: 'PersonReqs' object > > has no attribute 'value'. > > I looked at the Elixir API but didn't see anything that would help. > > try: > class PersonReqs(Entity): > def get_field_value(self, field_name) : > return getattr(self,field_name) > > should work if the Fields are defined properly -- 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.
