[web2py] long running rpc call

2014-12-01 Thread Matt Broadstone
Hi, We're making a number of rpc calls to other services using jsonrpc, and a few of them are particularly long running. I'd rather not use the scheduler, but instead was wondering if I could associate a jsonrpc httpclient in python to the current context so that longer tasks wouldn't block

Re: [web2py] controller return list instead of string or dict

2013-07-30 Thread Matt Broadstone
On Tue, Jul 30, 2013 at 2:11 PM, Matt mbroa...@gmail.com wrote: On Tuesday, July 30, 2013 11:51:08 AM UTC-4, Jonathan Lundell wrote: On 30 Jul 2013, at 8:34 AM, Anthony abas...@gmail.com wrote: Can you show your code? You say you return locals(), but locals() produces a dictionary, so it

Re: [web2py] controller return list instead of string or dict

2013-07-30 Thread Matt Broadstone
On Tue, Jul 30, 2013 at 2:14 PM, Alan Etkin spame...@gmail.com wrote: The question is: what should happen when a controller returns a list? The JSON serializer is happy to serialize a list. Is there any downside in doing it? Does it make any sense right now for a controller to return a

Re: [web2py] controller return list instead of string or dict

2013-07-30 Thread Matt Broadstone
On Tue, Jul 30, 2013 at 2:26 PM, Anthony abasta...@gmail.com wrote: @request.restful() def jsonlisttest(): response.view = 'generic.json' def GET(*args, **vars): sample_raw_rpc_response = '[one, two, three]' sample_rpc_response =

Re: [web2py] controller return list instead of string or dict

2013-07-30 Thread Matt Broadstone
On Tue, Jul 30, 2013 at 2:31 PM, Anthony abasta...@gmail.com wrote: So the advice is to make generic-list.json, and force that view, expecting that the input is in some format we decide upon. e.g. instead of returning sample_rpc_response, we return dict(result=sample_rpc_**response)? You

Re: [web2py] Re: nginx + uwsgi + web2py + PAM

2013-04-03 Thread Matt Broadstone
, April 1, 2013 4:48:59 PM UTC+2, Matt wrote: On Fri, Mar 29, 2013 at 12:15 PM, Matt Broadstone mbro...@gmail.com wrote: On Fri, Mar 29, 2013 at 12:05 PM, Niphlod nip...@gmail.com wrote: uhm. Before smashing heads against the wall, there are 3 different available methods here. 1) rely

Re: [web2py] Re: nginx + uwsgi + web2py + PAM

2013-04-01 Thread Matt Broadstone
On Fri, Mar 29, 2013 at 12:15 PM, Matt Broadstone mbroa...@gmail.com wrote: On Fri, Mar 29, 2013 at 12:05 PM, Niphlod niph...@gmail.com wrote: uhm. Before smashing heads against the wall, there are 3 different available methods here. 1) rely on nginx to authenticate users through pam

[web2py] Re: nginx + uwsgi + web2py + PAM

2013-03-29 Thread Matt Broadstone
mountpoint=/ scriptwsgihandler/script /app /uwsgi /etc/pam.d/uwsgi: @include common-auth @include common-account On Fri, Mar 29, 2013 at 11:45 AM, Matt Broadstone mbroa...@gmail.com wrote: Hi, We're trying to migrate our web2py deployment to nginx and running into a problem using

[web2py] nginx + uwsgi + web2py + PAM

2013-03-29 Thread Matt Broadstone
Hi, We're trying to migrate our web2py deployment to nginx and running into a problem using pam_auth as a login method. Before I go further I should clarify that PAM authentication works just fine with apache2 and a simple debug run with rocket. Also, we are trying to do this on Ubuntu 12.04, and

Re: [web2py] Re: nginx + uwsgi + web2py + PAM

2013-03-29 Thread Matt Broadstone
On Fri, Mar 29, 2013 at 12:05 PM, Niphlod niph...@gmail.com wrote: uhm. Before smashing heads against the wall, there are 3 different available methods here. 1) rely on nginx to authenticate users through pam (kinda of a basic auth, but checked against PAM) 2) rely on uwsgi to

Re: [web2py] Re: Can't import external modules

2012-08-15 Thread Matt Broadstone
On Wed, Aug 15, 2012 at 10:03 PM, Anthony abasta...@gmail.com wrote: Is there any way around this? This seems to have broken only with the upgrade to Mountain Lion. We develop this app primarily on (and for) linux, however I do most of my development on my laptop, so it's quite inconvenient to

Re: [web2py] use PAM groups for group membership decorators

2012-04-26 Thread Matt Broadstone
On Wed, Apr 25, 2012 at 11:39 AM, Matt mbroa...@gmail.com wrote: It seems that web2py group membership is restricted to groups created by web2py. We have a situation where we are bypassing web2py's user management and using PAM directly. This works great for just logging in, but we have no

Re: [web2py] Re: basic authentication using pam

2011-12-14 Thread Matt Broadstone
...@gmail.com wrote: Your patch is good (for pam and other methods that allow the app to handle the password) and it is in trunk On Nov 21, 3:35 pm, Matt Broadstone mbroa...@gmail.com wrote: On Mon, Nov 21, 2011 at 3:25 PM, Massimo Di Pierromassimo.dipie...@gmail.com wrote: Good point. Basic auth may

[web2py] PAM users added to auth_user

2011-11-23 Thread Matt Broadstone
Hopefully this is the last in my thread of auth related emails ;) I was wondering if there is an easy way to stop web2py adding users to its own auth_user database when the users are PAM users. I imagine this is probably an issue for all alternative login methods, not just PAM, but that's the only

Re: [web2py] Re: PAM users added to auth_user

2011-11-23 Thread Matt Broadstone
to be this way by design though I'm not sure why. The offending code seems to be tools.py:1685. Obviously this PAM solution is not complete because if system credentials change for that user, web2py will still use the old stored info (I believe). I'll work on a patch Matt On Nov 23, 8:50 am, Matt

[web2py] basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
Hello, In our project we need to create a temporary user for the web2py app so that a remote system can send back a singe status update. In order to do this, when the command is sent out we create a temporary user like this: settings[serverUser] = str(uuid.uuid4())

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
[serverPassword] = db.auth_user.password.validate(str(uuid.uuid4()))[0] On Nov 22, 8:19 am, Matt Broadstone mbroa...@gmail.com wrote: Hello, In our project we need to create a temporary user for the web2py app so that a remote system can send back a singe status update. In order to do this, when

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
On Tue, Nov 22, 2011 at 1:32 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: If the password is a UUID how are the users supposed to know what it and use it to login. I am missing something here. its a temporary password, for a one time callback. On Nov 22, 12:08 pm, Matt Broadstone

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
On Tue, Nov 22, 2011 at 2:31 PM, Matt Broadstone mbroa...@gmail.com wrote: On Tue, Nov 22, 2011 at 1:32 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: If the password is a UUID how are the users supposed to know what it and use it to login. I am missing something here. its

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
On Tue, Nov 22, 2011 at 3:50 PM, Anthony abasta...@gmail.com wrote: On Tuesday, November 22, 2011 3:00:46 PM UTC-5, Matt wrote: Aren't passwords always hashed when entered in the database? Not necessarily. You have to have the CRYPT() validator on the password field for hashing. It is there

Re: [web2py] Re: basic auth with custom get_or_create_user call

2011-11-22 Thread Matt Broadstone
On Tue, Nov 22, 2011 at 4:11 PM, Anthony abasta...@gmail.com wrote: I haven't been following the discussion. Do you want to remove the CRYPT validator? If so, I think something like: db.auth_user.password.requires = None This seems to have fixed the issue, thank you both Matt Anthony On

[web2py] basic authentication using pam

2011-11-21 Thread Matt Broadstone
Is it possible to use PAM for basic auth? I have basic auth working (thanks to Hong-Khoan Quach's patch), however I can't seem to link it to PAM. We are using PAM successfully for web based user authentication, but basic auth seems to be ignoring this. Thanks, Matt

Re: [web2py] Re: basic authentication using pam

2011-11-21 Thread Matt Broadstone
authentication. As I note in the comment I don't have time to check that this works for all auth cases, but we only allow PAM and form based logins so this solution suffices for our needs. Matt On Nov 21, 1:26 pm, Matt Broadstone mbroa...@gmail.com wrote: Is it possible to use PAM for basic auth? I

Re: [web2py] Re: login form errors

2011-11-08 Thread Matt Broadstone
When I looked at how the generated sample app handled showing that there was an error with logging in, it showed the message in a flash area in the view. To be clear here: the controller is a two-liner: def user(): return dict(form=auth()) so there is no setup in the controller, as it relates

Re: [web2py] Re: serving a zip file

2011-10-14 Thread Matt Broadstone
On Fri, Oct 14, 2011 at 9:35 AM, peter peterchutchin...@gmail.com wrote: If I now do exactly what I did one month ago, there is now no error with zip streaming. So maybe you have changed things in response.stream since then. Peter On Oct 14, 1:24 pm, peter peterchutchin...@gmail.com wrote:

Re: [web2py] Re: serving a zip file

2011-10-14 Thread Matt Broadstone
On Fri, Oct 14, 2011 at 12:48 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: What browser? That was chrome. The previously fix suggested by Brian works for me (thanks!). Matt On Oct 14, 10:30 am, Matt Broadstone mbroa...@gmail.com wrote: On Fri, Oct 14, 2011 at 9:35 AM, peter

[web2py] access to extra template files

2011-10-13 Thread Matt Broadstone
Hello, I am trying to dynamically load templates that I have stored in a subdirectory of one of my views. The structure looks like this: app/ views/ test/ index.html list.html edit.html add.html templates/ first.html

[web2py] serving a zip file

2011-10-13 Thread Matt Broadstone
Hi, In our project, we are trying to provide the ability to download a dataset in a zipped format. We've been transitioning old code to use web2py, and while I've been able to serve files using web2py elsewhere (images, for instance), I can't quite figure out how to serve this particular file.

Re: [web2py] Re: serving a zip file

2011-10-13 Thread Matt Broadstone
On Thu, Oct 13, 2011 at 11:34 AM, pbreit pbreitenb...@gmail.com wrote: My first suggestion would be to save the files to disk and serve statically if possible. I would prefer not to touch the disk if possible, these are not huge files just logs. I think I'm very close, when I serve this without

[web2py] serving binary data

2011-10-11 Thread Matt Broadstone
Greetings, I am trying to serve binary image data from one of my controllers. The data comes in via xmlrpc, and as such I have access to an xmlrpc Binary object of the image data. I've written a controller that tries to emulate what response.download does, but it doesn't seem to work. Can

[web2py] Re: serving binary data

2011-10-11 Thread Matt Broadstone
Whoops, I just needed to refer to the direct binary data, it was passing an object in. On Tue, Oct 11, 2011 at 12:11 PM, Matt Broadstone mbroa...@gmail.com wrote: Greetings,   I am trying to serve binary image data from one of my controllers. The data comes in via xmlrpc, and as such I have

Re: [web2py] Re: checkbox input default value

2011-10-10 Thread Matt Broadstone
I'm using the Field in a rather unconventional way - I just have a number of Field objects in a class that I refer to as my model (its not actually connected to any database), and I use the SQLFORM.factory to generate the form. The actual Field entry in the form looks like this: AutoStart =

[web2py] More robust SELECT helper

2011-10-04 Thread Matt Broadstone
Is it possible to pass in a dictionary to the SELECT helper, so that I can maintain a difference between representation and value of entries in a select element? I've tried to invoke this a few ways, but it seems its not built-in. Unfortunately, I'm not familiar enough with gluon to supply a patch

[web2py] composite views

2011-10-03 Thread Matt Broadstone
Good morning, I have a situation where I want to display composite views (a view for an object inside a view for its parent object). I have a class Connection that has a Profile associated with it. Profile can be one of a number of different subclasses (AProfile, BProfile, CProfile). I also

Re: [web2py] composite views

2011-10-03 Thread Matt Broadstone
, 2011 at 10:16 AM, Matt Broadstone mbroa...@gmail.com wrote: Good morning,   I have a situation where I want to display composite views (a view for an object inside a view for its parent object). I have a class Connection that has a Profile associated with it. Profile can be one of a number

Re: [web2py] composite views

2011-10-03 Thread Matt Broadstone
On Mon, Oct 3, 2011 at 10:49 AM, Matt Broadstone mbroa...@gmail.com wrote: On Mon, Oct 3, 2011 at 10:11 AM, Bruno Rocha rochacbr...@gmail.com wrote: You can always set if x: response.view = 'folder/file.html' elif y: response.view = '' Also, you can use: def action:      return

[web2py] field.represent value

2011-09-27 Thread Matt Broadstone
Hello, Is there a way to specify a value for the representation of a Field object? I have a class (lets call it A) with a Field object member variable (lets call it B), in my view I call {{=A.B.represent}} in order to display the default widget for this field. I would like to fill that widget

Re: [web2py] Re: field.represent value

2011-09-27 Thread Matt Broadstone
On Tue, Sep 27, 2011 at 11:41 AM, Anthony abasta...@gmail.com wrote: Do you need the field's widget or it's represent (they're two different things)? Note, the represent attribute is a function/callable (usually a lambda) that takes a value (and optionally a record), so if you want to use it

Re: [web2py] Re: field.represent value

2011-09-27 Thread Matt Broadstone
On Tue, Sep 27, 2011 at 11:49 AM, Anthony abasta...@gmail.com wrote: In Field(), represent defaults to None -- you have to specify a represent function of your own. Anthony Ah, I see. Is there a way to leverage the representations defined in SQLFORM.factory for this? SQLFORM.factory worked to

Re: [web2py] Re: field.represent value

2011-09-27 Thread Matt Broadstone
On Tue, Sep 27, 2011 at 12:32 PM, Anthony abasta...@gmail.com wrote: You can use SQLFORM.factory and still have complete control over the form layout/appearance -- see http://web2py.com/book/default/chapter/07#Custom-forms. But if you want to access any of the SQLFORM widgets independently,

Re: [web2py] Re: xmlrpc backend

2011-09-26 Thread Matt Broadstone
I think I will end up just writing my own model for this (a la Anthony's suggestion), but the problem remains that model as it relates to web2py presumes SQL, and that fact limits design. While it would be possible to write an XMLRPC adapter to the DAL, that is sort of like jamming a square piece