The problem is the Python Version, to pass arguments after one list
unpacking *works you need to run Python 2.7+

to solve your ptoblem an run it on webfaction Python you need to replace

retorno = DIV(*works, _id='submenu2')

with this:

retorno = DIV(*works, **{"_id":'submenu2'})



On Fri, Apr 13, 2012 at 9:20 PM, Jose <jjac...@gmail.com> wrote:

> Hi all
>
> I have an application that works fine on my development machine (tested with
> versions 1.99.4, 1.99.7, trunk and another version (I forget) in
> alwaysdata)
>
> In WebFaction I have version 1.99.7 and the application throws a syntax
> error:
>
> Traceback (most recent call last):
>
>   File "/home/user/web2py/gluon/restricted.py", line 204, in restricted
>
>     ccode = compile2(code,layer)
>   File "/home/user/web2py/gluon/restricted.py", line 189, in compile2
>
>     return compile(code.rstrip().replace('\r\n','\n')+'\n', layer, 'exec')
>
>   File "/home/user/web2py/applications/dm/controllers/default.py", line 115
>     retorno = DIV(*works, _id='submenu2')
>
>                             ^
> SyntaxError: invalid syntax
>
> The code is as follows:
>
> def bg_works():
>     id_category = request.vars.id_category
>
>     qry_category = (tb_categories_translation.category == id_category)
>     qry_language = (tb_categories_translation.language == language_id)
>     category = db(qry_category & qry_language).select(cache=(cache.ram,
> 60)).first().name
>
>     qry = (tb_projects.category == id_category)
>     c = db(qry).count()
>     rows = db(qry).select(cache=(cache.ram, 60))
>     if c > 7:
>         works = [SPAN(
>                 SPAN('%02d'%(n+1),
>                 _style='cursor: pointer;',
>                 _title=r.name,
>                 _onclick="$('#id_project').attr('value','%d');
> ajax('bg_project',['id_project'],'project');"%r.id), ' |',
>                 _class='element') for n, r in enumerate(rows)]
>     else:
>         works = [SPAN(
>                 SPAN(r.name,
>                 _id='work_%d'%n,
>                 _style='cursor: pointer;',
>                 _onclick="$('#id_project').attr('value','%d');
> ajax('bg_project',['id_project'],'project');"%r.id), ' |',
>                 _class='element') for n, r in enumerate(rows)]
>
>     works.insert(0, SPAN(category, _class='category'))
>     works.insert(0, INPUT(_type='hidden', _id='id_project',
> _name='id_project'))
>
>     return DIV(*works, _id='submenu2')
>
>
> any idea?
>
> Jose
>
>


-- 

Bruno Rocha
[http://rochacbruno.com.br]

Reply via email to