Does Lazy Tables setting only have relevance if migration = True?

104 views
Skip to first unread message

Alex Glaros

unread,
Apr 15, 2015, 3:29:52 PM4/15/15
to web...@googlegroups.com
Does Lazy Tables setting only have relevance if migration = True?

Is it not necessary if migration = False?

thanks

Alex Glaros

Anthony

unread,
Apr 15, 2015, 3:41:09 PM4/15/15
to web...@googlegroups.com
No, it saves time in both cases (turning off migrations saves additional time).

Anthony

Alex Glaros

unread,
Apr 15, 2015, 5:37:35 PM4/15/15
to web...@googlegroups.com
When setting lazy_tables = True

I get this error 

 'NoneType' object has no attribute 'upload'


Traceback (most recent call last):
  File "gluon/restricted.py", line 224, in restricted
  File "C:/alex/web2py/web2py/web2py/applications/ES1/models/db.py", line 56, in <module>
    ckeditor.define_tables()
  File "applications\ES1\modules\plugin_ckeditor.py", line 69, in define_tables
    minsize=self.settings.file_length_min),
AttributeError: 'NoneType' object has no attribute 'upload'



from plugin_ckeditor import CKEditor
ckeditor = CKEditor(db)
ckeditor.define_tables()  ## here is my line # 56
ckeditor.settings.url_upload = URL(request.app, 'plugin_ckeditor', 'upload', extension='html')
ckeditor.settings.url_browse = URL(request.app, 'plugin_ckeditor', 'browse', extension='html')

Alex


Niphlod

unread,
Apr 15, 2015, 5:49:02 PM4/15/15
to web...@googlegroups.com
the code to post to be helped is the INNER exception, not the OUTER one. What's on line 69 of plugin_ckeditor ?

Alex Glaros

unread,
Apr 15, 2015, 5:52:54 PM4/15/15
to web...@googlegroups.com
    )
        #lazy tables breaks this. Need to force the load of the table
        self.settings.table_upload.upload.requires = [
            IS_NOT_EMPTY(),
            IS_LENGTH(maxsize=self.settings.file_length_max,
                      minsize=self.settings.file_length_min),  ## this is line #69
        ]


    def widget(self, field, value, **attributes):

Anthony

unread,
Apr 15, 2015, 6:08:09 PM4/15/15
to web...@googlegroups.com
Looks like the current plugin code is not compatible with lazy tables. A quick fix is to just move the "requires" assignment into the field definition within the table definition, rather than doing it after the table definition.

Anthony

Alex Glaros

unread,
Apr 16, 2015, 5:30:35 PM4/16/15
to web...@googlegroups.com
Anthony,

editor already only defined in field, but error persists. Below are only places referenced.

MODEL
from plugin_ckeditor import CKEditor
ckeditor = CKEditor(db)
ckeditor.define_tables()
ckeditor.settings.url_upload = URL(request.app, 'plugin_ckeditor', 'upload', extension='html')
ckeditor.settings.url_browse = URL(request.app, 'plugin_ckeditor', 'browse', extension='html')


auth.settings.extra_fields['auth_user']= [
    Field('summarySelfDescription','text', widget=ckeditor.widget),










Alex Glaros

unread,
Apr 17, 2015, 3:26:12 PM4/17/15
to web...@googlegroups.com
if plugin code is not compatible with lazy tables, should should someone report a bug or make fix request?

Alex

Anthony

unread,
Apr 17, 2015, 3:40:45 PM4/17/15
to web...@googlegroups.com


On Thursday, April 16, 2015 at 5:30:35 PM UTC-4, Alex Glaros wrote:
Anthony,

editor already only defined in field, but error persists.

The error results from the plugin code -- have you fixed that?

Anthony

Anthony

unread,
Apr 17, 2015, 3:42:26 PM4/17/15
to web...@googlegroups.com
On Friday, April 17, 2015 at 3:26:12 PM UTC-4, Alex Glaros wrote:
if plugin code is not compatible with lazy tables, should should someone report a bug or make fix request?

I don't know if the plugin is being maintained (it is not part of web2py). If not, you can simply make the change yourself.

Anthony

Alex Glaros

unread,
Apr 17, 2015, 3:55:30 PM4/17/15
to web...@googlegroups.com
sorry, didn't see your question above.  

can you please describe details of how to make the change?

Anthony

unread,
Apr 18, 2015, 11:18:46 AM4/18/15
to web...@googlegroups.com
Here you showed a snippet of code from the plugin. That assignment to the "requires" attribute should be moved into the original field definition, not set afterwards.

Anthony

Alex Glaros

unread,
Apr 18, 2015, 11:51:36 PM4/18/15
to web...@googlegroups.com
that error disappeared with your fix but was replaced with new error

<type 'exceptions.AttributeError'> 'NoneType' object has no attribute 'id'

Version

web2py™Version 2.9.12-stable+timestamp.2015.01.17.06.11.03
PythonPython 2.7.6: C:\Program Files\web2py\web2py\web2py.exe (prefix: )

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
Traceback (most recent call last):
 
File "gluon/restricted.py", line 224, in
restricted
  File
"C:/Program Files/web2py/web2py/applications/ES1/controllers/plugin_ckeditor.py", line 61, in <module>
 
File "gluon/globals.py", line 393, in <lambda>
 
File "C:/Program Files/web2py/web2py/applications/ES1/controllers/plugin_ckeditor.py", line 33, in browse
    set
= db(table_upload.id>0)
AttributeError: 'NoneType' object has no attribute 'id'

Error snapshot help

<type 'exceptions.AttributeError'>('NoneType' object has no attribute 'id')

inspect attributes

Frames

  • File C:\Program Files\web2py\web2py\gluon\restricted.py in restricted at line 224 code arguments variables

  • File C:\Program Files\web2py\web2py\applications\ES1\controllers\plugin_ckeditor.py in <module> at line 61 code arguments variables

  • File C:\Program Files\web2py\web2py\gluon\globals.py in <lambda> at line 393 code arguments variables

  • File C:\Program Files\web2py\web2py\applications\ES1\controllers\plugin_ckeditor.py in browse at line 33 code arguments variables

    Function argument list

    ()

    Code listing
    28.
    29.
    30.
    31.
    32.
    33.

    34.
    35.
    36.
    37.

    def browse():
       
    db = current.plugin_ckeditor.db
        table_upload
    = current.plugin_ckeditor.settings.table_upload
        browse_filter
    = current.plugin_ckeditor.settings.browse_filter
        set = db(table_upload.id>0)

       
    for key, val in browse_filter.items():
           
    if value[0] == '<':
               
    set = set(table_upload[key]<value[1:])
           
    elif value[0] == '>':
    Variables


Alex Glaros

unread,
Apr 19, 2015, 12:14:01 AM4/19/15
to web...@googlegroups.com
wait...it does work... only time the above error is raised is when a link is attempted to be made for a text string in ckeditor

seems a little too buggy for users at this time though

is there a safer, less fancy alternative to ckeditor?

thanks

Alex
Reply all
Reply to author
Forward
0 new messages