[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 oth

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 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 could do that,

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 wrote: > @request.restful() > def jsonlisttest(): > response.view = 'generic.json' > def GET(*args, **vars): > sample_raw_rpc_response = '["one", "two", "three"]' > sample_rpc_response = simplejson.loads(sample_raw_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:14 PM, Alan Etkin 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 >> list? >> > >

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 wrote: > > > On Tuesday, July 30, 2013 11:51:08 AM UTC-4, Jonathan Lundell wrote: > >> On 30 Jul 2013, at 8:34 AM, Anthony wrote: >> >> Can you show your code? You say you "return locals()", but locals() >> produces a dictionary, so it should ultimately exec

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

2013-04-03 Thread Matt Broadstone
onday, April 1, 2013 4:48:59 PM UTC+2, Matt wrote: >> >> On Fri, Mar 29, 2013 at 12:15 PM, Matt Broadstone >> wrote: >> > On Fri, Mar 29, 2013 at 12:05 PM, Niphlod wrote: >> >> uhm. Before smashing heads against the wall, there are 3 different >&g

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

2013-04-01 Thread Matt Broadstone
On Fri, Mar 29, 2013 at 12:15 PM, Matt Broadstone wrote: > On Fri, Mar 29, 2013 at 12:05 PM, Niphlod wrote: >> uhm. Before smashing heads against the wall, there are 3 different >> "available methods" here. >> >> 1) rely on nginx to authenticate use

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

2013-03-29 Thread Matt Broadstone
On Fri, Mar 29, 2013 at 12:05 PM, Niphlod 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 authenticate users t

[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 t

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

2013-03-29 Thread Matt Broadstone
-auth @include common-account On Fri, Mar 29, 2013 at 11:45 AM, Matt Broadstone wrote: > 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 wor

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

2012-08-15 Thread Matt Broadstone
On Wed, Aug 15, 2012 at 10:03 PM, Anthony 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 have to use

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 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 > access to group in

Re: [web2py] Re: basic authentication using pam

2011-12-14 Thread Matt Broadstone
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 wrote: >> On Mon, Nov 21, 2011 at 3:25 PM, Massimo Di >> Pierro wrote: >> > Good point. Basic auth may not work with PAM. Plea

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

2011-11-23 Thread Matt Broadstone
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 2

[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: 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 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 Tuesday, Novem

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 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 by default,

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 wrote: > On Tue, Nov 22, 2011 at 1:32 PM, Massimo Di Pierro > 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, fo

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 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 wrote: >>

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

2011-11-22 Thread Matt Broadstone
d)[0] > > settings["serverPassword"] = > db.auth_user.password.validate(str(uuid.uuid4()))[0] > > On Nov 22, 8:19 am, Matt Broadstone wrote: >> Hello, >> In our project we need to create a temporary user for the web2py app >> so that a remote syste

[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()) settings["serv

Re: [web2py] Re: basic authentication using pam

2011-11-21 Thread Matt Broadstone
s 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 wrote: >> Is it possible to use PAM for basic auth? I have basic a

[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: 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 12:48 PM, Massimo Di Pierro 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 wrote: >> On Fri, Oct 14, 2011 at 9:35 AM, peter wrote: >> > If I n

Re: [web2py] Re: serving a zip file

2011-10-14 Thread Matt Broadstone
On Fri, Oct 14, 2011 at 9:35 AM, peter 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 wrote: >> I sent from my wifes >> emailhttp://groups

Re: [web2py] Re: serving a zip file

2011-10-13 Thread Matt Broadstone
On Thu, Oct 13, 2011 at 11:34 AM, pbreit 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 the zipfile code (ju

[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. Bel

[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 s

[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 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 acc

[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 anyone

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 = Field('

[web2py] checkbox input default value

2011-10-10 Thread Matt Broadstone
Hello, I am using web2py Field's in order to build a form. It seems that all of the entries that I have in my model for "boolean" types, are rendered with a default 'value="on"' despite the field actually being checked or not. Is this a bug? Matt

[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 patc

Re: [web2py] composite views

2011-10-03 Thread Matt Broadstone
On Mon, Oct 3, 2011 at 10:49 AM, Matt Broadstone wrote: > On Mon, Oct 3, 2011 at 10:11 AM, Bruno Rocha wrote: >> You can always set >> if x: >> response.view = 'folder/file.html' >> elif y: >> response.view = '' >> Also, you can us

Re: [web2py] composite views

2011-10-03 Thread Matt Broadstone
ned "connection/edit.html" as expected. What am I doing wrong here? Matt > On Mon, Oct 3, 2011 at 10:16 AM, Matt Broadstone wrote: >> >> Good morning, >>   I have a situation where I want to display composite views (a view >> for an object inside a view for

[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 have

Re: [web2py] Re: field.represent value

2011-09-27 Thread Matt Broadstone
On Tue, Sep 27, 2011 at 12:32 PM, Anthony 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, they are > of the

Re: [web2py] Re: field.represent value

2011-09-27 Thread Matt Broadstone
On Tue, Sep 27, 2011 at 11:49 AM, Anthony 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 a certain degre

Re: [web2py] Re: field.represent value

2011-09-27 Thread Matt Broadstone
On Tue, Sep 27, 2011 at 11:41 AM, Anthony 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 directly, you hav

[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: 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