[web2py] Re: SQLFORM.grid ondelete possible bug

2011-11-17 Thread Casey Schroeder
Thanks Massimo, I am trying this: delmem = lambda table, itid, ct: auth.del_membership(auth.id_group("auth_group_1"), table[int(itid)].userid) SQLFORM.grid(...ondelete=delmem...) table[int(itid)] however, is returning a none type, so the userid is inaccessible in this way. An exception is

[web2py] regarding mail captcha setings

2011-11-17 Thread Rohitraj Sharma
hi i have one contact page where i have db.define_table('message', SQLField('your_name',requires=IS_NOT_EMPTY()), SQLField('your_email',requires=IS_EMAIL()), SQLField('your_message','text',default=VALUE), SQLField('timestamp',default=str(datetime.datetime.now( def tlscontact()

[web2py] how to install python egg within a web2py application

2011-11-17 Thread apple
I am using pisa to generate a pdf and it requires html5lib and reportlab. This all works fine when installed within python27. I want to move this to the web2py application to make it self contained. I moved the pisa and reportlab directories into myapp/ modules and everything worked fine. However

[web2py] eclipse run/debug web2py (scheduler) stop error

2011-11-17 Thread szimszon
Hello All! I have a problem. If I run or debug web2py.py in eclipse/pydev all is fine just if I need to stop it (terminate) eclipse can't stop it. web2py is still running no matter if I run it in background or in foreground. I wonder if somebody could help me. Is there any way to do it without

[web2py] Re: SQLFORM.grid and query

2011-11-17 Thread JmiXIII
Hello, Sorry for the delay. The accepts is just here to process the Selection form check of field (date,...). Might it be because I hace 2 forms in my page (FORM and SQLFORM) ? for the sum it has been transformed to : if selection.accepts(request.vars,keepvalues=True): pass for

[web2py] Re: Newbie - install on Apache not working...

2011-11-17 Thread Derek
I agree Apache does not see this - that is what I am wondering about :) Yes, there are other name-based webpages on the server; this is a subdomain of them. On Nov 15, 2:17 pm, Kenneth Lundström wrote: > Hi Derek, > > is this the first name based domain on the server? Do you have other > name base

[web2py] Re: Newbie - install on Apache not working...

2011-11-17 Thread Derek
I have check the logs - the only place that I see anything related is in the access log, which shows the call to the URL (and nothing else). The call appears to get redirected to the home page for the main site. I have re-linked   CustomLog /private/var/log/apache2/access.log common   ErrorLog /

[web2py] Modify behavior foreign key

2011-11-17 Thread Renato Ramiro
In my application, I have two tables: City and Hospital. In the table City, there are two fields: name and group. And the table Hospital, there are name, number of beds, number of medics, and city (foreign key). Through the wizard, I did this (below): Field('f_city', type='reference t_city',

Re: [web2py] Re: Newbie - install on Apache not working...

2011-11-17 Thread Kenneth Lundström
Is the name of the configuration file correct, on Red Hat deratives only .conf are read by Apache (if not otherwise configured in httpd.conf)? Write some errors in the file, just add for example asdasd in the beginning of the file and try restarting Apache. If file read Apache should not be ab

[web2py] Re: how to install python egg within a web2py application

2011-11-17 Thread apple
Will answer myself just in case anyone has same problem - Just use any unzip program to unzip the egg into modules. On Nov 17, 10:28 am, apple wrote: > I am using pisa to generate a pdf and it requires html5lib and > reportlab. This all works fine when installed within python27. > > I want to mov

[web2py] Re: Newbie - install on Apache not working...

2011-11-17 Thread juanduke
Do you have enable all the apache modules indicated in web2py book?

[web2py] Re: Autocomplete Widget "changed" after upgrade

2011-11-17 Thread Massimo Di Pierro
Can you helps us debug? Use chrome, check out the callback url, call it directly, does it return a ticket? On Nov 17, 1:53 am, Ole Martin Maeland wrote: > Hi Massimo, > > upgrade from version 1.89.5 (2010-11-21), so old version. > > I have tried to substitute the built in autocomplete with s-cubi

[web2py] Re: Modify behavior foreign key

2011-11-17 Thread DenesL
It sound like you need to create three tables instead, one for cities, one for groups and one for city-group combos. On Nov 17, 6:52 am, Renato Ramiro wrote: > In my application, I have two tables: City and Hospital. > > In the table City, there are two fields: name and group. > And the table Ho

[web2py] Coffeescript in the browser

2011-11-17 Thread António Ramos
Seems interesting http://forgivingworm.wordpress.com/2010/09/27/running-coffeescript-in-browser/ one line says it all $ -> $(‘#header‘).css ‘background-color‘, ‘green‘ Also seems that rails is suporting Coffeescript How about web2py? Thank you

[web2py] Re: Modify behavior foreign key

2011-11-17 Thread Massimo Di Pierro
are you sure you want Field('f_group', type='reference t_city', label=T('Group')), and not Field('f_group', type='reference t_group', label=T('Group')), On Nov 17, 5:52 am, Renato Ramiro wrote: > In my application, I have two tables: City and Hospital. > > In the table City,

[web2py] Re: Computed Fields broken by 1.99.2

2011-11-17 Thread David Manns
I have finally figured out the cause of my problem, though not why there was inconsistency in behavior with some computed fields updating and others not.  I was putting writable=false and readable=false on the computed fields in my model.  I'm not sure why I thought this was correct usage; it makes

[web2py] Re: Recursive select up to 2 levels

2011-11-17 Thread DenesL
You have to use nested selects (see book chapter on DAL) as follows: retids = db(db.retail.owner_id==ownid)._select(db.retail.id) adms = db(db.administer.retail_id.belongs(ret)).select() On Nov 16, 11:31 pm, Cahya Dewanta wrote: > Hello. Here's how I define my models: > > db.define_table('owne

[web2py] Custom links for SQLFORM.grid

2011-11-17 Thread Jim Steil
Hi I'm using the following to generate custom links for my SQLFORM.smartgrid: actions = dict() nextActions = db(db.requisitionStatus.nextFunctionLabel>0).select() for nextAction in nextActions: actions[nextAction.requisitionStatusId] = dict(label=nextAction.nextFunctionLabel

[web2py] Re: Using web2py with a non-managed Oracle database

2011-11-17 Thread DenesL
Hi Ben, the FK and TFK references in the adapter and the migrate=False are unrelated. The migrate=False basically means 'use as is'. The DB will not be changed, but web2py needs to know how each table is defined before using it. In the case of legacy keyed tables, where there is no id field, the

[web2py] UPLOAD without DBIO

2011-11-17 Thread Phyo Arkar
Hello Web2py. I am needing a function that Filename need to be reserved. Using filemanager (Elfinder) is the way i am treating currently but it do not use web2py's upload function. Need to keep file-name as it. is web2py's default upload function cand do without DB IO ? Thanks Phyo.

Re: [web2py] routers only exposing default controller

2011-11-17 Thread Jonathan Lundell
On Nov 16, 2011, at 11:53 PM, Richard Baron Penman wrote: > what web2py version are you using? I have 1.99.2 > > > This is the only variable I have defined in routes.py: > > routers = dict( > BASE = dict( > domains = { > 'domain1' : 'forum', > 'domain2' : 'sales', >

[web2py] Re: packaging return from executesql as Rows object?

2011-11-17 Thread DenesL
Why not just: table = TABLE(THEAD(columns), TBODY(raw_rows)) On Nov 16, 3:43 pm, David Watson wrote: > Does anybody have example code showing how to package the return from > executesql as a gluon.sql.Rows object? > > I have tried: > >     raw_rows = legacy_db.executesql(sqlstr, as_dict=True) >

[web2py] Make an image Thumb

2011-11-17 Thread Web2Py Freak
Dear All, i am trying to make a Thumb and i used this code here : Model: db.define_table('uploads', Field('name','string'), Field('mainfile','upload'), Field('thumb','upload',writable=False,readable=False), ) Controller: def makeThumbnail(dbtable,ImageID,size=(150,150)): t

[web2py] orderby with virtualfields

2011-11-17 Thread Daniel Aguayo
Hi, web2py has so many 'fast way' of doing thins that I trying to find Is there any fast way to do an "orderby" in a select with virtualfields (been the virtualfield the orderby parameter)? kind regards -- Daniel Aguayo @dantoac GNU/Linux User #387337

[web2py] Re: Custom links for SQLFORM.grid

2011-11-17 Thread Cliff
Jim, I have to solve a similar puzzle soon. Here's the approach I'm going to try. def make_button(this, that): # dummy_button has the text but is lowlighted without an A helper if should_return_dummy_button: return lowlightedbutton else: return workingbutton links =

[web2py] Import Python Imaging Library(PIL)

2011-11-17 Thread Web2Py Freak
Dear All, am trying to use the PIL and i am using this code : class RESIZE(object): def __init__(self,nx=160,ny=80,error_message='niepoprawny plik'): (self.nx,self.ny,self.error_message)=(nx,ny,error_message) def __call__(self,value): if isinstance(value, str) and len(val

[web2py] Re: Recursive select up to 2 levels

2011-11-17 Thread Cahya Dewanta
Thank you, DenesL!

[web2py] Re: Recursive select up to 2 levels

2011-11-17 Thread Cliff
query = ((db.owner.id==somevaluethatyousupply) & (db.retail.owner_id==db.owner.id) & (db.administer.retail_id==db.retail.id)) rows = db(query)select(db.administer.name) The first line in the query gets the owner row. The second line gets all the retails related to the owner. The

Re: [web2py] Re: Custom links for SQLFORM.grid

2011-11-17 Thread Jim Steil
I just opened a ticket (http://code.google.com/p/web2py/issues/detail?id=522) and offered a (probably over-simplistic) mod to sqlhtml.py that would give the behavior I am looking for. Basically, if None is returned from the lambda function, the button is not displayed. Works fine for all my

[web2py] Manual upload for a specific row

2011-11-17 Thread Dominique
Hello, Chapter 6 explains manual upoloads. >>> db.define_table('myfile',Field('image','upload')) >>> stream = open(filename,'rb') >>> db.myfile.insert(image=db.myfile.image.store(stream,filename)) That works fine when the table is empty. But how to upload an image file in order to update a speci

[web2py] Re: Import Python Imaging Library(PIL)

2011-11-17 Thread Ross Peoples
try moving PIL to "modules", not models.

[web2py] edge case of SQLFORM.grid search not working on 1.99.2

2011-11-17 Thread Cliff
grid search fails to find values if - the field type is reference:string - the field value contains a space db.define_table(mytable, Field('silly_strings', 'reference:string)) db.mytable.sillystrings.requires = IS_IN_SET(['one', 'two', 'buckle my shoe'], zero='pick one' ) grid search finds 'one'

[web2py] Re: Manual upload for a specific row

2011-11-17 Thread Anthony
On Thursday, November 17, 2011 11:01:34 AM UTC-5, Dominique wrote: > > Hello, > > Chapter 6 explains manual upoloads. > > >>> db.define_table('myfile',Field('image','upload')) > >>> stream = open(filename,'rb') > >>> db.myfile.insert(image=db.myfile.image.store(stream,filename)) > That works f

Re: [web2py] routers only exposing default controller

2011-11-17 Thread Richard Baron Penman
in fact Bruno's suggestion to use the controllers variable does work for me. Previously I used what you suggest (see first post in this thread) and then only the default controller was exposed. What error? Accessing domain/sales before returned this error: invalid function (default/sales) Richard

Re: [web2py] routers only exposing default controller

2011-11-17 Thread Jonathan Lundell
On Nov 17, 2011, at 8:20 AM, Richard Baron Penman wrote: > in fact Bruno's suggestion to use the controllers variable does work for me. > Previously I used what you suggest (see first post in this thread) and > then only the default controller was exposed. > > What error? Accessing domain/sales b

[web2py] Re: Manual upload for a specific row

2011-11-17 Thread Dominique
Yep Too simple !! Thanks a lot Anthony. I appreciate. Dominique On Nov 17, 5:13 pm, Anthony wrote: > On Thursday, November 17, 2011 11:01:34 AM UTC-5, Dominique wrote: > > > Hello, > > > Chapter 6 explains manual upoloads. > > > >>> db.define_table('myfile',Field('image','upload')) > > >>> stre

Re: [web2py] routers only exposing default controller

2011-11-17 Thread Richard Baron Penman
OK domain1/sales (These are just examples - if would be helpful to have the exact settings and domains I am using we can have a private conversation.) The apps have different controllers. Richard On Fri, Nov 18, 2011 at 1:31 AM, Jonathan Lundell wrote: > On Nov 17, 2011, at 8:20 AM, Richard Ba

Re: [web2py] excellent talk on web2py

2011-11-17 Thread Vinicius Assef
Shows just a blank page, to me. :-( On Wed, Nov 16, 2011 at 2:22 AM, Massimo Di Pierro wrote: > https://codebits.eu/intra/s/session/200 > > good job Francisco!

[web2py] socket.io Web2Py

2011-11-17 Thread Shiv
Hi Everyone, Has any one used the socket.io with web2py, please share your experience. My requirement is On click action, open a socket and run a TCL script and communication with same. Once the TCL script is done the close the socket. I have to run multiple such TCL script on multiple ports p

Re: [web2py] routers only exposing default controller

2011-11-17 Thread Jonathan Lundell
On Nov 17, 2011, at 8:48 AM, Richard Baron Penman wrote: > OK domain1/sales > (These are just examples - if would be helpful to have the exact > settings and domains I am using we can have a private conversation.) > > The apps have different controllers. With this router: routers = dict( BASE

Re: [web2py] Re: Strange behavior using a function to update a record

2011-11-17 Thread Vinicius Assef
By the way, isn't it quite strange that same verb (update) being used to make two different things? On Wed, Nov 16, 2011 at 12:12 PM, Anthony wrote: > On Wednesday, November 16, 2011 8:57:10 AM UTC-5, Tito Garrido wrote: >> >> "sandbox/models/db_functions.py" >> >> def test(id): >>     r=db.myt

Re: [web2py] Easy handling of subforms

2011-11-17 Thread ~redShadow~
On Wed, 2011-11-16 at 15:36 -0500, Richard Vézina wrote: > Man! > > > I think you got a nice solution for this exact problem... > > > I had tried with jQuery in the pass to manage this by duplicating the > field that I want to bunch insert for... It was working but was > breaking the workflow o

Re: [web2py] socket.io Web2Py

2011-11-17 Thread Vasile Ermicioi
socket.io is server side javascript that doesn't have anything in common with web2py

Re: [web2py] socket.io Web2Py

2011-11-17 Thread António Ramos
Hello, i´m trying to work with socket. io in windows and no luck After that i would try it with web2py but i´m stuck with this example http://davidchambersdesign.com/getting-started-with-socket.io/ 2011/11/17 Vasile Ermicioi > socket.io is server side javascript that doesn't have anything

Re: [web2py] excellent talk on web2py

2011-11-17 Thread Ross Peoples
I watched it yesterday and it worked. Though Chrome flagged the JavaScript as insecure, so I told it to run anyways and the video worked.

[web2py] [OFF] Python Weekly mention of web2py video by Francisco

2011-11-17 Thread mikech
Great weekly newletter. Occasionally web2py comes up, though Django has the majority of stories. http://www.pythonweekly.com/ Here is the most recent issue: http://us2.campaign-archive1.com/?u=e2e180baf855ac797ef407fc7&id=1c9c8cf4de&e=a7170878cf

[web2py] Re: socket.io Web2Py

2011-11-17 Thread Anthony
Here's a three-part blog series on using Tornado, web2py's comet_messaging.py, and Socket.IO for async communication: http://greg.thehellings.com/2011/04/web2py-websockets-and-socket-io-part-i-basic-display/ (link to Part 2 at the bottom). I suppose gevent-socketio (https://bitbucket.org/Jeff

Re: [web2py] Re: Strange behavior using a function to update a record

2011-11-17 Thread Anthony
On Thursday, November 17, 2011 12:21:08 PM UTC-5, viniciusban wrote: > > By the way, isn't it quite strange that same verb (update) being used > to make two different things? What do you mean?

Re: [web2py] Re: Custom search_widget SQLFORM.grid

2011-11-17 Thread Jim Steil
Created ticket with patch requesting modification to sqlhtml.py or discussion on how this could be better implemented. Please comment if you like or dislike... http://code.google.com/p/web2py/issues/detail?id=523 -Jim On 11/4/2011 4:49 PM, Jim Steil wrote: Attached is my updated version

Re: [web2py] Re: Modify behavior foreign key

2011-11-17 Thread Renato Ramiro
I asked the same question in the web2py-users-brazil . And this was the suggestion: ### db.t_hospital.f_group.requires = IS_IN_DB(db.t_city, 't_city.id', db.t_city.f_group, zero=T('[Choose an item from the list]'

[web2py] Re: DAL caching values automatically?

2011-11-17 Thread John Duddy
I think you may have nailed it - my cron does run continuously. I always commit my transactions. Do you know how to force it to reset manually? On Nov 16, 9:17 pm, nick name wrote: > Does your cron program run continuously? what database are you using? > > If you are using a database that suppor

Re: [web2py] Make an image Thumb

2011-11-17 Thread nils
Hi, Do you have PIL library installed ? I have something similar but def THUMB(image,nx=100,ny=100): try: from PIL import Image import os basefolder=os.path.join(request.folder, 'uploads') img = Image.open(os.path.join(basefolder, image)) img.thumbnail(

[web2py] Re: orderby with virtualfields

2011-11-17 Thread DenesL
Virtual fields are not stored in the DB so no select and no orderby on them. On Nov 17, 10:33 am, Daniel Aguayo wrote: > Hi, > > web2py has so many 'fast way' of doing thins that I trying to find > Is there any fast way to do an "orderby" in a select with virtualfields > (been the virtualfield t

Re: [web2py] Re: Strange behavior using a function to update a record

2011-11-17 Thread Vinicius Assef
I'm saying that: row.update() doesn't alter database contents, as set.update() does. Same verb, different behaviour. On Thu, Nov 17, 2011 at 4:50 PM, Anthony wrote: > On Thursday, November 17, 2011 12:21:08 PM UTC-5, viniciusban wrote: >> >> By the way, isn't it quite strange that same verb (u

Re: [web2py] Re: Strange behavior using a function to update a record

2011-11-17 Thread Anthony
On Thursday, November 17, 2011 4:19:16 PM UTC-5, viniciusban wrote: > > I'm saying that: > row.update() doesn't alter database contents, as set.update() does. > > Same verb, different behaviour. > Why should it have the same behavior -- it's the same verb, but operating on instances of different c

[web2py] Problem with revert to previous version button -- patch included

2011-11-17 Thread Brian Peterson
Currently running "Version 1.99.2 (2011-09-26 06:55:33) stable", not sure what other versions that this applies to. Symptoms: "Revert" button in app edit page does not work properly. After pressing the revert button a "file saved on " message is flashed, but it won't restore the code to the previ

Re: [web2py] Re: Mixing/supporting CMS with Web2py

2011-11-17 Thread Farsheed Ashouri
Ourway.ir is a social network based on web2py. It's also has a blog system witch a kind of CMS. I am going to open source it soon.

[web2py] Re: Coffeescript in the browser

2011-11-17 Thread howesc
"support" interesting question http://www.starmakerstudios.com/ is coffescript + backbone js with all data supplied via calls to a web2py database backend. i have not worked on the coffee/backbone parts of the site, but the team figured out how to make them interact well with JSON calls t

[web2py] Re: Recursive select up to 2 levels

2011-11-17 Thread Cahya Dewanta
Thank you, Cliff. Now it's clear how to do recursive select to whatever level :)

[web2py] jquery mobile 1.0 released

2011-11-17 Thread Massimo Di Pierro
http://jquerymobile.com/blog/2011/11/16/announcing-jquery-mobile-1-0/

[web2py] Re: Modify behavior foreign key

2011-11-17 Thread Massimo Di Pierro
 IS_IN_DB(db.t_city, ...) ? should be IS_IN_DB(db, ) On Nov 17, 1:06 pm, Renato Ramiro wrote: > I asked the same question in the > web2py-users-brazil > . > > And this was the suggestion: > > ### > db.t_ho

[web2py] Re: Coffeescript in the browser

2011-11-17 Thread Massimo Di Pierro
coffeescript is really nice. I use it a lot. It works with web2py. I do not think t should be included in web2py because it just adds one more abstraction layer (less people know coffeescript than js). Moreover it is harder to debug coffeescript than javascript. On Nov 17, 8:01 am, António Ramos

[web2py] Re: Problem with revert to previous version button -- patch included

2011-11-17 Thread Massimo Di Pierro
uploading to trunk. Thanks Brian! On Nov 17, 4:10 pm, Brian Peterson wrote: > Currently running "Version 1.99.2 (2011-09-26 06:55:33) stable", not > sure what other versions that this applies to. > > Symptoms: > "Revert" button in app edit page does not work properly.  After > pressing the revert

[web2py] Re: Make an image Thumb

2011-11-17 Thread pbreit
Here's what I have that works fine. All in the model file. Field('image', 'upload', uploadfolder=request.folder+'static/uploads', requires=IS_EMPTY_OR(IS_IMAGE())), Field('image_thumb', 'upload', uploadfolder=request.folder+'static/uploads', readable=False, writabl

Re: [web2py] Re: Strange behavior using a function to update a record

2011-11-17 Thread Vinicius Assef
Anthony, I understand that. If set.update() updates data on a collection of records, row.update() should update data in just one record. It makes more sense to me. Web2py newcomers think about using row.update() to update data on db. It's is a trick, in my oppinion. Aftwards, Row represents a row

[web2py] Login form hidden "_next" field isn't reset

2011-11-17 Thread Vinicius Assef
I'm making some tests with Auth and I'm facing one problem. This is my controller: http://pastebin.com/CNigd5qL I have a normal login form in default/index I'm following this flow: 1) Enter default/index page. 2) Go to default/protected Here, web2py redirects me to login page. It's right. :-) Wh

[web2py] XMLRPC client for Python 3

2011-11-17 Thread Paul
The "book" gives an example Python 2 XMLRPC client example on the "Overview" page. There are many reasons that web2py is not yet Python 3. That's fine. But, perhaps we could include a Python 3 client example which might benefit those who do make the move. This was done with Python 3.2.2. >>> impo

[web2py] Re: socket.io Web2Py

2011-11-17 Thread Matt Gorecki
I am able to send socket.io events with this code: https://gist.github.com/1375505 It's based off an answer I found on Stack Overflow . With the code in that gist, you should

[web2py] Re: web2py with SAE Python

2011-11-17 Thread chinakr
Thanks , cfh! Sorry for late reply. I'll ask the administrator of SAE Python and get necessary information. btw, I would like to suggest and help SAE Python to release English version of official docs. On 11月12日, 下午1时05分, howesc wrote: > i can't read Chinese, so i can't read the docs. :(  but i

Re: [web2py] routers only exposing default controller

2011-11-17 Thread Richard Baron Penman
The point is the other controllers are not available without the controllers variable. I can provide the real domains used in a private conversation if helpful. Since Bruno has also experienced this it must be a real problem. On Fri, Nov 18, 2011 at 2:09 AM, Jonathan Lundell wrote: > On Nov 17,

Re: [web2py] edge case of SQLFORM.grid search not working on 1.99.2

2011-11-17 Thread Johann Spies
On 17 November 2011 18:08, Cliff wrote: > grid search fails to find values if > - the field type is reference:string > - the field value contains a space > > db.define_table(mytable, Field('silly_strings', 'reference:string)) > > db.mytable.sillystrings.requires = IS_IN_SET(['one', 'two', 'buckle

Re: [web2py] routers only exposing default controller

2011-11-17 Thread Jonathan Lundell
On Nov 17, 2011, at 8:03 PM, Richard Baron Penman wrote: > The point is the other controllers are not available without the > controllers variable. I can provide the real domains used in a private > conversation if helpful. > > Since Bruno has also experienced this it must be a real problem. It'

Re: [web2py] routers only exposing default controller

2011-11-17 Thread Richard Baron Penman
I am accessing the app through the right domain, but when I created the example I made a mistake with the domain. Setting the controllers does fix the problem. If I was not using the right domain then it wouldn't work with the controllers variable either. On Fri, Nov 18, 2011 at 3:21 PM, Jonathan

Re: [web2py] routers only exposing default controller

2011-11-17 Thread Jonathan Lundell
On Nov 17, 2011, at 10:31 PM, Richard Baron Penman wrote: > I am accessing the app through the right domain, but when I created > the example I made a mistake with the domain. > Setting the controllers does fix the problem. If I was not using the > right domain then it wouldn't work with the contr

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-17 Thread Rahul
Hi Johan, All, Sorry but I am not able to get it. With your code above I get an invalid controller. I understand that we can add custom buttons with their functions in the controller to the grid. That I am able to do but, I would like to know what changes would I have to do if - 1. I want