Hi,

btw, I upgraded from 1.87 to 1.91 to see if the problem would get
resolved and 1.91 is loading my pages significantly faster. Also, the
revised version of the pdf manual is greatly superior to the original.
Thank you for that.

So, I tried to get fancy and use a computer field in my model and now
I'm getting an error (serves me right for trying to be fancy).

Either I'm doing something wrong or there is a bug. If I'm doing
something wrong, I'd like to know.

the relevant entry in model is as follow:

Forums_db.define_table('Forum_poster',
    Field('Alias', 'string', length=128, required=True),
    Field('Alias_ordinal', 'integer', default=1),
    Field('Alias_apparent', compute=lambda r: (r['Alias'] if
r['Alias_ordinal']==1 else r['Alias']+'['+str(r['Alias_ordinal'])
+']')),
    Field('Email', length=128, required=True),
    Field('Number_of_posts', 'integer', default=0),
    Field('Banned', 'boolean', default=False))

Whenever I try to write in the DB (insert or update), I get a key
error on 'Alias_ordinal'.

The relevant parts of the error log are as follow:

Last entry pertaining to my code:

  File "applications\Ascent\modules\Forum_tools.py", line 140, in
Submit_thread
 
DB(DB.Forum_poster.id==Poster['ID']).update(Number_of_posts=Poster['Number_of_posts']
+1)

Last entry pertaining to gluon internals:

  File "G:/Game_0_42/Code/web2py/applications/Ascent/models/
Forums.py", line 21, in <lambda>
    Field('Alias_apparent', compute=lambda r: (r['Alias'] if
r['Alias_ordinal']==1 else r['Alias']+'['+str(r['Alias_ordinal'])
+']')),
  File "G:\Game_42\Code\web2py\gluon\dal.py", line 3054, in
__getitem__
    return dict.__getitem__(self, key)
KeyError: 'Alias_ordinal'

Some additional debug info from the log:

Function argument list

(self=<Row {'Number_of_posts': 1}>, key='Alias_ordinal')
Code listing


    def __getitem__(self, key):
        key=str(key)
        if key in self.get('_extra',{}):
            return self._extra[key]
return dict.__getitem__(self, key)


    def __call__(self,key):
        key=str(key)
        if key in self.get('_extra',{}):

Variables
self    <Row {'Number_of_posts': 1}>
dict.__getitem__        <method '__getitem__' of 'dict' objects>
builtindict     <type 'dict'>
key     'Alias_ordinal'

Any help in diagnosing the problem would be greatly appreciated.
Thanks.

Reply via email to