Hello I am having a problem with CKEditor in Crud I get the following error
when I try to use it

Traceback (most recent call last):
  File "/opt/web2py/gluon/restricted.py", line 192, in restricted
    exec ccode in environment
  File "/opt/web2py/applications/pstv/controllers/control_panel.py"
<https://www.paradigmshift.tv/admin/edit/pstv/controllers/control_panel.py>,
line 158, in <module>
  File "/opt/web2py/gluon/globals.py", line 145, in <lambda>
    self._caller = lambda f: f()
  File "/opt/web2py/gluon/tools.py", line 2499, in f
    return action(*a, **b)
  File "/opt/web2py/applications/pstv/controllers/control_panel.py"
<https://www.paradigmshift.tv/admin/edit/pstv/controllers/control_panel.py>,
line 28, in contributions
    db.contrib.contributions = advanced_editor
  File "/opt/web2py/gluon/dal.py", line 4735, in __setattr__
    raise SyntaxError, 'Object exists and cannot be redefined: %s' % key
SyntaxError: Object exists and cannot be redefined: contributions


It works perfectly fine in another function that is pretty much the same
thing. I have posted the code below hoping some one can shed a light on
this.

DAL code

db.define_table('contrib',
    Field('userinfo', db.auth_user, default=auth.user_id, readable=False,
writable=False),
    Field('title'),
    Field('contributions','text',requires=IS_NOT_EMPTY()))

Controller Code

@auth.requires_membership('admin')
def contributions():
    db.contrib.contributions = advanced_editor
    form =
crud.update(db.contrib,1,deletable=False,next=URL('control_panel','contributions'))
    #response.flash = 'You have successfully updated your Contributions
page'
    return dict(form=form)

Editor code in db.py

def advanced_editor(field, value):
    return TEXTAREA(_id = str(field).replace('.','_'), _name=field.name,
_class='text ckeditor', value=value, _cols=80, _rows=10)

and the view

{{extend 'cpanel.html'}}

<h1>Easily update your Contributions page!</h1>
{{=form}}

I have another bit of code which is basically the same as this. and it
works great

Any ideas greatly appreciated *cheers

Thank You

Reply via email to