Re: [web2py] Error using LOAD in custom module

2011-11-29 Thread Nik Go
Nice! Are you planning to release the plugin?

Let me know if you need any help testing it. :)

On Saturday, November 26, 2011, monotasker wrote:

 I'm adapting the select_or_add widget from web2py slices so that it can be
 packaged as a plugin. In that process I'm moving the business logic from a
 model file into a custom module. But this line is throwing an error that I
 can't fix:

 form_loader_div = DIV(LOAD(c = self.controller, f = self.function, args =
 add_args, ajax = True), _id = my_select_id + _dialog-form, _title =
 self.form_title)

 The error reads: 'NoneType object is not callable'.

 I've tested each of the variables, and all of them have appropriate string
 content. The DIV helper is also working fine. So I think the problem is the
 LOAD helper. I've imported it like this:

 from gluon.rewrite import load
 LOAD = load()

 But the error persists. Am I importing LOAD improperly? Any other ideas?



Re: [web2py] Error using LOAD in custom module

2011-11-29 Thread monotasker
Thanks. Yes, I'll release the plugin as soon as I'm happy with how it 
works. I'll announce it on the list here when the time comes (hopefully in 
the next couple of weeks).


Re: [web2py] Error using LOAD in custom module

2011-11-25 Thread Bruno Rocha
You can do

from gluon import LOAD

or

in model
from gluon import current
current.LOAD = LOAD

in module

from gluon import current
LOAD = current.LOAD

On Fri, Nov 25, 2011 at 5:15 PM, monotasker scotti...@gmail.com wrote:

 I'm adapting the select_or_add widget from web2py slices so that it can be
 packaged as a plugin. In that process I'm moving the business logic from a
 model file into a custom module. But this line is throwing an error that I
 can't fix:

 form_loader_div = DIV(LOAD(c = self.controller, f = self.function, args =
 add_args, ajax = True), _id = my_select_id + _dialog-form, _title =
 self.form_title)

 The error reads: 'NoneType object is not callable'.

 I've tested each of the variables, and all of them have appropriate string
 content. The DIV helper is also working fine. So I think the problem is the
 LOAD helper. I've imported it like this:

 from gluon.rewrite import load
 LOAD = load()

 But the error persists. Am I importing LOAD improperly? Any other ideas?




-- 

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


Re: [web2py] Error using LOAD in custom module

2011-11-25 Thread monotasker
Hmmm ... Those don't seem to be working.

from gluon import LOAD

This doesn't seem to import anything. PyDev tells me that there's an 
unresolved import Still get the 'NoneType not callable' error.

from gluon import current
LOAD = current.LOAD

I get AttributeError: 'thread._local' object has no attribute 'LOAD'

Re: [web2py] Error using LOAD in custom module

2011-11-25 Thread Martín Mulone
try something like this


from gluon.compileapp import LoadFactory
def renderimages(self, page=1, postid=0):
 Render Images 

curvars = {}
curvars['page']=page
curvars['postid']=postid

environment = {}
environment['request'] = current.request
environment['response'] = current.response
LOAD = LoadFactory(environment)

return LOAD(self.controller_name, 'imageslist.html',
vars=curvars, ajax=True)


2011/11/25 monotasker scotti...@gmail.com

 Hmmm ... Those don't seem to be working.

 from gluon import LOAD

 This doesn't seem to import anything. PyDev tells me that there's an
 unresolved import Still get the 'NoneType not callable' error.


 from gluon import current
 LOAD = current.LOAD

 I get AttributeError: 'thread._local' object has no attribute 'LOAD'




-- 
 http://martin.tecnodoc.com.ar


Re: [web2py] Error using LOAD in custom module

2011-11-25 Thread monotasker
That did it! Thanks Martin. I would never have figured that out on my own. 
Is it documented anywhere in the book?