Re: [web2py] Passenger WSGI Session

2013-02-11 Thread Vaibhav Kapoor
Thank you for your response but I finally figured out the problem. To make RPC calls it seems that user needs to be authenticated on Dreamhost, so when I login with my app: > user:pass@*www.*app.dreamhost.com/app/default/call/jsonrpc Another important thing to remember is that without the www

[web2py] serial no. in SQLFORM.grid

2013-02-11 Thread Pankaj Pathak
Good noon to all, Is there any technic to set serial no in SQLGRID, i have try following code for it but i am not satisfied, db.define_table("material", Field("serial_no", writable=False,), Field("material_type", requires=IS_IN_SET(['Capax', 'Opax']), default = "

[web2py] Re: How can do muliple check boxes if a group and only allow the user the select 1.

2013-02-11 Thread Dan Kozlowski
On Sunday, February 10, 2013 5:07:16 PM UTC-6, Dan Kozlowski wrote: > > How can do muliple check boxes if a group and only allow the user the > select 1. I used the smart grid to create the add and update. > > > Dog or Cat and only 1 can be selected. > > -- --- You received this message b

[web2py] Re: Star Rating

2013-02-11 Thread Alan Etkin
> > Here is the code that worked for me when added to the view. ... > Good catch, I should have added the .ready call to wait until the form element is available. The rating plugin worked without this. We could fix the plugin script so there's no need for the workaround. -- --- You rece

[web2py] Re: serial no. in SQLFORM.grid

2013-02-11 Thread Niphlod
uhm that code will put down your db as soon as "material" gets a few lines a better way is to fetch the latest id using orderby and limit new_id = db(db.material.id>0).select(db.material.id, orderby=~db.material.id, limitby=(0,1)).first() new_id = new_id and new_id + 1 or 1 But.if

[web2py] Re: @auth.requires_membership('Admin') and @auth.requires(auth.has_membership(role = 'Admin'))

2013-02-11 Thread 黄祥
another strange behaviour is when @auth.requires(auth.has_membership(role = 'Admin')) put on the function that call it, the add function didn't work *work* *@auth.requires(auth.has_membership(role = 'Admin')) ## here is the difference* def __grid_0(flash, table): response.flash=T(flash)

[web2py] clear data session

2013-02-11 Thread 黄祥
hai, is there a way to clear data session? i've tried session.clear() it seems not work any help is greatly appreciate. many thanks in advance -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiv

[web2py] Re: Server konfigurations basics redirects

2013-02-11 Thread BlueShadow
OK the routes.py option sounds pretty promissing. still I will have a problem when I start my second app. So what do I do if I got two domainnames? And I would like to hide the application name if it is possible. So www.dname1.com= ip/App1/ and www.dname2.com= ip/App2/ On Monday, February 11,

[web2py] Re: clear data session

2013-02-11 Thread Anthony
session.clear() should work. Can you show more code and explain the exact behavior you are seeing? On Monday, February 11, 2013 8:30:49 AM UTC-5, 黄祥 wrote: > > hai, > > is there a way to clear data session? > i've tried session.clear() it seems not work > any help is greatly appreciate. > > many

[web2py] Error in admin application when sessions expired or deploying new application

2013-02-11 Thread Mickael Corniere
Hello, I have a strange error on admin error. Even with no customized application deployed, sometimes admin application "crashes" with this message on web page: Internal errorTicket issued: unrecoverable And in the

[web2py] Re: Error in admin application when sessions expired or deploying new application

2013-02-11 Thread Alan Etkin
> I manage sometimes to deploy application by removing sessions file, bu today impossible to make it works :'( Are you assigning to session a function/lambda? session.f = lambda x: x+1 # this is not legal -- --- You received this message because you are subscribed to the Google Groups "web2

[web2py] Re: Error in admin application when sessions expired or deploying new application

2013-02-11 Thread Mickael Corniere
Hello Allan, The answer is no. As the application is the appadmin, I didn't change it. I use the one given by web2py. Thx Le lundi 11 février 2013 15:28:14 UTC+1, Alan Etkin a écrit : > > > I manage sometimes to deploy application by removing sessions file, bu > today impossible to make it wor

[web2py] Re: @auth.requires_membership('Admin') and @auth.requires(auth.has_membership(role = 'Admin'))

2013-02-11 Thread Anthony
These should be equivalent, though technically @auth.requires_membership('Admin') is equivalent to @auth.requires(lambda: auth.has_membership(role='Admin')). Using the lambda prevents unnecessary database hits checking for membership in cases where the controller file is executed but the specif

[web2py] Re: reCaptcha in registration form with custom layout

2013-02-11 Thread Johan Börjesson
I had the same problem a while ago. The solution is described in the book: http://web2py.com/books/default/chapter/29/09#CAPTCHA-and-reCAPTCHA Instead of > > > {{=form.custom.widget.recaptcha}} > > use {{=FORM(Recaptcha(request,PUBLIC_KEY, PRIVATE_KEY, options="theme:'white'" ))}} -- ---

Re: [web2py] Cannot label id field

2013-02-11 Thread Richard Vézina
I don't think you can change the representation of the id field you see in smartgrid, you can hide with a switch : https://groups.google.com/forum/#!msg/web2py/UYZE3G4hW2A/oqZdGeUa3xAJ showid: false If you read the thread I show the way I change representation of id with SQLTABLE(), it may be ada

Re: [web2py] Re: Integrating iPhone device tokens into web2py auth

2013-02-11 Thread howesc
Thanks Alec, that will be a nice contribution. re my "special odd pain in the rear-end" login flow.well we (the engineers) failed to sell that to the business. users can make purchases via apple without a proper logged in account, and we need to track those on the server. hence the anonym

Re: [web2py] Cannot label id field

2013-02-11 Thread LightDot
Field label and representation are two different things... A label is only displayed next to the field in generated forms. A visual aid, so to speak... Regardless of the label, the field itself would still be named "id", it's format or representation would stay the same. François simply wants t

Re: [web2py] skyrocketing memory. How to pinpoint the problem?

2013-02-11 Thread Todd Shifflett
That's the thing. When I remove all functionality of my app and simply create a new one whose only function is to return a json object of {"test":"memory"} I see this behavior. I was thinking that perhaps the memory was climbing because I was importing a module at the wrong place or something.

[web2py] Re: Error in admin application when sessions expired or deploying new application

2013-02-11 Thread Massimo Di Pierro
appadmin still loads your model files first. There you are storing something in session that cannot be pickled. On Monday, 11 February 2013 08:34:27 UTC-6, Mickael Corniere wrote: > > Hello Allan, > > The answer is no. As the application is the appadmin, I didn't change it. > I use the one given

[web2py] Re: reCaptcha in registration form with custom layout

2013-02-11 Thread Massimo Di Pierro
Using a form inside a form may not a good idea. How about just: {{=Recaptcha(request,PUBLIC_KEY, PRIVATE_KEY, options="theme:'white'")}} Would that work? Any suggestion for fixing this problem? On Monday, 11 February 2013 09:13:15 UTC-6, Johan Börjesson wrote: > > I had the same problem a while

Re: [web2py] skyrocketing memory. How to pinpoint the problem?

2013-02-11 Thread Massimo Di Pierro
Keep us posted. There is one thing that can cause a leak. Instantiating an object with __del__ method at every request. It is possible that a third party library does that if you import it and all one of its functions. Another thing is cache ram. Another is T(something) where something is reque

[web2py] Pre-populating a form with SQLFORM.factory

2013-02-11 Thread Tom Hines
Hello. I want to use SQLFORM.factory() and pre-populate a form with values from the last form use. Kind of like an update form. It works some of the time, but I'm getting a lot of KeyError: 'id' exceptions. There is no 'id' field. Using web2py version 2.3.2. Thanks for any help. Example:

Re: [web2py] Cannot label id field

2013-02-11 Thread Richard Vézina
My bad about, I miss understand... Richard On Mon, Feb 11, 2013 at 12:42 PM, LightDot wrote: > Field label and representation are two different things... > > A label is only displayed next to the field in generated forms. A visual > aid, so to speak... Regardless of the label, the field itself

Re: [web2py] Re: Error in admin application when sessions expired or deploying new application

2013-02-11 Thread Mickael Corniere
Thx Massimo I will check 2013/2/11 Massimo Di Pierro > appadmin still loads your model files first. There you are storing > something in session that cannot be pickled. > > > On Monday, 11 February 2013 08:34:27 UTC-6, Mickael Corniere wrote: >> >> Hello Allan, >> >> The answer is no. As the ap

[web2py] Re: clear data session

2013-02-11 Thread 黄祥
hi anthony, here is the code : *# controller * def order_callback(): id=int(request.vars.id) if request.vars.action=='add': session.order[id]=session.order.get(id, 0)+1 if request.vars.action=='sub': session.order[id]=max(0,session.order.get(id, 0)-1) *#if request.v

Re: [web2py] Cannot label id field

2013-02-11 Thread Richard Vézina
Too me it is not a bug, since there is a button to acces those records (read or update), I don't see why you want the id to be include in the grid, so... showid: false and rely on the grid button should be all right. Richard On Mon, Feb 11, 2013 at 1:06 PM, Richard Vézina wrote: > My bad about

[web2py] Re: @auth.requires_membership('Admin') and @auth.requires(auth.has_membership(role = 'Admin'))

2013-02-11 Thread 黄祥
hi anthony, thank for your explaination, but i'm sorry, i'm still not understand. i've already tried to learn from trial and error like the code that i've shown above. the unexpected result above, is mean that i can not view the page that is authorize to me (as an *admin membership*). the stran

[web2py] Re: Pre-populating a form with SQLFORM.factory

2013-02-11 Thread Massimo Di Pierro
form=SQLFORM.factory( Field(...), Field(...)).process(keepvalues=True) On Monday, 11 February 2013 10:56:54 UTC-6, Tom Hines wrote: > > Hello. I want to use SQLFORM.factory() and pre-populate a form with > values from the last form use. Kind of like an update form. It works some > of the

[web2py] Re: @auth.requires_membership('Admin') and @auth.requires(auth.has_membership(role = 'Admin'))

2013-02-11 Thread Massimo Di Pierro
Please open a ticket about this and link this thread. they should work the same. I never had a problem with it but we will take a second look. On Monday, 11 February 2013 12:32:05 UTC-6, 黄祥 wrote: > > hi anthony, > > thank for your explaination, but i'm sorry, i'm still not understand. i've > al

[web2py] Re: Cannot label id field

2013-02-11 Thread Derek
Seems to work for me. db.define_table('customers', Field('name', 'string',length=50, requires=IS_NOT_EMPTY()), ... Field('country','string',length=3), Field('active','boolean'),format='%(name)s', singular='customer', plural='customers') db.customers.id.label=T('TEST ID') On web2py

[web2py] Re: clear data session

2013-02-11 Thread Derek
why are you not doing this: * if request.vars.action=='remove':* *del session.order[id]* * *On Monday, February 11, 2013 11:16:52 AM UTC-7, 黄祥 wrote: > > hi anthony, > > here is the code : > *# controller * > def order_callback(): > id=int(request.vars.id) > if request.vars.action=

[web2py] Re: How to use a text file instead of a db?

2013-02-11 Thread Niphlod
open the file, read it and do what you need to do. your question leaves a lot of holes about what you're trying to do. On Monday, February 11, 2013 7:52:38 PM UTC+1, rh wrote: > > I have a text file and want to generate a page using that file's contents > instead of querying a db. > > I hav

Re: [web2py] Re: Cannot label id field

2013-02-11 Thread Richard Vézina
I just look again at the model of François and I think there is a mistake, because id field should not be of type integer when you explicitly define them in your model type='id' is the proper type, so maybe he has 2 differents columns named id or his model doesn't really works. Ref.: http://web2p

[web2py] Re: clear data session

2013-02-11 Thread Anthony
*session.order[id]=session.clear()* * * I would think the above would generate an error -- session.clear() empties the session object (and returns None), and then you attempt to assign to session.order[id], even though session.order no longer exists. Assuming session.order is a list, ses

[web2py] Re: serving php and python in shared hosting

2013-02-11 Thread José Eloy
Thanks to all for your help. I'll share with you all my progress. Well, first I created a subdomain: http://www.administracionjoomla.transicion.mx. In /www I created a folder called joomla, inside I copied all the joomla instalation. For access joomla site I had to go http://www.administracionj

[web2py] Re: How to use a text file instead of a db?

2013-02-11 Thread Derek
put it in /static and access it by name. On Monday, February 11, 2013 1:54:34 PM UTC-7, rh wrote: > > On Mon, 11 Feb 2013 11:33:56 -0800 (PST) > Niphlod > wrote: > > > open the file, read it and do what you need to do. your question > > leaves a lot of holes about what you're trying to do.

[web2py] Re: Pre-populating a form with SQLFORM.factory

2013-02-11 Thread Tom Hines
Thank you. That works. Now I'm keeping the form history and letting the user select any previous set of values. I have found that this works for me: record = oldvals# oldvals are from a previous form.vars record['id'] = '' form=SQLFORM.factory( Field(...), Field(...), ..., record

[web2py] Re: How to use a text file instead of a db?

2013-02-11 Thread Niphlod
ehm put the file somewhere reachable by your app. Let's say you put a file "hello.txt" into the private/ folder. import os def myfunction(): filepath = os.path.join(request.folder, "private", "hello.txt") with open(filepath) as g: content = g.read() return dict(content=con

Re: [web2py] Re: Integrating iPhone device tokens into web2py auth

2013-02-11 Thread Kenny Chung
Thank you, guys. :) I think I should try to implement one, when I am free. Do you know any opensource for iphone oauth login as well as android? I am actually passing login credentials to web2py from android app via given web2py lib. On Feb 11, 2013 11:29 AM, "howesc" wrote: > Thanks Alec, tha

[web2py] Re: clear data session

2013-02-11 Thread Michael Beller
Hi Hai, I've also used posonlinestore as a basis for an application. I also added a "remove" option and used "del session.cart[id]" to remove an item from the cart (it looks like you're using "order" instead of "cart". I used "session.cart.clear()" to empty the cart after I processed the order

[web2py] Simple routing question

2013-02-11 Thread Jim S
I'm trying to route traffic that comes in on a specific URL to a specifc app. Example: www.host1.com should route to the welcome app www.host2.com should route to mySpecific app I realize this is probably trivial, but I'm really struggling with it. Hoping to do it with routes.py and not thro

Re: [web2py] Simple routing question

2013-02-11 Thread Jonathan Lundell
On 11 Feb 2013, at 3:36 PM, Jim S wrote: > I'm trying to route traffic that comes in on a specific URL to a specifc app. > > Example: > > www.host1.com should route to the welcome app > > www.host2.com should route to mySpecific app > > I realize this is probably trivial, but I'm really strugg

Re: [web2py] Simple routing question

2013-02-11 Thread Jim S
Jonathan I am currently using that as my base for getting this working. Here is what I have so far: routers = dict( # base router BASE=dict(domains = {"www.website1.com":"mustangs", "www.website2.com":"icysa", })) But, anytime I to either URL, I get the web2py welco

Re: [web2py] Simple routing question

2013-02-11 Thread Jonathan Lundell
On 11 Feb 2013, at 7:01 PM, Jim S wrote: > Jonathan > > I am currently using that as my base for getting this working. Here is what > I have so far: > > routers = dict( > # base router > BASE=dict(domains = {"www.website1.com":"mustangs", > "www.website2.com":"icysa

Re: [web2py] Simple routing question

2013-02-11 Thread Jim Steil
Sorry for being slow at this, route configuration is certainly not a forte of mine. Is there something special I need to do to turn on logging? How would I examine request.env? I'm running all of this from pythonanywhere and don't really know where to find these things. -Jim On Mon, Feb 11, 20

Re: [web2py] Simple routing question

2013-02-11 Thread Jim S
...and yes, restarted. On Monday, February 11, 2013 9:48:59 PM UTC-6, Jim S wrote: > > Sorry for being slow at this, route configuration is certainly not a forte > of mine. Is there something special I need to do to turn on logging? How > would I examine request.env? I'm running all of this f

Re: [web2py] Re: Integrating iPhone device tokens into web2py auth

2013-02-11 Thread Alec Taylor
On Tue, Feb 12, 2013 at 4:29 AM, howesc wrote: > Thanks Alec, that will be a nice contribution. > > re my "special odd pain in the rear-end" login flow.well we (the > engineers) failed to sell that to the business. users can make purchases > via apple without a proper logged in account, and w

Re: [web2py] Simple routing question

2013-02-11 Thread Jonathan Lundell
On 11 Feb 2013, at 7:48 PM, Jim Steil wrote: > Sorry for being slow at this, route configuration is certainly not a forte of > mine. Is there something special I need to do to turn on logging? How would > I examine request.env? I'm running all of this from pythonanywhere and don't > really k

[web2py] Converting Field of a SQLFORM.grid to local timezone of a user.....

2013-02-11 Thread newbie
Hi, I have a table x, with fields name,place,timezone offset.And another table y which references to table x and has an additional field 'timezone',which displays the timezone of the server its fetching the values from.I want to convert the timezone of the server,to the timezone of the loca

[web2py] Re: How to use a text file instead of a db?

2013-02-11 Thread Rufus
And if you don't need the layout (by returning a dict), just return the file contents: def showfile(): return (open("filename.ext","r").read()) -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and st

[web2py] Re: Converting Field of a SQLFORM.grid to local timezone of a user.....

2013-02-11 Thread newbie
On Tuesday, 12 February 2013 11:06:00 UTC+5:30, newbie wrote: > > Hi, > I have a table x, with fields name,place,timezone_offset.And another > table y ,having field 'servertime',which stores the current time of the > server its fetching the values from. > > db.define_table('x',Field('na

Re: [web2py] Re: Converting Field of a SQLFORM.grid to local timezone of a user.....

2013-02-11 Thread Bruno Rocha
I am on mobile now and I cant ellaborate a good code example, but I can give you a hint. db.table.datefield.represent = lambda value, row : value.strftime("%Y/%m/%d") grid = SQLFORM.grid(db.table) so grid will use the represent callback to display the data. following this example you can do de

[web2py] Re: Server konfigurations basics redirects

2013-02-11 Thread Emilius Omeen
my english not so good, but maybe I suggest way to solve http://web2py.com/books/default/chapter/29/04#URL-rewrite So you can now have language-specific static files, including images, if you need to. Domain mapping is supported as well: routers = dict( BASE = dict( domains = {