thats why you have a VirtualField called get_image_url() that does
that and everywhere you need it you go

record.get_image_url()

More on virtualfields here:
http://thadeusb.com/weblog/archive/2009/12/31/web2py_virtualfields_as_an_orm_an_sqlalchemy_approach/27

--
Thadeus





On Sun, Jun 6, 2010 at 3:57 AM, Jason Brower <[email protected]> wrote:
> Yes.
> But i end up having to do that about 15 times in my document. And we all
> know programs creat ways to do everything once.
>
> ----- Original message -----
>> Sounds like you got it.
>>
>> if not record.image:
>>    if record.sex == "male":
>>        return "male.jpg"
>>    else:
>>      return "female.jpg"
>> else:
>>    return record.image
>>
>> --
>> Thadeus
>>
>>
>>
>>
>>
>> On Sat, Jun 5, 2010 at 12:22 PM, Jason Brower <[email protected]>
>> wrote:
>> > I need the avatar (IS_IMAGE) in my authentication table to have a
>> > default if nothing is entered.  Is this easily possible?  I was
>> > thinking of having it controller side and just check if it was
>> > blank... if so, default it.
>> > The image would be based on the auth_user tables .sex value.  Any ideas
>> > how to accomplish this?
>> > Best Regards,
>> > Jason Brower
>> >
>> >
>> >
>
>

Reply via email to