[web2py] Dependent drop downs

2010-05-27 Thread Neveen Adel
Hello, I have db.define_table('type', SQLField('name','string',length=2) SQLField('parent','reference db.type') ) db.define_table('member', SQLField('name','string'), SQLField('type',db.type), SQLField('subtype',db.ty

[web2py] Re: postgresql connection problem -

2010-05-27 Thread Graham Dumpleton
On May 27, 9:57 pm, Julius Minka wrote: > I found something in the archive. > This seems to be multiple python versions issue, but still do not have a > solution. Unfortunately, this server is preinstalled with python2.4 and > I am trying to use 2.6, which can't be probably found undermod_wsgi >

[web2py] Re: Group some fields into a

2010-05-27 Thread Candid
Use form.custom.widget. See http://web2py.com/book/default/section/7/7 for details. On May 27, 4:48 pm, Mathieu Clabaut wrote: > Hello > In my model, I've a table defined as > > STATUS_TYPE = ('identification','analyse') > > db.define_table('faq', >     Field('status', 'string', requires=[IS_IN_S

Re: [web2py] where is : scripts/web2py-wsgi.conf

2010-05-27 Thread Alexandre Andrade
using the script setup***ubuntu.sh will work fine. 2010/5/27 Jean Guy > Hi dear web2py crew, > > I was trying to deploy web2py in production with apache2 under ubuntu > server. I follow those informations in the web2py book : > http://web2py.com/book/default/section/11/2 > > I got : admin disa

[web2py] where is : scripts/web2py-wsgi.conf

2010-05-27 Thread Jean Guy
Hi dear web2py crew, I was trying to deploy web2py in production with apache2 under ubuntu server. I follow those informations in the web2py book : http://web2py.com/book/default/section/11/2 I got : admin disabled because unable to access password file What do I have to do... scripts/web2py-ws

[web2py] Re: Autoincrement field

2010-05-27 Thread mdipierro
What is wrong with the default id field that web2py creates for every table? On May 27, 3:16 pm, matclab wrote: > Hello, >  I'm finding this message in a thread from February... > >  I thought that autoincremented field would guaranty unicity in the > table. >  I'm afraid the provided solution wo

[web2py] Re: Delete record without triggering validators?

2010-05-27 Thread mdipierro
You are right. We can do this better but the only improvement would be speed. On May 27, 2:06 pm, Iceberg wrote: > > > > On May 11, 1:08 pm,Iceberg wrote: > > > > > > Hi Massimo, > > > > > > Right now validators are triggered even when a record is successfully > > > > > being deleted. This can be

[web2py] Re: uploads problem

2010-05-27 Thread mdipierro
folder has to exist. On May 27, 1:16 pm, annet wrote: > Massimo, > > > if field is the upload field you can set > > > db.table.field.uploadfolder = > > This is my image table: > > db.define_table('image', > > Field('company_id',db.company,default='',notnull=True,ondelete='CASCADE',writable=F

[web2py] Re: Question on authorisation and accessible_query capabilities ...

2010-05-27 Thread mdipierro
yes. On May 27, 12:54 pm, David Marko wrote: > Well, it was my fault as description I provided was misleading. I just > realised that permissions are being assigned to groups, so it means > that it is assigned not to user id directly  but to his group id? Do I > understand it correctly? > > So fo

[web2py] Re: Permissions and appadmin question

2010-05-27 Thread mdipierro
Now I understand. Add this at the end of your db.py db.auth_permission.table_name.requires = IS_IN_SET(db.tables) You can specify the list of tables you want to give permissions on. On May 27, 12:48 pm, David Marko wrote: > Yes, I just created a new app in web2py and added my model at the end >

Re: [web2py] Re: Hide tables to appadmin based on user permissions

2010-05-27 Thread Mathieu Clabaut
Oh... OK... I thought I've missed another great feature of web2py... :-) On Thu, May 27, 2010 at 21:48, Thadeus Burgess wrote: > Me and my displaced mind... =) > > I ment "all of my controller functions are decorated with..." > > > > -- > Thadeus > > > > > > On Thu, May 27, 2010 at 2:31 PM, Mathi

[web2py] Group some fields into a

2010-05-27 Thread Mathieu Clabaut
Hello In my model, I've a table defined as STATUS_TYPE = ('identification','analyse') db.define_table('faq', Field('status', 'string', requires=[IS_IN_SET(STATUS_TYPE, multiple=True), IS_NOT_EMPTY(), IS_ORDERED(STATUS_TYPE)], default=STATUS_TYPE[0], widget=SQLFORM.widg

[web2py] Re: Debian Packaging

2010-05-27 Thread Mark Breedveld
Well was affraid you would ask that. And there're two very good reasons why I should not be me. No expirence No time at all, full time student with three jobs to pay it. But since we have here at least three expirenced debian packagers. I'll guess we could arange something there. But before we

[web2py] Re: Autoincrement field

2010-05-27 Thread matclab
Hello, I'm finding this message in a thread from February... I thought that autoincremented field would guaranty unicity in the table. I'm afraid the provided solution would allow two record to have the same autonumber field (think about an access from two users at the same time). I guess the

Re: [web2py] Re: Hide tables to appadmin based on user permissions

2010-05-27 Thread Thadeus Burgess
Me and my displaced mind... =) I ment "all of my controller functions are decorated with..." -- Thadeus On Thu, May 27, 2010 at 2:31 PM, Mathieu Clabaut wrote: > Thank you for sharing ! > On Thu, May 27, 2010 at 19:16, Thadeus Burgess > wrote: >> >> This is what I settled with: > >   >  

Re: [web2py] Re: Hide tables to appadmin based on user permissions

2010-05-27 Thread Mathieu Clabaut
Thank you for sharing ! On Thu, May 27, 2010 at 19:16, Thadeus Burgess wrote: > This is what I settled with: So obviously if they are admin, it leaves it alone and they see all tables. > > Also all tables are decorated with @auth.reuquires_membership('Operations') > > What do you mean by "ta

[web2py] Re: Delete record without triggering validators?

2010-05-27 Thread Iceberg
> > > On May 11, 1:08 pm,Iceberg wrote: > > > > > Hi Massimo, > > > > > Right now validators are triggered even when a record is successfully > > > > being deleted. This can be annoying in case I am deleting old records > > > > as below: > > > > > db.define_table('my_table', > > > >     Field('toda

[web2py] Re: checkboxes and radio widget failed with multiple validators

2010-05-27 Thread Mathieu Clabaut
Patch : diff -r 9802a87428fa gluon/sqlhtml.py --- a/gluon/sqlhtml.py Wed May 26 17:17:46 2010 +0200 +++ b/gluon/sqlhtml.py Thu May 27 20:37:56 2010 +0200 @@ -223,10 +223,15 @@ attr = OptionsWidget._attributes(field, {}, **attributes) -if hasattr(field.requires, 'options'): -

[web2py] checkboxes and radio widget failed with multiple validators

2010-05-27 Thread Mathieu Clabaut
Reported as http://code.google.com/p/web2py/issues/detail?id=80 Hello, I've met a problem with checkboxes and rzdio widgets: The following works: Field('status', 'string', requires=IS_IN_SET(STATUS_TYPE, multiple=True), widget=SQLFORM.widgets.checkboxes.widget) However if I add another

[web2py] Re: uploads problem

2010-05-27 Thread annet
Massimo, > if field is the upload field you can set > > db.table.field.uploadfolder = This is my image table: db.define_table('image', Field('company_id',db.company,default='',notnull=True,ondelete='CASCADE',writable=False,readable=False), Field('image_filename',writable=False,readabl

[web2py] Re: flawed architecture creating race condition for database writes

2010-05-27 Thread Iceberg
The bullet-proof solution should be setting twin-field primary key in db level, I believe. Hope somebody can show us how to do that in web2py db.define_table(...), if not using db.executesql('set up the primary key blah blah'). On the other hand, in a non-db level, inside web2py, perhaps Massimo w

[web2py] Re: Question on authorisation and accessible_query capabilities ...

2010-05-27 Thread David Marko
Well, it was my fault as description I provided was misleading. I just realised that permissions are being assigned to groups, so it means that it is assigned not to user id directly but to his group id? Do I understand it correctly? So for example, when having two records in database, one have r

[web2py] Re: Permissions and appadmin question

2010-05-27 Thread David Marko
Yes, I just created a new app in web2py and added my model at the end of db.py . I can see my table in list of tables in database admin, I can even create new records. I cant see this table name in list of tables when adding the new auth_permission usin appadmin. Combo box with tables names contai

[web2py] Re: flawed architecture creating race condition for database writes

2010-05-27 Thread Carl
thanks Iceberg. your approach is pretty much what I have right now. I'm looking for a bullet-proof approach. otherwise I'm running code with "fingers crossed two users don't use the system at the same time" and I want to encourage usage :) C On May 27, 6:09 pm, Iceberg wrote: > On May27, 1

[web2py] Re: Debian Packaging

2010-05-27 Thread mdipierro
we can have more than one mantainer. On May 27, 9:37 am, Luke Faraone wrote: > Hi, > > On May 27, 7:38 am, Mark Breedveld wrote: > > > In order to set up a debian packaging proces we should have or do the > > following > > - The web2py community should have a maintainer (group) > >        - Whic

[web2py] Re: Permissions and appadmin question

2010-05-27 Thread mdipierro
Not sure about the problem. If you set crud.settings.auth=auth you have no permission on any table (via crud) unless you explicitely say so. But this does not affect appadmin. The problem may be where you define the table. Is that done in a model? Are you sure that is done after db.py? On May 27

[web2py] Re: Question on authorisation and accessible_query capabilities ...

2010-05-27 Thread mdipierro
If you really want to give a permission to every group user A is member of, you need to look over his/her membership and add the permission to that group. The problem is the opposite. If a user is no longer member of a group, what happens to the permissions of those objects? That is why people do

[web2py] Re: Debian Packaging

2010-05-27 Thread Luke Faraone
Hi, On May 27, 7:38 am, Mark Breedveld wrote: > In order to set up a debian packaging proces we should have or do the > following > - The web2py community should have a maintainer (group) >        - Which has manage the releases repo's >        - Ajust web2py for use through the repo >          

[web2py] Permissions and appadmin question

2010-05-27 Thread David Marko
Hello, Why I dont see my own tables in list if tables when creating permission entry in standard app admin interface? Only 'auth_XXX' tables are being listed here. Should I mark by tables somehow to be able to assign permissions for them using app admin? David

[web2py] Re: Hide tables to appadmin based on user permissions

2010-05-27 Thread Thadeus Burgess
This is what I settled with: if auth.is_logged_in() \ and auth.has_membership('Operations', auth.user.id) \ and not auth.has_membership('Admin', auth.user.id): opdb = DAL(dal_connection, folder=folder, pool_size=pool_size, check_reserved=check_reserved) for table in db.ta

[web2py] Re: flawed architecture creating race condition for database writes

2010-05-27 Thread Iceberg
On May27, 11:32pm, Carl wrote: > the flaw is in my architecture not web2py. can you help with a better > approach? Needs to be BigTable-friendly to boot. > > I have two user types: Agents and Candidates > Agents invite Candidates to Parties. > > I keep a Party table recording all such Party invite

[web2py] Hide tables to appadmin based on user permissions

2010-05-27 Thread Thadeus Burgess
I would like to hide all tables except the selected one from a user unless they have specific privileges. I am thinking maybe the following at the top of appadmin.py if auth.has_permission('Operations', auth.user.id): tables = [copy.copy(t) for t in db] db = DAL(db._connection) for t in

[web2py] flawed architecture creating race condition for database writes

2010-05-27 Thread Carl
the flaw is in my architecture not web2py. can you help with a better approach? Needs to be BigTable-friendly to boot. I have two user types: Agents and Candidates Agents invite Candidates to Parties. I keep a Party table recording all such Party invites. Candidates can be invited to the same Par

Re: [web2py] Moving apps outside /applications

2010-05-27 Thread Thadeus Burgess
Just another method. I symlink my projects folder into the applications so I have ~/Applications/web2py/ ~/Workspace/Web/Blogitizor/ Symlink. ~/Applications/web2py/applications/blogitizor -> ~/Workspace/Web/Blogitizor/ -- Thadeus On Thu, May 27, 2010 at 8:40 AM, Albert Abril wrote: > What

[web2py] Question on authorisation and accessible_query capabilities ...

2010-05-27 Thread David Marko
In my app I need to maintain information who can read each item in database and will use this criteria when fetching these items. Web2Py built-in system seems to be very, very usefull. But there is one thing that I dont know, how to resolve. The permissions to the items must allow setup readers(re

[web2py] Re: Running on windows server no more...

2010-05-27 Thread Andrew Buchan
Thanks, that worked. In the meantime I also managed to install web2py as a service, and setting the "options.py" to 0.0.0.0 and port 80 and it works fine. Note IIS is disabled too. Cheers for your help again.. On May 27, 2:31 pm, mdipierro wrote: > Honestly I have never seen anybody configure w

Re: [web2py] Moving apps outside /applications

2010-05-27 Thread Albert Abril
What I do is: · I have my ~/dev/mywebapp · I have my /var/www/site/web2py/applications/mywebapp · init a mercurial repositories in each one · Sync one with other with mercurial. With this, I have my code versioned.

[web2py] Re: left outer join problem on db2 (and MS SQL server)

2010-05-27 Thread mdipierro
got it. :-) On May 27, 8:15 am, Nico de Groot wrote: > Hi Massimo, > > Same problem exists in SQLserver (not surprising, uses the same code). > I think that arguably the best solution would be to change the current > JOIN X,Y ... WHERE [join condition] into X INNER JOIN Y ON [join > condition]. T

[web2py] Re: Moving apps outside /applications

2010-05-27 Thread mdipierro
Yes and no. You havea couple of options: 1) symlink web2py/applications and /home/mydir/projects 2) use /home/mydir/projects/applications/myweb2pyapp1 instead of / home/mydir/projects/myweb2pyapp1 and run web2py with web2py.py --folder /home/mydir/projects/ In case 2) web2py will run off

[web2py] Re: Running on windows server no more...

2010-05-27 Thread mdipierro
Honestly I have never seen anybody configure web2py with windows server and it may not be trivial (except in proxy mode) because it requires this: http://sourceforge.net/apps/trac/pyisapie My guess is that you do not have pyisapie and you are running both the built in web2py web server on 127.0.0

[web2py] Moving apps outside /applications

2010-05-27 Thread biesiad
Welcome, Is it possible to develop web2py application located in my usual project directory? eg. /home/mydir/projects/myweb2pyapp1 /home/mydir/projects/myweb2pyapp2

[web2py] Running on windows server no more...

2010-05-27 Thread Andrew Buchan
Hello, I had my web2py running happily on a windows 2003 server, or so I thought, and when I went to check it to install an application it seemed not to be running (no one's using it yet so can't tell when it stopped). I tried stopping and starting it from the GUI, and it comes up with "The page c

[web2py] Re: drop down values according to condition

2010-05-27 Thread Neveen Adel
Thanks a lot Candid , it works fine with me On May 27, 3:39 pm, Candid wrote: > db.ticket.type.requires = IS_IN_DB(db(db.type.deleted == False), > 'type.id', '%(name)s')) > > On May 27, 3:25 am, Neveen Adel wrote: > > > Hello, > > > i have table > > > db.define_table("type", > >       SQLField(

[web2py] Re: Planet web2py

2010-05-27 Thread mdipierro
Yes. The system allows this and I encourage it. Still, people should email and as to be listed. On May 27, 6:55 am, Álvaro Justen wrote: > On Thu, May 27, 2010 at 00:24, Alexandre Andrade > > wrote: > >>or, is > >>there any repository for web2py related application/plugins/slices?) > > > yes. Th

[web2py] Re: Debian Packaging

2010-05-27 Thread mdipierro
If I understand you refere to a "web2py-debian mantainer" not a mere "web2py mantainer" which I guess I am. If I understand I nominate you since you have spend some time on this. On May 27, 6:38 am, Mark Breedveld wrote: > My excuse for my late reaction, but you all landed up my spambox of my > p

[web2py] Re: left outer join problem on db2 (and MS SQL server)

2010-05-27 Thread Nico de Groot
Hi Massimo, Same problem exists in SQLserver (not surprising, uses the same code). I think that arguably the best solution would be to change the current JOIN X,Y ... WHERE [join condition] into X INNER JOIN Y ON [join condition]. That would be a bigger patch... For now I've used the patch by Ale

[web2py] Re: Delete record without triggering validators?

2010-05-27 Thread mdipierro
Posting a possible solution in trunk now. in gluon/sqlhtml.py replace if requested_delete: return True with if requested_delete: self.errors.clear() return True let me know if it works for you. On May 27, 6:0

[web2py] Re: uploads problem

2010-05-27 Thread mdipierro
if field is the upload field you can set db.table.field.uploadfolder = It can be anything. If you make this user dependent (is the uploadfolder depends on the logged_in user) you will run into one problem. User A uploads and image into pathA. If user B wants to download the image posted by u

[web2py] Re: A quick question for everyone - generating a random code 'onvalidation'

2010-05-27 Thread mdipierro
# use this to get the count cached def get_tbbooks_count(exp=3600): cache.ram('tbbooks',lambda: db(db.tbbooks.id == 1).count(),exp) # use this to create new tbbooks and update count def increment_tbbooks_count(form=None): cache.ram.increment('tbbooks') form = crud.create(db.tbbooks,on

[web2py] Re: Newbie question on self-submitting form

2010-05-27 Thread mdipierro
Do I understand correctly? When you submit a new db.whoelse. you want to be redirected to a page in the list that shows it. But messages are timestamped. When you submit a new now don't you get redirected to page 1 which shows the last message? Perhaps I do not understand what you mean. Massimo

[web2py] Re: drop down values according to condition

2010-05-27 Thread Candid
db.ticket.type.requires = IS_IN_DB(db(db.type.deleted == False), 'type.id', '%(name)s')) On May 27, 3:25 am, Neveen Adel wrote: > Hello, > > i have table > > db.define_table("type", >       SQLField("name", "string"), >       SQLField("deleted", "boolean",default=False), >   ) > > and > > db.defi

Re: [web2py] postgresql connection problem -

2010-05-27 Thread Julius Minka
I found something in the archive. This seems to be multiple python versions issue, but still do not have a solution. Unfortunately, this server is preinstalled with python2.4 and I am trying to use 2.6, which can't be probably found under mod_wsgi Julius V Štvrtok, 27. máj 2010 o 12:54 +0200, Jul

Re: [web2py] Planet web2py

2010-05-27 Thread Álvaro Justen
On Thu, May 27, 2010 at 00:24, Alexandre Andrade wrote: >>or, is >>there any repository for web2py related application/plugins/slices?) > > yes. The web2py.com has a place for applications (appliances) > > http://web2py.com/appliances > > Just send it to Massimo: > > mdipie...@cs.depaul.edu Wow,

[web2py] Re: Debian Packaging

2010-05-27 Thread Mark Breedveld
My excuse for my late reaction, but you all landed up my spambox of my provider. Which I've solved now. Thank you both for your reaction. You're (Jose) right on the best practices. In order to set up a debian packaging proces we should have or do the following - The web2py community should have a

[web2py] Re: Delete record without triggering validators?

2010-05-27 Thread Iceberg
> On May 11, 1:08 pm,Iceberg wrote: > > > Hi Massimo, > > > Right now validators are triggered even when a record is successfully > > being deleted. This can be annoying in case I am deleting old records > > as below: > > > db.define_table('my_table', > >     Field('today', 'date', > >         requ

Re: [web2py] postgresql connection problem -

2010-05-27 Thread Julius Minka
I was too fast. It works when accessed on port. It doesn't when accessed through mod_wsgi: File "gluon/sql.py", line 3835, in DAL migrate=migrate, fake_migrate=fake_migrate) File "gluon/sql.py", line 959, in __init__ self._pool_connection(lambda : psycopg2.connect(msg)) File "gluon/sq

Re: [web2py] postgresql connection problem - SOLVED

2010-05-27 Thread Julius Minka
I found the reason by removing exception catching when connecting to Postgres in gluon/sql.py. It told me that this line self._execute("SET standard_conforming_strings=on;") is a problem. I commented it out and everything is fine until now. Can this removal have a side effect? Julius V Št

[web2py] uploads problem

2010-05-27 Thread annet
In web2py I have a cms application and an init application. In the cms application I have a function in which users can upload images for a view which contains four images, the problem is that this view is in the init application not in the cms application, whereas the images end up in the uploads

Re: [web2py] postgresql connection problem

2010-05-27 Thread Julius Minka
I did that as first thing. No luck. I changed it to IP as I it works from command line. Julius V Streda, 26. máj 2010 o 19:41 -0500, Thadeus Burgess napísal(a): > Try > > postgres://w2p:passw...@localhost:5432/w2p > > -- > Thadeus > > > > > > On Wed, May 26, 2010 at 5:17 PM, Julius Minka

[web2py] Re: A quick question for everyone - generating a random code 'onvalidation'

2010-05-27 Thread scausten
Great thanks! Any other ideas from anyone to speed this up further? On May 27, 3:25 am, Mr admin wrote: > OK here's an example of counting matching records with web2py syntax. > > SQL version >        select count(*) from tbbooks where id = 1 group by id; > > Note!  if you don't add the GROUP BY

Re: [web2py] Re: A basic problem about threading and time consuming function...

2010-05-27 Thread Giuseppe Luca Scrofani
Thanks all for answering friends! I've extracted some good info from this discussion, and the solution proposed by Massimo work well :)

[web2py] drop down values according to condition

2010-05-27 Thread Neveen Adel
Hello, i have table db.define_table("type", SQLField("name", "string"), SQLField("deleted", "boolean",default=False), ) and db.define_table("ticket", SQLField("name", "string"), SQLField("type", db.type ), ) // here in ticket will display a drop down of types, i wa