[web2py] Re: math Division in web2py

2012-02-21 Thread Brian Will
This is actually just a Python quirk: In Python 2.x, the / operator always returns an integer when both operands are integers, e.g. (5 / 2) returns 2, not 2.5. The solution is to simply make one or both operands a float: percent = float(x) / y * 100 # x/y as a percentage If you want your perc

[web2py] cached values from background tasks

2012-02-21 Thread Brian Will
In parts of my app, some needed values take a long time to generate, so I'm farming the generation of these values out to Scheduled tasks and designing with the expectation that some values just won't be ready to include in a page. When ready, the generated values are then incorporated into the pag

[web2py] Re: the Set class should be deprecated

2011-12-16 Thread Brian Will
Last argument, I promise. Here's my version of your summary: 1. We have a connection object that represents a database. 2. From the Fields associated with this connection, Queries are produced with Field's overloaded operators. Queries can also be produced from combination of other Queries with

[web2py] Re: the Set class should be deprecated

2011-12-16 Thread Brian Will
Apologies for dragging this out. I don't mean to be combative, but... @pbreit It's weird if you're told OR if you think about it (especially if you aren't already very fluent in Python). If no one tells you, and if you don't think about it, it's probably fine. Also, the query already encapsulates

[web2py] Re: the Set class should be deprecated

2011-12-16 Thread Brian Will
@pbreit > Can't you just explain to people that this is how you query the db: > >       rows = db(db.item.id==1).select() > > How much is gained by dropping the "db"? Programming is all about taking comprehensible pieces and piecing them together for your own purposes. A rote formula of syntax tha

[web2py] Re: the Set class should be deprecated

2011-12-15 Thread Brian Will
es that confusion would pay dividends for learners. I'm creating web2py learning material now, and DAL basics are consistently the biggest challenge. At the very least, the docs should be updated to point out that Set is a legacy design mistake. As it is, learners will confuse themselves trying to justify its existence.

[web2py] Re: the Set class should be deprecated

2011-12-15 Thread Brian Will
@Massimo So I'm not crazy, at least. Perhaps you can just add the Query and Table methods, leaving Set "deprecated" but never removed. Isn't this the current policy anyway? New learners would have a more sensical API while existing users could stick with what they know. Learnability is one of web2p

[web2py] the Set class should be deprecated

2011-12-14 Thread Brian Will
The problem is that Set is superfluous, oddly named, and thereby makes the whole DAL confusing to learners. I experienced this confusion myself when learning web2py, and now I find it's a problem when teaching web2py to others. A Query is not, as some web2py docs claim, just a WHERE clause. It sup

[web2py] setting default values in dropdown and optimal method to select db with variables

2011-10-02 Thread Will
Here is my goal. I have multiple drop down forms populated with the unique values available per field. I want to add a default ALL value to them. I then want to be able to take those values from the form and do a selection based off those variables. I can't seem to be able to select all values p

[web2py] Re: Select values from form and perform db search and display values on different page

2011-09-28 Thread Will
color})) def index(): var = request.vars.bla return dict(message=T('Hello World'),var = var) On Sep 28, 10:13 am, Anthony wrote: > The way you're doing it, when you get to the index() function, 'blah' will > be in request.vars.blah, not in session.vars (you never sa

[web2py] Re: Select values from form and perform db search and display values on different page

2011-09-28 Thread Will
. On Sep 28, 8:47 am, Anthony wrote: > On Wednesday, September 28, 2011 8:16:18 AM UTC-4, Will wrote: > > >     for row in ra: > >         SA.add(row.color) > >     ##ra = db().select(db.aa.color, distinct=True) > > >     ##form = SQLFORM.factory(SQLField(&#x

[web2py] Select values from form and perform db search and display values on different page

2011-09-28 Thread Will
I have a 2 part question I am rather new to web2py, I am trying to merely generate several drop down forms of the unique values for a field. I have accomplished this but feel there is a better way to do so, if you see a better way feel free to comment. Second I want to take these values and perfo

[web2py] Re: Introducing Grafpad!

2011-07-28 Thread Will
This is SO COOL :) By the way, if you go to grafpad.com, then click on your logo , you get an error: "Server Error! Sorry, there was an error with our server. Please continue to our homepage. "( homepage is a link) and clicking the link gets you to a 404 error ( that you drew with grafpag i guess

[web2py] Re: The web2py grid/crud plugin you've always dreamed about!

2011-07-25 Thread Will
does it or how does it support record representation for linked tables ? The record has a 'product' field linked to a 'db.product' with an id. and name field, and the name appeared in PowerTable with the following code in db.py . The representation that worked fine in PowerTables is only displayin

[web2py] Re: Web2py Powertables plugin : in-line editing problem.

2011-07-22 Thread Will
I just saw your new pre-alpha plugin PowerGrid and maybe an editing button in a separate column like it has would be better, especially if an onvalidation=... validator can be applied to the generated form in the popup. Does PowerTable has the same function included or is in-line editing the only '

[web2py] Re: Web2py Powertables plugin : in-line editing problem.

2011-07-20 Thread Will
On Jul 20, 7:21 am, Bruno Rocha wrote: > try: > > def editablefunction(): >    id = request.vars.row_id >    column = request.vars.column >    db(db.order_lines.id==id).update(column=value) >   * db.commit()* Didn't work. More info: There is a very quick 'Saving' appearing in the edited box right

[web2py] Web2py Powertables plugin : in-line editing problem.

2011-07-19 Thread Will
Hello, i'm currently tryin to make the Powertable plugin's in-line editing part work and after many tries i'm currently using Bruno Rocha's suggestion in another topic: Default.py= def editablefunction(): id = request.vars.row_id column = request.vars.column db(db.order_lines.id==id).

[web2py] In-line powertable editing help (or in-line editor plugin suggestion?)

2011-07-19 Thread Will
Hello, i'm trying to make powertable's in-line editing work but it doesn't seem to be working.(it's the powertable plug-in for Web2py) I've been looking for answers and i'm currently using the code Bruno Rocha suggested in another topic: in Default.py: def editablefunction(): id = request.vars

[web2py] cache block of content in template rather than codebehind

2011-05-25 Thread Brian Will
I'd like to use cache.ram with some chunks of content in my templates, and I'd rather not have to translate the chunks into the helper equivalents, e.g. to DIV(). Is there something like {{cacheblock}}stuff{{end}}? Should there be?

[web2py] Re: Require login for whole application

2011-04-21 Thread Will Stevens
for the record. i had to change this a bit to get it to work. i was getting 'too many redirects' when i used this, so i changed it to this: (so it did not try to redirect when db.py was processing the 'login' request) if auth.user is None and 'login' not in request.args: redirect(URL('default'

[web2py] Re: form.errors problem when adding inputs to updating SQLFORM

2011-04-14 Thread Brian Will
Done. Thanks Massimo, and for all your hard work. On Apr 14, 7:29 am, Massimo Di Pierro wrote: > Please open an issue in google code and I will fix this asap. > > On Apr 14, 8:56 am, Brian Will wrote: > > > > > > > > > No, form.vars and request.vars bo

[web2py] Re: form.errors problem when adding inputs to updating SQLFORM

2011-04-14 Thread Brian Will
rors.terms = 'You must agree to the terms.' > > must be > > def validateTerms(form): >             if request.vars.terms != 'agree': >                 form.errors.terms = 'You must agree to the terms.' > > as the request.vars has not yet been co

[web2py] form.errors problem when adding inputs to updating SQLFORM

2011-04-14 Thread Brian Will
I'm trying to add a checkbox that must be ticked to an update SQLFORM, but I'm getting an internal error. Here's the create form that works fine with an added checkbox: form = SQLFORM(db.job_post, submit_button='Post Job', formstyle='table2cols', fields=['poster_name', 'poster_email'

[web2py] Multi-Tenant Web2py

2011-04-11 Thread Will Stevens
Has anyone successfully implemented a multi-tentant application in web2py? If so, can you give me any pointers? I have considered using the GAE namespace stuff to add multi-tentant functionality, but I do not like that I am then making GAE a requirement for my application. I would prefer to add

[web2py] Re: 'check exists' option for reseting password

2011-04-11 Thread Brian Will
That seems to do it. On Apr 11, 1:42 am, Brian Will wrote: > I'd rather my password reset form not check the db for the existence > of the email and just blindly give an 'an email has been sent' message > regardless of what email address is entered. > > In Auth.

[web2py] 'check exists' option for reseting password

2011-04-11 Thread Brian Will
I'd rather my password reset form not check the db for the existence of the email and just blindly give an 'an email has been sent' message regardless of what email address is entered. In Auth.request_reset_password(), this should require simply making the second validator conditional upon an opti

[web2py] Re: proposal - extend auth_membership with

2011-04-08 Thread Will Stevens
Has anything become of this? I am also looking for this functionality. Has any work been done on this? Thanks, Will

[web2py] Re: passing data as post params rather than URL vars/args

2011-04-05 Thread Brian Will
our data available even after a > redirect. POST won't have that, so you should either store it on the > session, with cookies or with the database. If it's just temporary I > would suggest using session variables. > > Regards, > Arbie > > On Apr 5, 3:38 pm, Bria

[web2py] Re: passing data as post params rather than URL vars/args

2011-04-05 Thread Brian Will
odd. So I guess my question is: I want some way to redirect to another action in the app and pass it data, but I don't want to pass it as URL vars/args. On Apr 5, 12:38 am, Brian Will wrote: > I assumed there would simply be a Storage in the response object I > could just stuff thing

[web2py] passing data as post params rather than URL vars/args

2011-04-05 Thread Brian Will
I assumed there would simply be a Storage in the response object I could just stuff things into, but it seems not. So my question is what's the easiest way to append POST data to a response (for both cases: a redirect and a non-redirect)? Maybe I'm going about this the wrong way. I have a simple '

[web2py] Bug in openid_auth.py

2011-04-04 Thread Will Stevens
I am not sure where I should be putting bug reports, so please let me know. There is a bug in 'gluon/contrib/login_methods/openid_auth.py'. On line 244: - self.db.alt_logins.insert(username=oid, user=user) + self.db.alt_logins.insert(username=oid, user=user.id) # there is a DB error when trying t

[web2py] 1.94.6 site-packages

2011-04-04 Thread Will Stevens
I just wanted to point out that the 'site-packages' directory is missing in the source download of the 1.94.6 version. I added the directory in my project and added back in my libs and everything is working. It just looks like the empty directory was left out in this last version. Cheers...

[web2py] Re: Error in local_import()

2011-03-30 Thread Will Stevens
Try putting your module in 'web2py/site-packages' and reference it with a normal import and see if that works. If it does, good, but it wont help us understand the problem. If it doesn't, it may give you some more insight into why your module is not importing using local_import(). On Mar 30, 1:1

[web2py] Re: OpenID on GAE

2011-03-30 Thread Will Stevens
It is worth noting that you will need to get the python-openid package from (http://pypi.python.org/pypi/python-openid/) and add the 'openid' folder to the folder 'web2py/site-packages' in your project so it can be referenced by 'openid_auth.py' On Mar 30, 1:03 pm

[web2py] Re: Auth with OpenId

2011-03-30 Thread Will Stevens
/web2py/browse_thread/thread/4a8efd13814358b9 Hope this helps... On Feb 24, 11:10 pm, KMax wrote: > I thinks openid feature will be very usefull. > I'l happy to help you with it. > > On 19 фев, 17:03, drebbin wrote: > > > > > > > > > At first I st

[web2py] Re: OpenID on GAE

2011-03-30 Thread Will Stevens
the login page, you will have both forms. On the profile page, you can associate an openid with your account, after which you will be able to login using that openid. *** NOTE: *** I had to fix two bugs in 'gluon/contrib/login_methods/openid_auth.py' to get this working... glu

[web2py] Re: OpenID on GAE

2011-03-30 Thread Will Stevens
I have continued battling with this. Still no luck... Any input would be appreciated... ws On Mar 29, 4:07 pm, Will Stevens wrote: > I have continued testing and I have further confirmed that the only > time I am having the redirect issue of: > [DB] profiles.google.com/willi

[web2py] Re: OpenID on GAE

2011-03-29 Thread Will Stevens
t': '/cloudops/dashboard/user/profile' }> This is when the 'list_user_openids()' form is submitted... On Mar 29, 2:54 pm, Will Stevens wrote: > in the initial post, i change my app name to init and controller to > default cause that is what you would be expect

[web2py] Re: OpenID on GAE

2011-03-29 Thread Will Stevens
. On Mar 29, 2:47 pm, Will Stevens wrote: > I have continued debugging, so I figured I would add some more > details. > > In the controller here... > if 'janrain_nonce' in request.vars: >       auth.settings.login_form = openid_login_form >       return dict(form=aut

[web2py] Re: OpenID on GAE

2011-03-29 Thread Will Stevens
x27;: 'https://profiles.google.com/williamstevens', 'openid.mode': 'id_res', '_next': '/cloudops/dashboard/user/profile', 'openid.signed': 'op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle', 'openid.assoc_handl

[web2py] OpenID on GAE

2011-03-29 Thread Will Stevens
27;list openids' to the profile page. If the openid form is submitted it will be caught by the first if statement in the controller and get handled by auth. NOTE: On line 244 of gluon/contrib/login_methods/openid_auth.py there is bug that I had to fix in order for this to work. - self.db.alt_l

[web2py] Re: import csv not respecting unique?

2011-03-28 Thread Brian Will
Just tried it with Postgres and now import_from_csv_file() is throwing an exception with message "duplicate key value violates unique constraint "region_subdomain_key", so I guess this is a sqlite specific thing. On Mar 28, 5:33 pm, Brian Will wrote: > I should also make clea

[web2py] Re: import csv not respecting unique?

2011-03-28 Thread Brian Will
I should also make clear that I'm talking about db.export_to_csv_file() and db.import_from_csv_file() On Mar 28, 5:27 pm, Brian Will wrote: > I should add that I'm seeing this with SQLite. Haven't tried it with > Postgres yet. > > On Mar 28, 5:25 pm, Brian Will wrot

[web2py] Re: import csv not respecting unique?

2011-03-28 Thread Brian Will
I should add that I'm seeing this with SQLite. Haven't tried it with Postgres yet. On Mar 28, 5:25 pm, Brian Will wrote: > I have this table: > > db.define_table('region', >     Field('name'), >     Field('longname'), >     Field(&#

[web2py] import csv not respecting unique?

2011-03-28 Thread Brian Will
I have this table: db.define_table('region', Field('name'), Field('longname'), Field('subdomain', unique=True), Field('status_', 'reference region_status') ) The unique constraint is preventing me in the appadmin from adding regions with the same subdomain, as intended. However, i

[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread Brian Will
be deprecate 'value' in favor of 'prechecked' for this purpose to avoid the confusion. On Mar 27, 2:28 pm, Brian Will wrote: > Thanks, everyone. That's what I was looking for. > > On Mar 27, 9:50 am, villas wrote: > > > > > > > > > Thanks

[web2py] Re: add single pseudo-field to SQLFORM

2011-03-27 Thread Brian Will
> > > > > > Just add > > > form[0].insert(-2,TR(LABEL('I agree to > > terms'),INPUT(_name='agree',value=True,_type='checkbox'))) > > > after the form has been defined. > > On submission form.vars.agree will have the status

[web2py] add single pseudo-field to SQLFORM

2011-03-27 Thread Brian Will
I have an insert SQLFORM of 8 fields, to which I'd like to add a single "I agree to terms" checkbox at the bottom. There are probably tons of ways to do this, but I'm hoping someone has a really simple method that doesn't require resorting to a manual FORM? Can I simply tack on another INPUT to the

[web2py] Re: getting fields created by SQLFORM but which are not in the form

2011-03-26 Thread Brian Will
n=get_uuid): vars['poster_name'] = form.vars.poster_name vars['poster_email'] = form.vars.poster_email redirect(URL('post_email', vars=vars)) On Mar 26, 6:01 pm, Brian Will wrote: > Thanks, that's a start, but how now do I get 'uuid&

[web2py] Re: getting fields created by SQLFORM but which are not in the form

2011-03-26 Thread Brian Will
to compute, are fields set by default included while compute fields are not? I guess with no guarantee is made about the order in which compute functions are invoked, so we can't add the computed field to this dict and expect it to be seen by other compute fields, right? On Mar 26, 5:09 pm, Den

[web2py] getting fields created by SQLFORM but which are not in the form

2011-03-26 Thread Brian Will
When using SQLFORM, I'd like to get the default/computed values of fields not included in the form. Can I do this without making another query? Can I get, say, the autogen'd id of the new record? For example: form = SQLFORM(db.job_post, submit_button='Post Job', formstyle='table2cols', fie

[web2py] Re: plugins

2011-03-26 Thread Will Stevens
Alright, I will set something up for sharing code with you guys... Thanks... On Sat, Mar 26, 2011 at 1:35 PM, Arun K.Rajeevan wrote: > Yes and no. > You can post the code there, if that's fine. > > Yes, you can't upload a plugin as a zip, w2p or anything such. > It&#x

[web2py] Re: plugins

2011-03-25 Thread Will Stevens
>From what I can tell there is no way for me to upload the plugin there either. Am I just missing something? Will On Fri, Mar 25, 2011 at 4:11 PM, Arun K.Rajeevan wrote: > http://www.web2pyslices.com/main/default/index post it there. > for a plugin that's the better place. >

[web2py] Re: plugins

2011-03-25 Thread Will Stevens
I have a plugin that I wrote that I thought other people may appreciate. How do I make it accessible to people? When I go to http://www.web2py.com/appliances and login, I cannot find how I add my plugin. Thanks, Will

[web2py] Ubuntu 10.10 install fix

2011-03-08 Thread Brian Will
After running http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh on ubuntu 10.10 and setting up a postgres db for an app, I was getting "global name 'psycopg2' is not defined". Fixed it with: apt-get install python-psycopg2 sudo /etc/init.d/apache2 restart For 10.10, the line

[web2py] Re: unable to install application

2010-11-22 Thread Will Stevens
Sorry, I am an idiot. I thought that the plugin_wiki was an application on its own. I found the video and saw that the plugins are actually installed inside an application. Sorry to waste your time... Will On Nov 21, 9:13 pm, mdipierro wrote: > It is a plugin, not an application. Are

[web2py] Re: unable to install application

2010-11-21 Thread Will Stevens
Are there any suggestions to get this working? Thanks, Will On Nov 19, 4:10 pm, Will Stevens wrote: > not initially when I download and unzip the source code.  however as > soon as I run the command 'python web2py.py', the NEWINSTALL file goes > away and the folder web2

[web2py] Re: unable to install application

2010-11-19 Thread Will Stevens
t the file 'web2py.plugin.wiki.w2p.gz' with the application name of 'plugin_wiki'. at this point i get the error stating 'unable to install application "plugin_wiki"', but the 'plugin_wiki.tar' file gets added to the 'web2py/deposit' folder. does that help? tha

[web2py] Re: unable to install application

2010-11-19 Thread Will Stevens
webserver, so I was assuming it was using the built in web server (it still has a built in web server right?) Also worth noting... I am able to create applications from the admin interface, but I can't import existing ones. thanks, Will On Nov 19, 12:56 pm, mdipierro wrote: > Which

[web2py] unable to install application

2010-11-19 Thread Will Stevens
nding really old posts for the 'unable to install application' errors, so I am not sure what may be the issue now. Any ideas? I am working on a Mac with Snow Leopard. Let me know if I forgot information that you may need to help me. Thanks, Will