I think I found a bug in virtualfields. I have the following
controller:
def posts():
user = session.auth.user
n = user.name # returns None
Where "person" is defined as a virtualfield on user:
class Users():
def name(self):
return self.users.first_name + ' ' + self.users.last_name
db.users.virtualfields.append(Users())
The problem is that user.name returns None, because apparently the
virtualfield isn't loaded into the session variable of user.
I made this work with the following modification to the controller:
def posts():
user = db.users[session.auth.user.id]
n = user.name # returns the user name correctly!
I just had to refetch the user from the database.