[web2py:10109] Re: templates and for...else

2008-10-11 Thread yarko
Looks good :-) On Oct 11, 10:46 pm, billf <[EMAIL PROTECTED]> wrote: > The shortest version I can get to work is: > > {{try:}} > {{key,value=form.errors.iteritems().next()}} > {{=key}} {{=value}} > {{except:}} > {{=message}} > {{pass}} > > Bill > > On Oct 11, 11:54 pm, yarko <[EMAIL PROTECTED]> w

[web2py:10108] Re: web2py book finally online in PDF

2008-10-11 Thread vihang
Hi Massimo, If we buy from vitalsource right now, can we also get the pdf version if/when its released later or do we have to pay for that again? Thanks Vihang On Oct 10, 11:11 pm, "Phyo Arkar" <[EMAIL PROTECTED]> wrote: > Yeah i know :D > I am waiting to buy PDF version . > > If hes going to r

[web2py:10107] Re: Form Question

2008-10-11 Thread kev
Ok. Thanks for your help. On Oct 11, 7:04 pm, mdipierro <[EMAIL PROTECTED]> wrote: > I would define the form outside any action and and accept it in two > different actions. > > Massimo > > On Oct 11, 5:53 pm, kev <[EMAIL PROTECTED]> wrote: > > > Ok take facebook for example. > > > When you visit

[web2py:10106] Re: templates and for...else

2008-10-11 Thread billf
The shortest version I can get to work is: {{try:}} {{key,value=form.errors.iteritems().next()}} {{=key}} {{=value}} {{except:}} {{=message}} {{pass}} Bill On Oct 11, 11:54 pm, yarko <[EMAIL PROTECTED]> wrote: > Here's what I get with your example: > > In [1]: list=[1,2,3,54] > > I

[web2py:10105] Re: How do I prevent my functions to be exposed as actions?

2008-10-11 Thread mdipierro
You can define them in a model, mind they are executed alphbetically, or in a module and import them were needed. Massimo On Oct 11, 8:00 pm, pedro <[EMAIL PROTECTED]> wrote: > I use this thread to make another question though is not directly > related. > > Where should i define my validator cla

[web2py:10104] Re: How do I prevent my functions to be exposed as actions?

2008-10-11 Thread pedro
I use this thread to make another question though is not directly related. Where should i define my validator classes? It would be nice to have them acessible both in the database definition and in form falidation, just like the validators that come with web2py On 11 Okt, 23:41, "Phyo Arkar" <[E

[web2py:10103] Re: Form Question

2008-10-11 Thread mdipierro
I would define the form outside any action and and accept it in two different actions. Massimo On Oct 11, 5:53 pm, kev <[EMAIL PROTECTED]> wrote: > Ok take facebook for example. > > When you visit the site, see the form on the main page. Lets say the > main page is rendered by default.py. Now yo

[web2py:10102] Re: templates and for...else

2008-10-11 Thread yarko
Here's what I get with your example: In [1]: list=[1,2,3,54] In [2]: for item in list: ...: print item ...: else: ...: print "no items" ...: 1 2 3 54 no items --- Which I don' t think is what you want. If you want the first item, then try this:

[web2py:10101] Re: Form Question

2008-10-11 Thread kev
Ok take facebook for example. When you visit the site, see the form on the main page. Lets say the main page is rendered by default.py. Now you can also register not only from main page but from facebook.com/r.php. Lets say i want something like that so you can register from default.py and user/

[web2py:10099] Re: downloading files from server.

2008-10-11 Thread mdipierro
How did the files get in there? Not sure is this is what you are asking but you can do os.listdir(os.jath.join(request.folder,'static')) to get a listing. there is a sample download action in appadmin.py On Oct 11, 12:02 pm, "Phyo Arkar" <[EMAIL PROTECTED]> wrote: > Dear Masimo; > > i am now m

[web2py:10100] Re: Form Question

2008-10-11 Thread mdipierro
Not sure I understand. There is one action that generates the form, display the form, processes the form. Upon success you redirect. Then the for is gone. Are you talking about a second page of the form? Massimo On Oct 11, 12:10 pm, kev <[EMAIL PROTECTED]> wrote: > Ok than how would i put a regi

[web2py:10098] Re: How do I prevent my functions to be exposed as actions?

2008-10-11 Thread Phyo Arkar
1)def a function with a parameter 2)def __functioname__ On Sat, Oct 11, 2008 at 9:35 PM, pedro <[EMAIL PROTECTED]> wrote: > > That is the question. I guess placing them in an external module would > do it, but it should be a way to define them in a controller and > prevent them for being expos

[web2py:10097] Re: templates and for...else

2008-10-11 Thread billf
In this case I wanted the following behaviour: If there is at least one error message then display the first error message else display the page message. I just tested the template code without the {{break}} and the {{pass}} at the end and it passes the syntax check - I just get all the error me

[web2py:10096] How do I prevent my functions to be exposed as actions?

2008-10-11 Thread pedro
That is the question. I guess placing them in an external module would do it, but it should be a way to define them in a controller and prevent them for being exposed... how does one achieve that? --~--~-~--~~~---~--~~ You received this message because you are subsc

[web2py:10095] Re: templates and for...else

2008-10-11 Thread Daniel Contag
What is the "break" for? Daniel On Sat, Oct 11, 2008 at 22:50, billf <[EMAIL PROTECTED]> wrote: > > Adding a {{pass}} at the end doesn't make any difference. > > On Oct 11, 9:45 pm, billf <[EMAIL PROTECTED]> wrote: >> New to python, I believe that the following is valid syntax: >> >> for item in

[web2py:10093] templates and for...else

2008-10-11 Thread billf
New to python, I believe that the following is valid syntax: for item in list: print item else: print 'no items in list' When I put the following in a template I get a SyntaxError: invalid syntax error with "else:" highlighted: {{for key,value in form.errors.items():}} {{=key}} {{=value}} {

[web2py:10094] Re: templates and for...else

2008-10-11 Thread billf
Adding a {{pass}} at the end doesn't make any difference. On Oct 11, 9:45 pm, billf <[EMAIL PROTECTED]> wrote: > New to python, I believe that the following is valid syntax: > > for item in list: >   print item > else: >   print 'no items in list' > > When I put the following in a template I get

[web2py:10092] Re: Form Question

2008-10-11 Thread kev
Ok than how would i put a register form in the default page (which is controlled by the default.py), If register box is generated by user -> register.py. Thanks for the help, Kevin On Oct 11, 10:55 am, mdipierro <[EMAIL PROTECTED]> wrote: > This is not the way the go. Submitting forms to a diffe

[web2py:10091] downloading files from server.

2008-10-11 Thread Phyo Arkar
Dear Masimo; i am now making a file download site. Which store files in directories. WHat i would like to do is to allow list indexing of files under directory. How can i do it in web2py's cherrypy (non apache /mod_wsgi) Or need to write a separate function? Regards, Phyo. --~--~-~

[web2py:10090] Re: Dispatcher

2008-10-11 Thread mdipierro
Forget that. The more I think about this the more I convince myself it would be easier to just piggy back an onerror in route.py and not to implement it as a WSGI plugin. Implementing it as wsgi would be difficult because or routes_out. It would also require response parsing and that would make w

[web2py:10089] Re: Dispatcher

2008-10-11 Thread Timbo
The only part about what you said that I don't think I get is: --- Ideally all of the processing of routes.py should be done in a separate WSGI plugin module since there is no need to modify web2py to implement this functionality. It would be sufficient to look for web2py_error in the HTTP respon

[web2py:10088] Re: ORM to abstractly collect all data in database

2008-10-11 Thread Vidul Petrov
Hi Ed, It seems to me that the 'table' object is the small problem: div=DIV() for table_db in db.tables: div.append(H2(table_db)) table=TABLE() table.append(TR(*[TH(field) for field in db[table_db].fields])) for row in db().select(db[table_db].ALL):

[web2py:10087] Re: Form Question

2008-10-11 Thread mdipierro
This is not the way the go. Submitting forms to a different actions other than the one generating the form is not a good software engineering pattern. Forms should always self submit and redirect on success. I suggest: form=SQLFORM(...) ## no _action= if form.accepts(request.vars): redirect(

[web2py:10086] Re: ORM to abstractly collect all data in database

2008-10-11 Thread DenesL
The code is using the table object for 2 different things: 1) a table name 2) a TABLE() object Just give one of them another name, e.g.: div=DIV() for table in db.tables: div.append(H2(table)) tbl=TABLE() tbl.append(TR(*[TH(field) for field in db[table].fields])) for row in db().selec