Your error at this point isn't from ckeditor but you are using a reserved
sql keyword in your database table/field. I suggest removing this line
*check_reserved=['all']* or change the name of one of the fields/tables in
question.
As a side reference here is a brief bit of info for implementing ckeditor.
I haven't used ckeditor in a long time but if the code remains the same
then you can do this.
in db.py add:
def advanced_editor(field, value):
return TEXTAREA(_id = str(field).replace('.','_'), _name=field.name,
_class='text ckeditor', value=value, _cols=80, _rows=10)
For the text field you use this as an example:
Field('body', 'text', widget=advanced_editor))
In your template file example layout.html add the path to ckeditor:
<script type="text/javascript"
src="{{=URL(request.application,'static','ckeditor/ckeditor.js')}}"></script>
Then choose to sanitize or not the input. Depending if other users will
submit your form then I would choose to sanitize info:
Example sanitized:
{{=XML(query.body,sanitize=True, permitted_tags=['a',
'b', 'blockquote', 'br', 'i', 'li',
'ol', 'ul', 'p', 'cite', 'code',
'pre', 'img'],
allowed_attributes={'a':['href', 'title'],
'img':['src', 'alt'],
'blockquote':['type']})}}
Example unsanitized: {{=XML(query.body,sanitize=False)}}
you can choose what values you will allow to be displayed for that form
code in the ckeditor config. I don't remember if there is anything you need
to do in the controller files but looking at code I don't believe so.
*cheers!
On Wed, Dec 10, 2014 at 10:50 PM, Ramashish Gaurav <[email protected]>
wrote:
>
>
> Hi all !
>
> First of all, I am a newbie in web2py.
> I am working on a project and need to install an editor plugin in my
> web2py app named "editor". After hours of search I got ck_editor4 plugin
> <http://www.web2pyslices.com/slice/show/1952/ck-editor4-plugin> ,
> installed it and then made some changes in models and views of my
> application. Changes were made in :
>
> 1: editor/models/db1.py
> Contents are :
>
> # -*- coding: utf-8 -*-
> from plugin_ckeditor import CKEditor
> ckeditor = CKEditor(db)
> ckeditor.define_tables()
>
> db.define_table('content', Field('title', length=255),
> Field('public', 'boolean', default=True),
> Field('text', 'text', widget=ckeditor.widget) )
>
> 2: editor/views/default/index.html
> Contents are:
>
> {{=ckeditor.edit_in_place('.editable', URL())}}
>
> After opening the index page in browser a ticket was raised which says
> this:
>
> Traceback (most recent call last):
> File "gluon/restricted.py", line 224, in restricted
> File "C:/Users/Ramashish
> Gaurav/Downloads/web2py_win/web2py/applications/editor/models/db1.py"
> <http://127.0.0.1:8000/admin/default/edit/editor/models/db1.py>, line 4, in
> <module>
> ckeditor.define_tables()
> File "applications\editor\modules\plugin_ckeditor.py", line 59, in
> define_tables
> fake_migrate = fake_migrate,
> File "gluon/dal.py", line 8414, in define_table
> File "gluon/dal.py", line 8430, in lazy_define_table
> File "gluon/dal.py", line 8952, in __init__
> File "gluon/dal.py", line 8119, in check_reserved_keyword
> SyntaxError: invalid table/column name "length" is a "ALL" reserved SQL/NOSQL
> keyword
>
> Please help me regarding this issue (May be I am not placing the right
> code at right place).
> (I don't know whether this editor will support programming languages like
> C, C++ etc, so if you have got any new simple programming language based
> editor for web2py app, I'll be happy to install that)
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.