I have this in the model...
import uuid
import os
import pygeoip
gi = pygeoip.GeoIP(os.path.join(request.folder, 'private', 'GeoIP.dat'))
def get_country(row):
        return gi.country_code_by_addr(row.from_where)
# -*- coding: utf-8 -*-
db.define_table('melodigram_play',
    Field('melodigram_id', 'reference melodigram'),
    Field('when_opened', 'datetime', default = request.now),
    Field('from_where', 'string', default = request.client),
    Field.Virtual('from_country', lambda row: get_country(row))
    )
db.melodigram_play.melodigram_id.requires = IS_NOT_EMPTY()
db.melodigram_play.when_opened.requires = IS_NOT_EMPTY()

I can insert data... but when I try to retrieve it, it tells me the row
doesn't exist:
<h2>From: {{=gram_details.from_where}} :
{{=gram_details.from_country}}</h2>
----
gram_details.from_where has always worked.
gram_details.from_country doesn't work.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to