[web2py:16325] Multiple Forms Issue

2009-02-13 Thread vamaq
Hi everybody, I'm having a problem with a multiple form page. When I submit the first form (called form) I get the "user is tampering with form" error at the trace. The model is: db=SQLDB('sqlite://storage.db') db.define_table('recurso', SQLField('nombre','string',length=100,notnull=True))

[web2py:16324] download with original uploaded file name

2009-02-13 Thread Wes James
Massimo, This works as long as there is a field called 'filename' in db.py. stick this in t2.download at the bottom: return rows[0][uploadfield] else: try: row=db(db[t][f]==name).select(db[t]['filename']) response.headers['Content-D

[web2py:16323] Re: First Run on Windows Error

2009-02-13 Thread Matt
Hi Massimo, Thanks for your help, that solved it. By the way Web2Py is excellent! Makes everything so easy, if only more people had your philosophy of keeping things as simple as possible. Thanks again, Matt On Feb 13, 11:49 am, mdipierro wrote: > You have something else running on port 8000.

[web2py:16322] Re: Pre-populate simple form

2009-02-13 Thread ionel
Thank you! On Feb 13, 12:09 am, mdipierro wrote: >     form=FORM('enter your name:', INPUT(_'name',_value='John Doe'), > INPUT > (_type='submit')) > > On Feb 12, 9:40 pm, ionel wrote: > > > Hello everyone, > > > There is a way to pre-populate a simple form? > > > Ex: > > >     form=FORM('ente

[web2py:16321] Re: question about t3 session

2009-02-13 Thread drayco
Hi mdipierro, Thank's for your help. However, the problem is the same. Please, do you have other idea? On 13 feb, 12:34, mdipierro wrote: > Please one more try replace: > > def login(): return dict(form=t2.login()) > > with > > if t2.logged_in: >     cache.ram('client:%s' % t2.person_email

[web2py:16320] Possible bug with Auth using postgresql and web2py 1.56.2

2009-02-13 Thread jlegler
I just moved an app into production using a postgresql database and am having some trouble with Auth. All of the development was done against sqlite and everything is working fine in there. In fact, everything works fine against postgresql too except for registering new users. For some reason w

[web2py:16319] Re: SQLRows how to get to pieces?

2009-02-13 Thread Wes James
Actually this is the way I would like it to work. If it is just a display then no data in the db() query but if they click on a link to down load a file it does get the data :) On Fri, Feb 13, 2009 at 3:43 PM, Wes James wrote: > in t2.py - def download > > if I do: > > rows=db(db[t][f]==na

[web2py:16318] Re: SQLRows how to get to pieces?

2009-02-13 Thread Wes James
in t2.py - def download if I do: rows=db(db[t][f]==name).select() it does not get a rows[0] when used with itemize, but with an edit call it does? -wj On Fri, Feb 13, 2009 at 1:31 PM, compte...@gmail.com wrote: > > ok - i'm looking in sqlhtml.py and getting some more ideas - along > wit

[web2py:16317] Re: Modified Preorder Tree Traversal in Web2Py?

2009-02-13 Thread sociotech
Massimo, Thanks very much for your quick response and helpful code. I'm new to Web2Py, but I'm really enjoying it so far. In a way, it reminds me of the rapid development positive feedback loop I felt when I first encountered Borland's Delphi environment. Addictively fun! I'm not sure what's

[web2py:16316] Re: How to create a REST service

2009-02-13 Thread Fran
On Feb 13, 7:25 pm, Miguel Goncalves wrote: > I would like to create a RESTfull web service with web2py using JSON as the > 'encoding' format. I have a RESTlike controller documented here: https://trac.sahanapy.org/wiki/BluePrintRESTImplementation JSON POST still needs to be completed, so help

[web2py:16315] Re: SQLRows how to get to pieces?

2009-02-13 Thread compte...@gmail.com
ok - i'm looking in sqlhtml.py and getting some more ideas - along with wind-ide Where could I learn how to better access objects in python? In wing-ide, for instance it shows: rows gluon.sql.SQLRows __dict__ dict _dbgluon.sql.dict Where can I learn

[web2py:16314] SQLRows how to get to pieces?

2009-02-13 Thread Wes James
In def download(self): I have doing this: rows=db(db[t][f]==name).select() print rows.xml() print type(rows) print rows I get this: foto.idfoto.titlefoto.thumbnailfoto.imagefoto.filename foto.id,foto.title,foto.thumbnail,foto.image,foto.filena

[web2py:16313] Re: How to create a REST service

2009-02-13 Thread mdipierro
there are many dialects of rest so there are many ways to do it. You can do something like this: import gluon.contrib.simplesjon as json def delete(): ### http:///delete/1 return db(db.book.id==request.args[0]).delete() def create(): ### http:///create?fields= return db

[web2py:16312] How to create a REST service

2009-02-13 Thread Miguel Goncalves
Hi I would like to create a RESTfull web service with web2py using JSON as the 'encoding' format. Suppose I would have a model containing the following data: -book_id -title -author -brief_description and I want CRUD functions accessible through a REST web service. How would I go about that?

[web2py:16311] Re: question about t3 session

2009-02-13 Thread mdipierro
Please one more try replace: def login(): return dict(form=t2.login()) with if t2.logged_in: cache.ram('client:%s' % t2.person_email, lambda:request.client, -1) def login(): if request.vars.email: client=cache.ram('client:%s' % request.vars.email,lambda:request.client, 300)

[web2py:16310] Re: Multiple form select

2009-02-13 Thread mdipierro
you can do: options=[str(x) for x in range(10)] form=FORM(SELECT(*options,_name='test',_multiple='multiple'),INPUT (_type='submit')) or you can do: from gluon.sqlhtml import form_factory options=[str(x) for x in range(10)] form=form_factory(SQLField('test',requires=IS_IN_SET (options,multiple=T

[web2py:16309] Multiple form select

2009-02-13 Thread dewes
Hello there, I'm new at web2py, and I have a question. When making a form with FORM() how I do a ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to w

[web2py:16308] Re: jquery plugins

2009-02-13 Thread Markus Gritsch
On Fri, Feb 13, 2009 at 6:59 PM, mr.freeze wrote: > > Massimo, do you think jQuery UI should be included with web2py? According to http://jqueryui.com/download jQeuery UI complete is about 300 kB minified! Usually you build a custom UI file which only contains the UI elements you need. Markus

[web2py:16307] Re: jquery plugins

2009-02-13 Thread mr.freeze
Massimo, do you think jQuery UI should be included with web2py? BTW, with the PageManager class this works in a controller :) pagemanager.addscript(JQuery("#footer").bind("click",JFunction(JQuery ("this").hide("slow")() + JQuery("this").show("slow")() ,'e'))()) On Feb 13, 11:26 am, "mr.freeze"

[web2py:16306] Re: question about t3 session

2009-02-13 Thread mdipierro
I guess I need to try this myself before sending it. Sorry I have not done so. I will test it, debug it and get back to you. massimo On Feb 13, 11:27 am, drayco wrote: > Sorry, I tested it again and the problem is the same. > > Please, Do you have other suggestion? > > On 13 feb, 07:58, mdipier

[web2py:16305] Re: HOW TO?: two columns in a drop down

2009-02-13 Thread mdipierro
Yes format='%(first_name)s %(last_name)s' db.vote.auth_user_id.requires=IS_IN_DB(db,'auth_user.id',format) On Feb 13, 11:27 am, "Sebastian E. Ovide" wrote: > Hi All, > > with IS_IN_DB it possible to display a column of a table in a drop down, say > for example "username". In some occations it i

[web2py:16304] Re: question about t3 session

2009-02-13 Thread drayco
Sorry, I tested it again and the problem is the same. Please, Do you have other suggestion? On 13 feb, 07:58, mdipierro wrote: > My Bad. Please try this. replace the login() function > > def login(): return dict(form=t2.login()) > > with > > if t2.logged_in: >     cache.ram('client:%s' % t2.per

[web2py:16303] HOW TO?: two columns in a drop down

2009-02-13 Thread Sebastian E. Ovide
Hi All, with IS_IN_DB it possible to display a column of a table in a drop down, say for example "username". In some occations it is required to display more than one column (As we use gluon.tools.Auth, we need to display the two columns "first_name" and "last_name"). Is it possible to do that wit

[web2py:16302] Re: jquery plugins

2009-02-13 Thread mr.freeze
Okay here it is: >>>print >>>JQuery("p").bind("click",JFunction(JQuery("this").slideUp()(),'e','o'))() $('p').bind("click", function(e, o){$(this).slideUp();}); >>>print JQuery("this").slideUp()() $(this).slideUp(); class JQuery: def __init__(self,name,attr=None,*args): self.name=na

[web2py:16301] Re: jquery plugins

2009-02-13 Thread mr.freeze
Sorry, just removed the previous post because of an error. It doesn't account for jQuery function calls like slideUp(). I'll repost once fixed and rename Function to JFunction. On Feb 13, 11:13 am, mdipierro wrote: > I like it. I would call Function JFunction instead. > > Massion > > On Feb 13

[web2py:16300] Re: jquery plugins

2009-02-13 Thread mdipierro
I like it. I would call Function JFunction instead. Massion On Feb 13, 11:01 am, "mr.freeze" wrote: > What about this? '()' at the end of a JQuery statement terminates the > line (;). Also added a simple Function wrapper class. Treats 'this' as > a keyword. > > Mind you, there is a good chance

[web2py:16299] Re: mdipie...@cs.depaul.edu

2009-02-13 Thread mdipierro
I am not sure I understand the details but you can mimic the behaviour this way: language_info=str(T('english.xml')) ### the use the web2py internationalization page to translate english.xml into french.xml, etc. for the languages you support. The ":" here is a just a strick to remind you that t

[web2py:16298] Re: jquery plugins

2009-02-13 Thread mr.freeze
What about this? '()' at the end of a JQuery statement terminates the line (;). Also added a simple Function wrapper class. Treats 'this' as a keyword. Mind you, there is a good chance that these helpers are more difficult that just writing jQuery code :) So this: print JQuery('#test').click(Fun

[web2py:16297] mdipie...@cs.depaul.edu

2009-02-13 Thread Yannick
Hello mate, I have a question about the internationalization... In Java using Struts for example in the JSP file we have something like: And inside the resource application "resources.application_fr" or "resources.application_En" we have an entry for index.info so that when we switch the langua

[web2py:16295] First Run on Windows Error

2009-02-13 Thread Matt
Can anyone advise? This is the message that appears when running web2py.exe: default applications appear to be installed already web2py Enterprise Web Framework Created by Massimo Di Pierro, Copyright 2007-2009 Version 1.56.2 (2009-02-08 21:49:34) Database drivers available: SQLite3, MySQL pleas

[web2py:16296] Re: First Run on Windows Error

2009-02-13 Thread mdipierro
You have something else running on port 8000. Try a different port (8001, 8002, etc.) If it still does not work it could also be a firewall issue. Massimo On Feb 13, 10:45 am, Matt wrote: > Can anyone advise? This is the message that appears when running > web2py.exe: > > default applications

[web2py:16294] Processing.js with web2py

2009-02-13 Thread mdipierro
Exmaple of using processing JS with web2py: http://mdp.cti.depaul.edu/appliances/default/show/46 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2

[web2py:16293] Re: Modified Preorder Tree Traversal in Web2Py?

2009-02-13 Thread mdipierro
Chris, you manage to package this a little better please let me know. You could write an alterego entry about it or just post the code somewhere. Massimo On Feb 13, 10:24 am, mdipierro wrote: > Hi Chris, > > no. But it is trivial with web2py. > > Here I implemented the example > inhttp://www.s

[web2py:16292] Re: Modified Preorder Tree Traversal in Web2Py?

2009-02-13 Thread mdipierro
Hi Chris, no. But it is trivial with web2py. Here I implemented the example in http://www.sitepoint.com/print/hierarchical-data-database/ db=SQLDB('sqlite://tree.db') db.define_table('tree',db.Field('title'),db.Field ('left','integer'),db.Field('right','integer')) db.tree.insert(title='Food',l

[web2py:16291] Re: Web2py T2 T3

2009-02-13 Thread Fran
On Feb 13, 2:38 pm, Markus Gritsch wrote: > Better create a file views/default/user.html with the following content: A little nicer: http://groups.google.com/group/web2py/msg/63378d6aa3a1f62e F --~--~-~--~~~---~--~~ You received this message because you are subsc

[web2py:16289] Re: Authentication more flexible - how?

2009-02-13 Thread mdipierro
With the latest trunk this will work. On Feb 13, 9:01 am, blackthorne wrote: > Never mind my first question... > I see I can do: > return dict(form = auth.register(next="login"),form2 = auth.login > (next="index")) > > On Feb 13, 2:47 pm, blackthorne wrote: > > > Yes thank you but notice 2 diff

[web2py:16290] Modified Preorder Tree Traversal in Web2Py?

2009-02-13 Thread sociotech
Just wondering if anyone has implemented modified preorder tree traversal (MPTT) functions for Web2Py yet. MPTT is an efficient approach to organizing hierarchically-related records (e.g., nested menus, parent/child relationships, etc.) in a database. I was hoping someone here might've already im

[web2py:16288] Re: Authentication more flexible - how?

2009-02-13 Thread mdipierro
that would not work. I can change tools to make it work. Massimo On Feb 13, 9:01 am, blackthorne wrote: > Never mind my first question... > I see I can do: > return dict(form = auth.register(next="login"),form2 = auth.login > (next="index")) > > On Feb 13, 2:47 pm, blackthorne wrote: > > > Yes

[web2py:16287] Re: Authentication more flexible - how?

2009-02-13 Thread blackthorne
Never mind my first question... I see I can do: return dict(form = auth.register(next="login"),form2 = auth.login (next="index")) On Feb 13, 2:47 pm, blackthorne wrote: > Yes thank you but notice 2 different questions: > - How can you have both login and register forms in the same page? > reques

[web2py:16286] Re: Authentication more flexible - how?

2009-02-13 Thread blackthorne
Yes thank you but notice 2 different questions: - How can you have both login and register forms in the same page? request.args[0] can never be both... - If I want to add more fields to the user registration more specific to the application I want to create... how can I avoid having to create 2 f

[web2py:16285] Re: Web2py T2 T3

2009-02-13 Thread Markus Gritsch
On Fri, Feb 13, 2009 at 3:19 PM, Paul Eden wrote: > > Just remove the > > onclick="document.location='{{=URL("admin","default","design",args=request.application)}}'">admin > request > request{{=BEAUTIFY(request)}} > session > session{{=BEAUTIFY(session)}} > response > id="response">response{{=B

[web2py:16284] Re: Default field value in database based on other field

2009-02-13 Thread pigmej
Thanks for reply:) On Feb 13, 3:03 pm, mdipierro wrote: > Not yet. > > On Feb 13, 6:59 am, pigmej wrote: > > > that's an example table: > > db.define_table("test", > >                 SQLField("test1",'string'), > >                 SQLField("test2","string"), > >                ) > > > Could

[web2py:16283] Re: Web2py T2 T3

2009-02-13 Thread Paul Eden
On Fri, Feb 13, 2009 at 7:09 AM, annet wrote: > Another question: when I expose user there are four buttons: admin, > request, session and response, which when you click on them display > information I don't wish to expose to the visitor. How do I get rid of > them and what is their function? Wh

[web2py:16282] Re: Web2py T2 T3

2009-02-13 Thread annet
Hi Sebastian, Thanks for your reply, I had to read db.py again and again # # # then, to expose authentication # # http:///[app]/default/user/login # # http:///[app]/default/user/logout # # http:///[app]/default/

[web2py:16281] Re: Epydocs update

2009-02-13 Thread mdipierro
I thought I did that but does not seem to work. Working on it On Feb 13, 7:19 am, AchipA wrote: > Would it be possible to update/generate the epydocs only if there is > actual change or a stable release ? I'm updating from google svn and > every time see this huge list of epydoc files, which

[web2py:16280] Re: Web2py T2 T3

2009-02-13 Thread Fran
On Feb 13, 10:45 am, annet wrote: > Am I right to conclude that Python is T0 web2py is T1, that on top of > web2py you got T2 and T3 Yes > and that from web2py version 1.56 the > authentication, authorization and crud functionality is moved from the > T2 into tools.py? yes > I downloaded web2

[web2py:16279] Re: Default field value in database based on other field

2009-02-13 Thread mdipierro
Not yet. On Feb 13, 6:59 am, pigmej wrote: > that's an example table: > db.define_table("test", >                 SQLField("test1",'string'), >                 SQLField("test2","string"), >                ) > > Could I define default value of "test2" field based on content of > "test1" field of

[web2py:16278] Re: Web2py T2 T3

2009-02-13 Thread mdipierro
At the lowest approximation you just need from gluon.tools import * auth=Auth(globals(),db) ### (1) crud=Crud(globals(),db) ### (2) in model and def user(): return dict(form=auth()) ### (1) def data(): return dict(form=crud()) ### (2) def download(): return response.download(request,db) 1) exp

[web2py:16277] Re: question about t3 session

2009-02-13 Thread mdipierro
My Bad. Please try this. replace the login() function def login(): return dict(form=t2.login()) with if t2.logged_in: cache.ram('client:%s' % t2.person_id, lambda:request.client, 0) ### store client ip in cache def login(): if request.vars.email: client=cache.ram('client:%s' %

[web2py:16276] Epydocs update

2009-02-13 Thread AchipA
Would it be possible to update/generate the epydocs only if there is actual change or a stable release ? I'm updating from google svn and every time see this huge list of epydoc files, which only have their generation date modified... --~--~-~--~~~---~--~~ You recei

[web2py:16275] Re: Unit-testing not working in Safari and Chrome on Windows

2009-02-13 Thread dhmorgan
yes on both counts; chrome has some really nice features but there are enough instances such as this that I've gone back to Firefox as my default browser; sorry I don't know why tests behavior occurs or what can be done to correct it On Feb 13, 3:44 am, Markus Gritsch wrote: > Hi, > > when runni

[web2py:16274] Default field value in database based on other field

2009-02-13 Thread pigmej
that's an example table: db.define_table("test", SQLField("test1",'string'), SQLField("test2","string"), ) Could I define default value of "test2" field based on content of "test1" field of the same record ? Something like this ( but it doesn't work

[web2py:16273] Re: web2py server for automations

2009-02-13 Thread AchipA
This is not a simple task, you can find info on how to use AJAX with web2py both in the cookbook and in the manual pdf, with lots of examples. Yield is powerful, but you have to know about generators and iterators to use it, with setting a small Popen buffer you might get away without them (althou

[web2py:16272] Re: Web2py T2 T3

2009-02-13 Thread Sebastian E. Ovide
Hi Annet, if you follow the instructions from welcome/models/db.py and you will find that your app. serves a bunch of URLs. For example http:///[app]/default/user/login in my wellcome app is http://127.0.0.1:8000/wellcome/default/user/login etc... Sebastia

[web2py:16271] Re: web2py server for automations

2009-02-13 Thread Cro
Good day. Thank you for all your responses. It's seems that i have to AJAX the messages into the browser somehow, but i have absolutely no idea how. I am showing you the main template of any automation, maybe you can understand what i am dealing with here. # Controller file def index(): "Chec

[web2py:16270] Re: GAE bug ?

2009-02-13 Thread Sebastian E. Ovide
that is a good news, so we do not have to patch the CAS app ! Sebastian E. Ovide On Fri, Feb 13, 2009 at 3:41 AM, Robin B wrote: > > > r=db(db.cas_user.id==id).select() #OK > > r=db(db.cas_user.verification==key).select() #OK > > r=db(db.cas_user.id==id)(db.cas_user

[web2py:16269] Web2py T2 T3

2009-02-13 Thread annet
I went through the web2py manual and the Web Design Patterns and T2 Components PDF. I am happy with the way web2py is being developed, however, since I am a novice when it comes to Python an web2py, the implications of the iterations are not always clear to me. Am I right to conclude that Python

[web2py:16268] Unit-testing not working in Safari and Chrome on Windows

2009-02-13 Thread Markus Gritsch
Hi, when running the [ test ] link in appadmin for an arbitrary controller, the following page is displayed, and no progress is made: Testing application "welcome" Testing controller "default.py"... please wait! I observe this behavior only in Safari and Chrome. It works fine in Firefox and I

[web2py:16267] Re: Authentication more flexible - how?

2009-02-13 Thread Fran
On Feb 13, 3:34 am, blackthorne wrote: > How can I generate, in a single page, both login and register forms > since Auth() seems to generate them according the URL passed? All you need in the view is: {{=form}} I prefix mine with this to make it more user-friendly, which you can adapt as you l