[web2py] Re: Unions and select from tables

2012-07-21 Thread Cliff Kachinske
I didn't ask the question correctly. In raw sql it would be something like SELECT name FROM table, CONCAT (first_name, last_name) FROM othertable AS name WHERE blah ... Is it possible to do that without using raw sql? On Saturday, July 21, 2012 9:54:09 PM UTC-4, Massimo Di Pierro wrote: > > Yo

Re: [web2py] Re: DAL select queries abstraction is getting fiddly... your advice?

2012-07-21 Thread Alec Taylor
On Sun, Jul 22, 2012 at 8:53 AM, Cliff Kachinske wrote: > What are you trying to do? When you view the group URL [http://localhost/group/d/mygroupnamehere] you should be shown a hyperlinked list of events associated with that group. Clicking on an event should show you the view for that event, o

[web2py] Re: Unions and select from tables

2012-07-21 Thread Massimo Di Pierro
You do not have to. The line: y.colnames=x.colnames does it for you, as long as the list of fields maps 1 to 1. On Saturday, 21 July 2012 20:10:09 UTC-5, Cliff Kachinske wrote: > > This is great. > > I've not tried it yet, but I'm assuming I can alias the field names if the > tables have differ

Re: [web2py] Re: problem with left join and SQlFORM.grid

2012-07-21 Thread Massimo Di Pierro
Source version of windows binary version? (the latter is not supposed to work yet) On Saturday, 21 July 2012 16:43:22 UTC-5, david.waldrop wrote: > > Massimo, I tried to install nightly build, but have encountered an > error. I get a message when i run web2py that zipimport.zipimorterror: > c

[web2py] Re: Unions and select from tables

2012-07-21 Thread Cliff Kachinske
This is great. I've not tried it yet, but I'm assuming I can alias the field names if the tables have different field names with the same data type. Is it possible to combine two field names into a single alias? Thanks On Friday, July 20, 2012 5:35:37 PM UTC-4, Massimo Di Pierro wrote: > > You

Re: [web2py] Re: after login redirect

2012-07-21 Thread Mathias Van Daele
Hi Anthony, Thanks for your solution ! Works perfect ! I have implemented it like this : def redirect_after_login(form): if auth.has_membership(user_id=auth.user.id,role='Straathoekwerkers'): redirect(URL(r=request,f='mycla')) elif auth.has_memb

[web2py] Re: DAL select queries abstraction is getting fiddly... your advice?

2012-07-21 Thread Cliff Kachinske
What are you trying to do? On Saturday, July 21, 2012 1:34:01 PM UTC-4, Alec Taylor wrote: > > Alright, I think I've made a pretty tiny test-case. > > So basically I want to grab the group and all its events on request. > > So I give the request check on `group_name`, followed by an outer left

Re: [web2py] Re: problem with left join and SQlFORM.grid

2012-07-21 Thread david waldrop
Massimo, I tried to install nightly build, but have encountered an error. I get a message when i run web2py that zipimport.zipimorterror: can't find module 'gluon' i am running on win7 today this is my 1st time getting the nightly build. i simply copied the structre over the top of my exist

Re: [web2py] uWSGI and routes.py

2012-07-21 Thread Jonathan Lundell
On 21 Jul 2012, at 1:38 PM, Neil wrote: > I can confirm that I can't reproduce the behaviour using the same web2py code > locally with Rocket on windows. Also, I tried adding: > > logging = 'debug' > > and > > default_ logging = 'debug' > > to routes.py, and I couldn't get any logged info

Re: [web2py] uWSGI and routes.py

2012-07-21 Thread Jonathan Lundell
On 21 Jul 2012, at 1:38 PM, Neil wrote: > I can confirm that I can't reproduce the behaviour using the same web2py code > locally with Rocket on windows. Also, I tried adding: > > logging = 'debug' > > and > > default_ logging = 'debug' > > to routes.py, and I couldn't get any logged info

Re: [web2py] uWSGI and routes.py

2012-07-21 Thread Neil
I can confirm that I can't reproduce the behaviour using the same web2py code locally with Rocket on windows. Also, I tried adding: logging = 'debug' and default_ logging = 'debug' to routes.py, and I couldn't get any logged info (on either platform). Neil On Saturday, July 21, 2012 7:0

[web2py] Re: after login redirect

2012-07-21 Thread Anthony
One option might be to set an auth.settings.login_onaccept callback and do the redirect in the callback. Anthony On Saturday, July 21, 2012 3:57:27 PM UTC-4, Mathias wrote: > > Hi, > > Depending on the role of the logged in user, the next URL should be > different. > > This is what I did : > >

[web2py] after login redirect

2012-07-21 Thread Mathias
Hi, Depending on the role of the logged in user, the next URL should be different. This is what I did : if auth.has_membership(user_id='6',role='Straathoekwerkers'): auth.settings.login_next=URL('mycla') This works as long as I pass a user id, like I did in this piece of code. I am looking fo

Re: [web2py] Re: problem with left join and SQlFORM.grid

2012-07-21 Thread david waldrop
will do. and report back promptly Massimo Di Pierro Saturday, July 21, 2012 2:17 PM You are using web2py stable. groupby is only in trunk. In 5 minutes, try the nightly build. On Saturday, 21 July 2012 12:35:55 UTC-5, david.waldrop wrote: -- david.wald

Re: [web2py] DAL/Postgres not creating a table

2012-07-21 Thread Massimo Di Pierro
I think it is, but it is in the last section of chapter 6. On Saturday, 21 July 2012 13:04:15 UTC-5, Marek Mollin wrote: > > Again web2py-users doesnt disappoint. > I forgot that opposed to sqlite postgres has strong typing of fields so > you have to have existing tables for fk. > (I thought that

[web2py] Re: problem with left join and SQlFORM.grid

2012-07-21 Thread Massimo Di Pierro
You are using web2py stable. groupby is only in trunk. In 5 minutes, try the nightly build. On Saturday, 21 July 2012 12:35:55 UTC-5, david.waldrop wrote: > > Massimo, it does not accept the groupby in theSQLFORM.grid. > > 1 > > 2 > 3. > 4. > 5. > 6. > 7. > 8. > > Traceback (most recent call la

Re: [web2py] uWSGI and routes.py

2012-07-21 Thread Jonathan Lundell
On 21 Jul 2012, at 10:47 AM, Jonathan Lundell wrote: > > On 21 Jul 2012, at 7:42 AM, Massimo Di Pierro wrote: >> Is this reproducible? Can you check if you get the same problem with stable? > > Please try enabling router logging. In routes.py, there is (or should be) a > line like this: > > lo

Re: [web2py] DAL/Postgres not creating a table

2012-07-21 Thread Marek Mollin
Again web2py-users doesnt disappoint. I forgot that opposed to sqlite postgres has strong typing of fields so you have to have existing tables for fk. (I thought that 'reference table' instead of db.table - overrides that, at the app level it does at least) I think this should perhaps go to book

Re: [web2py] uWSGI and routes.py

2012-07-21 Thread Jonathan Lundell
On 21 Jul 2012, at 7:42 AM, Massimo Di Pierro wrote: > Is this reproducible? Can you check if you get the same problem with stable? Please try enabling router logging. In routes.py, there is (or should be) a line like this: logging = 'debug' Try setting it to 'info', which is IIRC the default

Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Neil
Sure, I'll create a script once I have a more confidence that everything is working. I still don't completely understand some of the settings I've found to work, so I'm a little hesitant... On Saturday, July 21, 2012 3:08:52 PM UTC+1, Massimo Di Pierro wrote: > > Neil, do you think it is work in

[web2py] Re: problem with left join and SQlFORM.grid

2012-07-21 Thread david.waldrop
Massimo, it does not accept the groupby in theSQLFORM.grid. 1 2 3. 4. 5. 6. 7. 8. Traceback (most recent call last): File "gluon/restricted.py", line 205, in restricted File "C:/Users/david/My Projects/Miscelaneous/web2py/applications/COPSIS2_1/controllers/org.py"

[web2py] DAL select queries abstraction is getting fiddly... your advice?

2012-07-21 Thread Alec Taylor
Alright, I think I've made a pretty tiny test-case. So basically I want to grab the group and all its events on request. So I give the request check on `group_name`, followed by an outer left join using the `group_id` from the `event` table on the `group_of_events`: group = db(db.group_of_events

[web2py] Re: problem with left join and SQlFORM.grid

2012-07-21 Thread Massimo Di Pierro
My bad. Try this: count = db.auth_user.id.count() # bad hack count._tablename = 'auth_user' count.readable = True count.represent = None count.formatter = lambda value:value # end bad hack results= SQLFORM.grid(db.org, fields=[db.org.name, db.org.jurisdiction, d

[web2py] pycharm not doing bad at all

2012-07-21 Thread Massimo Di Pierro
In case you did not notice. web2py support is the most requested feature for pycharm http://youtrack.jetbrains.com/issues/PY?q=sort+by%3A+votes --

[web2py] Selective removing sessions

2012-07-21 Thread JaapP
Hi All, i would like to remove sessions for some selected users. I can't find a way to relate a session to a user, is there a way to do this? I already store the sessions in the database, so removing all sessions is easy: @auth.requires_membership('Administrators') def invalidate_sessions():

[web2py] Re: problem with left join and SQlFORM.grid

2012-07-21 Thread david.waldrop
Massimo, thanks, this made progress in that it now does't emit and error, but only shows one row (instead of the 18 records in the table) and the a count for the single row of 39 (which is the total # users in the system). What I need is 18 rows, one for each org, and the # of users for each or

[web2py] Re: problem with left join and SQlFORM.grid

2012-07-21 Thread Massimo Di Pierro
This syntax is not allowed: left=db.org.on(db.auth_user.org_ref==db.org.id).count() Try this instead: count = db.auth_user.org_ref.count() # bad hack count._tablename = 'auth_user' count.readable = True count.represent = None count.formatter = lambda value:value # end bad hack results=

[web2py] problem with left join and SQlFORM.grid

2012-07-21 Thread david.waldrop
I am trying to show the records in a table AND the count of referenced items in a child table using SQLFORM.grid but am not able to get the left join to work. Here is what I have been trying for the past 2+ hours with no success results= SQLFORM.grid(db.org, field

Re: [web2py] DAL/Postgres not creating a table

2012-07-21 Thread Ovidio Marinho
What is your OS? What is your version web2py? If windows is this the start or web2py.exe web2py.py? the drive is installed psycopg2? Have you ever tried to postgres 8.4, makes this test. Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ov

[web2py] Re: Builtin Editor not working in latest Trunk

2012-07-21 Thread JohnB
Thanks, that did the trick. --

[web2py] Re: uWSGI and routes.py

2012-07-21 Thread Neil
Just checked, and I don't have this problem with stable. After a bit more testing, it appears that routes turns on and off sporadically. For example, if I set the default application to "examples", and hit refresh on the root domain 10 times, sometimes the welcome application loads and sometimes

Re: [web2py] Re: uWSGI and routes.py

2012-07-21 Thread Jonathan Lundell
On 21 Jul 2012, at 7:42 AM, Massimo Di Pierro wrote: > Is this reproducible? Can you check if you get the same problem with stable? Maybe something to do with the recent standalone-DAL patch? > > I do not think this is a uWSGI issue. Please open an issue on google code. > > On Saturday, 21 Ju

[web2py] Re: uWSGI and routes.py

2012-07-21 Thread Massimo Di Pierro
Is this reproducible? Can you check if you get the same problem with stable? I do not think this is a uWSGI issue. Please open an issue on google code. On Saturday, 21 July 2012 09:28:43 UTC-5, Neil wrote: > > Trunk. routes seems to work for a minute or two, and then stops until I > click the

[web2py] OSx potsgresql app

2012-07-21 Thread Massimo Di Pierro
web2py_osx.app should perhaps include a link to this: http://postgresapp.com/ --

[web2py] Re: uWSGI and routes.py

2012-07-21 Thread Neil
Trunk. routes seems to work for a minute or two, and then stops until I click the reload button. Not sure if this is a uwsgi issue or not. On Saturday, July 21, 2012 3:11:29 PM UTC+1, Massimo Di Pierro wrote: > > Using stable or trunk? > > > On Saturday, 21 July 2012 07:06:02 UTC-5, Neil wrote: >

[web2py] Inconsistent behavior with SqlGrid and referenced tables

2012-07-21 Thread david.waldrop
I have a table defined as follows: db.define_table('org', Field('name'), Field('otype',db.orgtypes, label='Type'), Field('jurisdiction',db.jurisdictions), Field('created_by',db.auth_user,readable=True,writable=False), Field('created','datetime',

[web2py] Re: uWSGI and routes.py

2012-07-21 Thread Massimo Di Pierro
Using stable or trunk? On Saturday, 21 July 2012 07:06:02 UTC-5, Neil wrote: > > I'm going through this exact thing at the moment. I was wondering if it > was because I am testing out the dev version of web2py, but I guess not. If > I click the "reload routes" link on the main admin page it wor

[web2py] Re: Builtin Editor not working in latest Trunk

2012-07-21 Thread Niphlod
Also, try hitting ctrl+R (or ctrl+f5, etc etc etc) to reload all the static files in your browser. Some time ago with trunk I had the same issue and got it working simply refreshing the browser cache. On Saturday, July 21, 2012 11:24:57 AM UTC+2, Massimo Di Pierro wrote: > > Not quite. The ACE

Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Massimo Di Pierro
Neil, do you think it is work including a start-up script in web2py/scripts/? Would you submit one? On Saturday, 21 July 2012 05:25:18 UTC-5, Neil wrote: > > I came across that same error when I tried: > > uwsgi --protocol=http --socket 127.0.0.1:yourporthere --pythonpath > ~/web2py --module wsg

Re: [web2py] DAL/Postgres not creating a table

2012-07-21 Thread Niphlod
on sql.log in your databases folder there is the excerpt of the statements used to create the table. I'm guessing that you implemented your app adding here and there tables but never defining them "in order" . This seems the kind of problem when you try to create a table with foreign keys poin

Re: [web2py] DAL/Postgres not creating a table

2012-07-21 Thread Massimo Di Pierro
You have some of type "reference deliverytype" and table "deliverytype" is not defined. There could be an order issue in the table and postgres cannot alter a table and add or modify a field which is a reference to a table not defined yet. On Saturday, 21 July 2012 04:55:10 UTC-5, Marek Mollin

[web2py] Re: uWSGI and routes.py

2012-07-21 Thread Neil
I'm going through this exact thing at the moment. I was wondering if it was because I am testing out the dev version of web2py, but I guess not. If I click the "reload routes" link on the main admin page it works. At least temporarily - I'm experiencing some strange behaviour. I know I have to

[web2py] uWSGI and routes.py

2012-07-21 Thread Alec Taylor
Does uWSGI work with routes.py? The section in chapter 1 of the "web2py Application Development Cookbook" didn't mentioned routes... But when I copied my routes.py over and started the uWSGI server, I became unable to get to any page apart from the `/admin/` ones. I couldn't even access the we

[web2py] Re: "admin disabled because unable to access password file"

2012-07-21 Thread Alec Taylor
Ah, got it to work. Forgot to run web2py directly initially over SSH with python2.7 ./web2py.py -p -a All working now :D On Sat, Jul 21, 2012 at 8:56 PM, Alec Taylor wrote: > Recently got my site hosted remotely (on WebFaction), but I'm getting this > error for some reason. > > After doing a

[web2py] "admin disabled because unable to access password file"

2012-07-21 Thread Alec Taylor
Recently got my site hosted remotely (on WebFaction), but I'm getting this error for some reason. After doing a git clone I ran uwsgi with: uwsgi --protocol=http --socket 127.0.0.1:ubersecretporthere --pythonpath ~/web2py --module wsgihandler -d ~/tmp/uwsgi.log -t 20 --async 24 --ugreen -r --no-or

Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Alec Taylor
WOOOT That worked, thanks a heap :D On Sat, Jul 21, 2012 at 8:25 PM, Neil wrote: > I came across that same error when I tried: > > uwsgi --protocol=http --socket 127.0.0.1:yourporthere --pythonpath > ~/web2py --module wsgihandler -d ~/tmp/uwsgi.log -t 20 --async 24 > --limit-as 64 -r --no-or

Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Neil
I came across that same error when I tried: uwsgi --protocol=http --socket 127.0.0.1:yourporthere --pythonpath ~/web2py --module wsgihandler -d ~/tmp/uwsgi.log -t 20 --async 24 --limit-as 64 -r --no-orphans -M -p 1 --touch-reload ~/tmp/uwsgireload.txt --reload-on-rss 50 (NOTE: ugreen not inc

Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Alec Taylor
When I currently visit the site it says: "uWSGI Error Python application not found" The logfile says: Python version: 2.7.3 (default, May 18 2012, 14:51:16) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] *** Python threads support is disabled. You can enable it with --enable-threads *** Python main in

Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Massimo Di Pierro
What is the main issue in your opinion? Did you try running a simple wsgi program without web2py? On Saturday, 21 July 2012 04:43:35 UTC-5, Alec Taylor wrote: > > I actually never got it to work on WebFaction... > > I might try every week or so and spend 30 minutes on it, but frankly I > don't

Re: [web2py] Re: On validation error, open URL?

2012-07-21 Thread Alec Taylor
Actually that's a much more efficient solution than mine, where I created a custom view just for that one form. :) Thanks once again On Sat, Jul 21, 2012 at 7:54 PM, Massimo Di Pierro wrote: > You have to move the form logic in its own action > > def myform(): >form = SQLFORM().proc

Re: [web2py] DAL/Postgres not creating a table

2012-07-21 Thread Marek Mollin
other info: I am using postgres 9.1 No migrate is not set to false. + it creates all other tables it just stops at certain point and skips a few of them. error stack: Traceback (most recent call last): File "G:\mac-backup\CLIENTS 2\paczkon\web2py\gluon\restricted.py", line 205, in restricted

Re: [web2py] Re: On validation error, open URL?

2012-07-21 Thread Massimo Di Pierro
You have to move the form logic in its own action def myform(): form = SQLFORM().process() if form.accepted: form = 'Done!' return form Then do Create new group × {{=LO

Re: [web2py] Re: On validation error, open URL?

2012-07-21 Thread Alec Taylor
Perfect Massimo, thanks (I got it to work; just had to read the book chapter) On Sat, Jul 21, 2012 at 7:41 PM, Alec Taylor wrote: > That sounds good, but I'm having trouble coding it up: > > data-target="#create-group"> > Create new group > > > > data-target

Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Alec Taylor
I actually never got it to work on WebFaction... I might try every week or so and spend 30 minutes on it, but frankly I don't have the time. Also, heroku and openshift are giving me issues with web2py, but it's something before I throw web2py on it, which is why I haven't posted on this mailing-l

Re: [web2py] Re: On validation error, open URL?

2012-07-21 Thread Alec Taylor
That sounds good, but I'm having trouble coding it up: Create new group × {{=LOAD(create, ajax=True)}} `create` is the form... how am I meant to do this? Thanks for all suggestions, Alec Tay

[web2py] Re: On validation error, open URL?

2012-07-21 Thread Massimo Di Pierro
Have you considered using LOAD(...,ajax=True) to load the form into the `#sesame` div? It will make your life much easier. On Saturday, 21 July 2012 02:02:21 UTC-5, Alec Taylor wrote: > > I've made a nice form effect using Twitter Bootstrap, where you click > the "Add new group" button, and it

[web2py] Re: Builtin Editor not working in latest Trunk

2012-07-21 Thread Massimo Di Pierro
Not quite. The ACE editor is supposed to be working. It works for me. Ctrl+S also works. The discussion you quote below is about ZenCoding plugin. ACE does not have it. If ACE (the default editor) does not work for you please submit a bug report. Which browser? Which web2py distribution? What

Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Neil
Figured it out: I removed the "--limit-as 64" argument and now it seems to work. I'm using uwsgi version 1.2.4. Could this cause any problems? Now, if I can get my static content served directly, I'm ready to roll with Webfaction. Previously, when using nginx+uwsgi, it was using 1-10MB of memor

Re: [web2py] Re: Minimum memory requirements?

2012-07-21 Thread Neil
I'm following these instructions, and get stuck at the same point: initializing 24 uGreen threads with stack size of 262144 (256 KB) mprotect(): Invalid argument [plugins/ugreen/ugreen.c line 109] How did you fix this? On Thursday, July 5, 2012 4:17:48 PM UTC+1, Alec Taylor wrote: > > Alright

[web2py] On validation error, open URL?

2012-07-21 Thread Alec Taylor
I've made a nice form effect using Twitter Bootstrap, where you click the "Add new group" button, and it bring up a form. Example: http://jsfiddle.net/sRUbd/ Unfortunately when there is a form error, the form area collapses, so I never see the error (unless I click "Add new group" again). Can I