[web2py] Re: Limitby not working with Oracle with joins

2010-02-27 Thread SergeyPo
SELECT headers1.name, alarms1.komment FROM (SELECT w_tmp.*, ROWNUM
w_row FROM (SELECT headers1.name, alarms1.komment FROM headers1,
alarms1 WHERE headers1.id=alarms1.header ORDER BY headers1.id,
alarms1.id) w_tmp WHERE ROWNUM<=5) headers1, alarms1 WHERE
headers1.id=alarms1.header AND w_row > 0;

Traceback (most recent call last):
File "c:\web2pyNEW\gluon\restricted.py", line 173, in restricted
exec ccode in environment
File "c:/web2pyNEW/applications/test/controllers/default.py", line 11,
in 
File "c:\web2pyNEW\gluon\globals.py", line 96, in 
self._caller = lambda f: f()
File "c:/web2pyNEW/applications/test/controllers/default.py", line 7,
in index
data = db(db.headers1.id==db.alarms1.header).select(db.headers1.name,
db.alarms1.komment, limitby=(0, 5))
File "c:\web2pyNEW\gluon\sql.py", line 3042, in select
rows = response(query)
File "c:\web2pyNEW\gluon\sql.py", line 3037, in response
db._execute(query)
File "c:\web2pyNEW\gluon\sql.py", line 970, in 
oracle_fix_execute(a,self._cursor.execute)
File "c:\web2pyNEW\gluon\sql.py", line 603, in oracle_fix_execute
return execute(command[:-1], args)
DatabaseError: ORA-00904: "HEADERS1"."ID": invalid identifier



On 26 фев, 21:22, Thadeus Burgess  wrote:
> please print the output of
>
> db(db.headers.id == db.alarms.header)._select(db.header.name,
> db.alarms.komment, limitby=(0,5))
>
> -Thadeus
>
>
>
> On Fri, Feb 26, 2010 at 12:00 PM, SergeyPo  wrote:
> > Limitby clause still is not working with Oracle backend when used in
> > queries that have any kind of join, left or inner.
>
> > db.define_table('headers',
> >    SQLField('name', 'string')
> > )
>
> > db.define_table('alarms',
> >    SQLField('header', db.headers),
> >    SQLField('komment', 'string')
> > )
>
> > data = db(db.headers.id == db.alarms.header).select(
> >    db.header.name, db.alarms.komment, limitby=(0, 5)
> > )
>
> > ...gives Oracle error "wrong identifier 'alarms'.'headers'
>
> > But in fact this is not matter of wrong fields, problem is with
> > limitby construction.
>
> > Queries using left join also give error, but another one. In both
> > cases error message is quite irrelevant to real problem. E.g. I need a
> > pretty complex query with groupby, count and left join... Error
> > message in this case will be 'this is not valid groupby clause'.
> > Obviously, problem is in aliases that are used for nested queries
> > required by Oracle to limit rows in result set.
>
> > Any help with DAL or workarounds please! I am ready to help with
> > testing.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.- Скрыть цитируемый текст -
>
> - Показать цитируемый текст -

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Is the web2py site down?

2010-02-27 Thread Neno
http://www.web2py.com/ doesn't seem to be responding...

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Is the web2py site down?

2010-02-27 Thread Mengu
it is up now.

On 27 Şubat, 10:30, Neno  wrote:
> http://www.web2py.com/doesn't seem to be responding...

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Is the web2py site down?

2010-02-27 Thread nakul mishra
Yes u are right.
I also checked but its not responding

On Sat, Feb 27, 2010 at 9:30 AM, Neno  wrote:

> http://www.web2py.com/ doesn't seem to be responding...
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>


-- 
Regards
Nakul

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Is the web2py site down?

2010-02-27 Thread DenesL
It works for me.

On Feb 27, 4:17 am, nakul mishra  wrote:
> Yes u are right.
> I also checked but its not responding
>
> On Sat, Feb 27, 2010 at 9:30 AM, Neno  wrote:
> >http://www.web2py.com/doesn't seem to be responding...
>
> --
> Regards
> Nakul

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Cron issue with recent web2py?

2010-02-27 Thread Magnitus
Running on Windows Vista here.

I notice that the CPU spikes at about 60% for a fraction of a second
every minute or so, but it does that whether web2py is running or not
(probably my anti-virus or another process running in the background).

I don't notice multiple python processes spawning or the running
python process creating more threads for that matter.

But then again, I'm running simple test modifications off the original
sample in section 3 of the manual so I'm not using anything fancy
yet...

On Feb 26, 8:50 pm, Iceberg  wrote:
> Well, I didn't have enough investigation yet, just posting a quick
> question here.
>
> Does anybody else who, upgraded to recent 1.75.x version of web2py,
> running it in on Windows, and notice that it starts 5 more python
> processes at the beginning of every minute, last for about 10 seconds?
> During that 10 seconds, my CPU usage percentage reaches 100%, and even
> slow to react normal use. I can tolerant that on my laptop with
> WindowsXP as a developing environment, don't know yet whether it will
> be same on my linux production server.
>
> Of course, when using web2py -N is merely a workaround, I tried that.
> But that is not a real solution to the problem. :-/
>
> Regards,
> Iceberg

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Ladies and Gentelmen... the web2py book is online

2010-02-27 Thread mdmcginn
When I try to register, I get a flash "Unable to send email"

On Feb 15, 9:20 am, mdipierro  wrote:
> Create a wiki page under preface callederrata. It would be nice if
> somebody where to move overerratafrom wiki.web2py.com.
> As people fix these problems, we'll mark theerrataentries as fixed.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Is the web2py site down?

2010-02-27 Thread ionel anton
It doesn't work for me :(

On Feb 27, 6:15 am, DenesL  wrote:
> It works for me.
>
> On Feb 27, 4:17 am, nakul mishra  wrote:
>
> > Yes u are right.
> > I also checked but its not responding
>
> > On Sat, Feb 27, 2010 at 9:30 AM, Neno  wrote:
> > >http://www.web2py.com/doesn'tseem to be responding...
>
> > --
> > Regards
> > Nakul

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Is the web2py site down?

2010-02-27 Thread Neno
Same here, still down.

On Feb 27, 7:24 am, ionel anton  wrote:
> It doesn't work for me :(
>
> On Feb 27, 6:15 am, DenesL  wrote:
>
>
>
> > It works for me.
>
> > On Feb 27, 4:17 am, nakul mishra  wrote:
>
> > > Yes u are right.
> > > I also checked but its not responding
>
> > > On Sat, Feb 27, 2010 at 9:30 AM, Neno  wrote:
> > > >http://www.web2py.com/doesn'tseemto be responding...
>
> > > --
> > > Regards
> > > Nakul

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Is the web2py site down?

2010-02-27 Thread Brian M
Yep, down - noticed it was down last night too, so it's been like
12hrs!

http://downforeveryoneorjustme.com/web2py.com


On Feb 27, 9:37 am, Neno  wrote:
> Same here, still down.
>
> On Feb 27, 7:24 am, ionel anton  wrote:
>
>
>
> > It doesn't work for me :(
>
> > On Feb 27, 6:15 am, DenesL  wrote:
>
> > > It works for me.
>
> > > On Feb 27, 4:17 am, nakul mishra  wrote:
>
> > > > Yes u are right.
> > > > I also checked but its not responding
>
> > > > On Sat, Feb 27, 2010 at 9:30 AM, Neno  wrote:
> > > > >http://www.web2py.com/doesn'tseemtobe responding...
>
> > > > --
> > > > Regards
> > > > Nakul

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Limitby not working with Oracle with joins

2010-02-27 Thread Thadeus Burgess
Just going out on a limb here.

Have you tried the query where it selects all columns instead of just
name and komment?

-Thadeus





2010/2/27 SergeyPo :
> SELECT headers1.name, alarms1.komment FROM (SELECT w_tmp.*, ROWNUM
> w_row FROM (SELECT headers1.name, alarms1.komment FROM headers1,
> alarms1 WHERE headers1.id=alarms1.header ORDER BY headers1.id,
> alarms1.id) w_tmp WHERE ROWNUM<=5) headers1, alarms1 WHERE
> headers1.id=alarms1.header AND w_row > 0;
>
> Traceback (most recent call last):
> File "c:\web2pyNEW\gluon\restricted.py", line 173, in restricted
> exec ccode in environment
> File "c:/web2pyNEW/applications/test/controllers/default.py", line 11,
> in 
> File "c:\web2pyNEW\gluon\globals.py", line 96, in 
> self._caller = lambda f: f()
> File "c:/web2pyNEW/applications/test/controllers/default.py", line 7,
> in index
> data = db(db.headers1.id==db.alarms1.header).select(db.headers1.name,
> db.alarms1.komment, limitby=(0, 5))
> File "c:\web2pyNEW\gluon\sql.py", line 3042, in select
> rows = response(query)
> File "c:\web2pyNEW\gluon\sql.py", line 3037, in response
> db._execute(query)
> File "c:\web2pyNEW\gluon\sql.py", line 970, in 
> oracle_fix_execute(a,self._cursor.execute)
> File "c:\web2pyNEW\gluon\sql.py", line 603, in oracle_fix_execute
> return execute(command[:-1], args)
> DatabaseError: ORA-00904: "HEADERS1"."ID": invalid identifier
>
>
>
> On 26 фев, 21:22, Thadeus Burgess  wrote:
>> please print the output of
>>
>> db(db.headers.id == db.alarms.header)._select(db.header.name,
>> db.alarms.komment, limitby=(0,5))
>>
>> -Thadeus
>>
>>
>>
>> On Fri, Feb 26, 2010 at 12:00 PM, SergeyPo  wrote:
>> > Limitby clause still is not working with Oracle backend when used in
>> > queries that have any kind of join, left or inner.
>>
>> > db.define_table('headers',
>> >    SQLField('name', 'string')
>> > )
>>
>> > db.define_table('alarms',
>> >    SQLField('header', db.headers),
>> >    SQLField('komment', 'string')
>> > )
>>
>> > data = db(db.headers.id == db.alarms.header).select(
>> >    db.header.name, db.alarms.komment, limitby=(0, 5)
>> > )
>>
>> > ...gives Oracle error "wrong identifier 'alarms'.'headers'
>>
>> > But in fact this is not matter of wrong fields, problem is with
>> > limitby construction.
>>
>> > Queries using left join also give error, but another one. In both
>> > cases error message is quite irrelevant to real problem. E.g. I need a
>> > pretty complex query with groupby, count and left join... Error
>> > message in this case will be 'this is not valid groupby clause'.
>> > Obviously, problem is in aliases that are used for nested queries
>> > required by Oracle to limit rows in result set.
>>
>> > Any help with DAL or workarounds please! I am ready to help with
>> > testing.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/web2py?hl=en.- Скрыть цитируемый текст -
>>
>> - Показать цитируемый текст -
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Limitby not working with Oracle with joins

2010-02-27 Thread SergeyPo
If you remove limitby it works. I reported this error about 6 months
ago, tried many workarounds and thought we fixed it. But somehow it
appeared at my client's site. Versions 1.65 and current 1.75
downloaded this week.

On Feb 27, 8:20 pm, Thadeus Burgess  wrote:
> Just going out on a limb here.
>
> Have you tried the query where it selects all columns instead of just
> name and komment?
>
> -Thadeus
>
> 2010/2/27 SergeyPo :
>
>
>
> > SELECT headers1.name, alarms1.komment FROM (SELECT w_tmp.*, ROWNUM
> > w_row FROM (SELECT headers1.name, alarms1.komment FROM headers1,
> > alarms1 WHERE headers1.id=alarms1.header ORDER BY headers1.id,
> > alarms1.id) w_tmp WHERE ROWNUM<=5) headers1, alarms1 WHERE
> > headers1.id=alarms1.header AND w_row > 0;
>
> > Traceback (most recent call last):
> > File "c:\web2pyNEW\gluon\restricted.py", line 173, in restricted
> > exec ccode in environment
> > File "c:/web2pyNEW/applications/test/controllers/default.py", line 11,
> > in 
> > File "c:\web2pyNEW\gluon\globals.py", line 96, in 
> > self._caller = lambda f: f()
> > File "c:/web2pyNEW/applications/test/controllers/default.py", line 7,
> > in index
> > data = db(db.headers1.id==db.alarms1.header).select(db.headers1.name,
> > db.alarms1.komment, limitby=(0, 5))
> > File "c:\web2pyNEW\gluon\sql.py", line 3042, in select
> > rows = response(query)
> > File "c:\web2pyNEW\gluon\sql.py", line 3037, in response
> > db._execute(query)
> > File "c:\web2pyNEW\gluon\sql.py", line 970, in 
> > oracle_fix_execute(a,self._cursor.execute)
> > File "c:\web2pyNEW\gluon\sql.py", line 603, in oracle_fix_execute
> > return execute(command[:-1], args)
> > DatabaseError: ORA-00904: "HEADERS1"."ID": invalid identifier
>
> > On 26 фев, 21:22, Thadeus Burgess  wrote:
> >> please print the output of
>
> >> db(db.headers.id == db.alarms.header)._select(db.header.name,
> >> db.alarms.komment, limitby=(0,5))
>
> >> -Thadeus
>
> >> On Fri, Feb 26, 2010 at 12:00 PM, SergeyPo  wrote:
> >> > Limitby clause still is not working with Oracle backend when used in
> >> > queries that have any kind of join, left or inner.
>
> >> > db.define_table('headers',
> >> >    SQLField('name', 'string')
> >> > )
>
> >> > db.define_table('alarms',
> >> >    SQLField('header', db.headers),
> >> >    SQLField('komment', 'string')
> >> > )
>
> >> > data = db(db.headers.id == db.alarms.header).select(
> >> >    db.header.name, db.alarms.komment, limitby=(0, 5)
> >> > )
>
> >> > ...gives Oracle error "wrong identifier 'alarms'.'headers'
>
> >> > But in fact this is not matter of wrong fields, problem is with
> >> > limitby construction.
>
> >> > Queries using left join also give error, but another one. In both
> >> > cases error message is quite irrelevant to real problem. E.g. I need a
> >> > pretty complex query with groupby, count and left join... Error
> >> > message in this case will be 'this is not valid groupby clause'.
> >> > Obviously, problem is in aliases that are used for nested queries
> >> > required by Oracle to limit rows in result set.
>
> >> > Any help with DAL or workarounds please! I am ready to help with
> >> > testing.
>
> >> > --
> >> > You received this message because you are subscribed to the Google 
> >> > Groups "web2py-users" group.
> >> > To post to this group, send email to web...@googlegroups.com.
> >> > To unsubscribe from this group, send email to 
> >> > web2py+unsubscr...@googlegroups.com.
> >> > For more options, visit this group 
> >> > athttp://groups.google.com/group/web2py?hl=en.-Скрыть цитируемый текст -
>
> >> - Показать цитируемый текст -
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Iterate through form input

2010-02-27 Thread Yarko Tymciurak
You can accomplish this with a text field - you then parse the input.

You can see a (somewhat messy - as it evolved incrementally over several
manual efforts - and really needs some refactoring into smaller functions) -
in the batch registration processing for PyCon 2010:   I wanted to take a
list of applicants:   First_name, last_name, email, and optionally city,
state.   I used the collections namedtuple library to validate the basic
fields, then added table field validation.

Normally, you can just use FORM.factory to build up forms with fields that
contain tables (or parts of tables), and other fields.   I needed to do more
validation, so I just made a memory based database table.   You may be able
to do a much simpler  text field, and process similarly to how you see it in
the batch code.

I apologize in advance for the messiness of that code (it is not really
ready for reading / consumption - if I had more time, I would have cleaned
up the code, made it cleaner):

http://code.google.com/p/web2conf/source/browse/applications/register/controllers/batch.py?repo=pycon2010

- Yarko


On Fri, Feb 26, 2010 at 4:11 PM, Thadeus Burgess 
wrote:
Unfortunately you will not be able to "add" fields when using FORM.
You will have to iterate over the request.vars manually.

-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Web2py Scalability and demos

2010-02-27 Thread waTR
If you want to ensure your site works flawlesly and can scale, build
it to work on the cloud. Check out this video for interesting info
about what to watch out for:
http://pycon.blip.tv/file/3257303/
http://us.pycon.org/2010/conference/schedule/event/148/

There is also this:
http://pycon.blip.tv/file/3261223/




On Feb 26, 3:10 pm, Alfonso de la Guarda  wrote:
> Massimo,
>
> I will try to make some tests about performance, however: what is
> about big 'sites' which currently are using web2py, any information?
> By the way, i have read about a trip to Argentina in september for a
> conference, maybe you can stop in Peru.
>
> Saludos,
>
> 
> Alfonso de la Guarda
> Centro Open Source(COS)http://www.cos-la.nethttp://alfonsodg.net
>    Telef. 991935157
> 1024D/B23B24A4
> 5469 ED92 75A3 BBDB FD6B  58A5 54A1 851D B23B 24A4
>
> On Thu, Feb 25, 2010 at 23:36, mdipierro  wrote:
> > In general the bottleneck is the database access. The web2py DAL adds
> > negligible overhead to that
>
> >  http://web2py.com/AlterEgo/default/show/76
>
> > People have tested web2py vs Pylons (which people says it is faster
> > than Django and reddit.com uses it):
>
> >  http://www.mail-archive.com/web2py@googlegroups.com/msg04120.html
>
> > (these kind of results really depend on the app).
>
> > If you use the internal web server, web2py  uses cherrypy's which is
> > faster than the others python ones.
>
> >  http://www.rkblog.rk.edu.pl/w/p/simple-python-frameworks-benchmark/
>
> > (this is going to change since Tim wrote Rocket that is better than
> > Cherrypy's and we are about to move to it).
>
> > It would be nice to run more benchmarks.
>
> > Massimo
>
> > On Feb 25, 8:42 pm, Alfonso de la Guarda  wrote:
> >> Hello,
>
> >> Right now, i have a costumer in the news business in my country which
> >> expect, at least, 50 hits by day in their website.  Currently they
> >> are using django as web framework but i wanna move some new apps to
> >> web2py.  The questions are:
>
> >> How can I convince them to agree to take the course for new projects 
> >> web2py?
> >> There are statistics from sites with similar traffic web2py currently 
> >> employing?
> >> There is documentation of performance benchmarks among web2py, django,
> >> ROR or PHP?
> >> Someone has information, or has gone through the same problem?
>
> >> (A clarification: we have now developed small applications, but in
> >> this case we speak of a large number of hits per day and that means
> >> making a decision technically supported)
>
> >> Thanks in advance,
>
> >> 
> >> Alfonso de la Guarda
> >> Centro Open Source(COS)http://www.cos-la.nethttp://alfonsodg.net
> >>    Telef. 991935157
> >> 1024D/B23B24A4
> >> 5469 ED92 75A3 BBDB FD6B  58A5 54A1 851D B23B 24A4
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: mail sending no functioning from Chrome

2010-02-27 Thread Jonathan Lundell
On Feb 26, 2010, at 8:52 AM, LBarret wrote:

> It depends on the browser.
> 
> IE8, FF/Linux, FF/Windows do the checks (like if the email is a real
> email)
> Chrome/Linux, Chrome/Windows don't .
> 
> I get the emails from FF & IE, not from chrome.
> 
> I don't have any errors due to this behavior.

The checks are happening on the server side, of course.

If you redirect, you need to put your message in session.flash, not 
response.flash. 

Try putting a message in response.flash after the accepts section to give you 
an indication of what's going on.

In the failing case, are you redirecting? It might help to see the rest of the 
function.

> 
> L.
> 
> 
> 
> 
> On Feb 26, 5:32 pm, szimszon  wrote:
>> What is the output? Any error message? Form is accepted?
>> 
>> On febr. 26, 17:16, LBarret  wrote:
>> 
>> 
>> 
>>> This code works under FF not under Chrome (5.0.330.0 (39184) Ubuntu ).
>> 
>>> 
>>> form = FORM(
>>>LABEL("Get our monthly
>>> newsletter:",_class="InputCaption", _id="NL"),
>> 
>>> INPUT(id="Email",_class="RegistrarInput",_name="email",size="25",maxlength= 
>>> "50",value="Enter
>>> your email here",_onfocus="this.value=''",_type="text",
>>>requires=IS_EMAIL()),
>>>INPUT(_type="submit",_name="Send",value="submit",
>>> text="ok"),
>>>_id="NL"
>>> )
>>> if form.accepts(request.vars, session):
>>> response.flash="form accepted"
>>> email= "Email: %s"%( form.vars.email)
>>> #==
>>> mail.send( to=['cont...@gamr7.com'],
>>>subject='newsletter inscription',
>>>message=email)
>>> redirect(URL(r=request,f='index'))
>>> 
>> 
>>> something to do with the redirect ?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
> 


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] webform actions

2010-02-27 Thread Tomas Pelka
Hi all,

have some troubles with web form which have more than one button. It is
obvious that one button (action connected with button) correspond with
one function.

According manual this should work:
controler
-
def index():
  form = FORM('blah blah',
INPUT(_type='submit', _value='Apply'),
INPUT(_type='submit', _value='Reset', _action=URL(r=request,
f='reset'),
INPUT(_type='submit', _value='Reset all', _action=URL(r=request,
f='reset_all'))
  if form.accepts(request.vars, session):
pass
  elif form.errors:
response.flash = 'Error'
  else:
pass
  return dict(form=form)


def reset():
if form.accepts(request.vars, formname=None):
response.flash = 'Reset'
elif form.errors:
response.flash = 'Error'
else:
pass
return dict()


def reset_all():
if form.accepts(request.vars, formname=None):
response.flash = 'Resert all'
elif form.errors:
response.flash = 'Error'
else:
pass
return dict()

But action functions (reset, reset_all) will not call. Am I doing
anything wrong?

Thanks for advice,
cheers

-- 
Tom

Key fingerprint = 06C0 23C6 9EB7 0761 9807  65F4 7F6F 7EAB 496B 28AA

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] webform actions

2010-02-27 Thread Tiago Almeida
Don't know why functions reset, reset_all are not called but they reference
a "form" variable which is not in scope? Do you have any global "form"?

Regards,
Tiago
--

On Sat, Feb 27, 2010 at 10:15 PM, Tomas Pelka  wrote:

> Hi all,
>
> have some troubles with web form which have more than one button. It is
> obvious that one button (action connected with button) correspond with
> one function.
>
> According manual this should work:
> controler
> -
> def index():
>  form = FORM('blah blah',
>INPUT(_type='submit', _value='Apply'),
>INPUT(_type='submit', _value='Reset', _action=URL(r=request,
> f='reset'),
>INPUT(_type='submit', _value='Reset all', _action=URL(r=request,
> f='reset_all'))
>  if form.accepts(request.vars, session):
>pass
>  elif form.errors:
>response.flash = 'Error'
>  else:
>pass
>  return dict(form=form)
>
>
> def reset():
>if form.accepts(request.vars, formname=None):
>response.flash = 'Reset'
>elif form.errors:
>response.flash = 'Error'
>else:
>pass
>return dict()
>
>
> def reset_all():
>if form.accepts(request.vars, formname=None):
>response.flash = 'Resert all'
>elif form.errors:
>response.flash = 'Error'
>else:
>pass
>return dict()
>
> But action functions (reset, reset_all) will not call. Am I doing
> anything wrong?
>
> Thanks for advice,
> cheers
>
> --
> Tom
>
> Key fingerprint = 06C0 23C6 9EB7 0761 9807  65F4 7F6F 7EAB 496B 28AA
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] webform actions

2010-02-27 Thread Jonathan Lundell
On Feb 27, 2010, at 3:00 PM, Tiago Almeida wrote:

> Don't know why functions reset, reset_all are not called but they reference a 
> "form" variable which is not in scope? Do you have any global "form"?

The logic below can't work, for lots of reasons.

One is the one Tiago mentions. Another is that input elements do not have 
action attributes; forms do. There are ways to accomplish this kind of thing; 
most of them involve JavaScript.

This might be helpful (though it's not the way I'd do it): 
http://www.javascript-coder.com/html-form/html-form-submit.phtml

> 
> Regards,
> Tiago
> --
> 
> On Sat, Feb 27, 2010 at 10:15 PM, Tomas Pelka  wrote:
> Hi all,
> 
> have some troubles with web form which have more than one button. It is
> obvious that one button (action connected with button) correspond with
> one function.
> 
> According manual this should work:
> controler
> -
> def index():
>  form = FORM('blah blah',
>INPUT(_type='submit', _value='Apply'),
>INPUT(_type='submit', _value='Reset', _action=URL(r=request,
> f='reset'),
>INPUT(_type='submit', _value='Reset all', _action=URL(r=request,
> f='reset_all'))
>  if form.accepts(request.vars, session):
>pass
>  elif form.errors:
>response.flash = 'Error'
>  else:
>pass
>  return dict(form=form)
> 
> 
> def reset():
>if form.accepts(request.vars, formname=None):
>response.flash = 'Reset'
>elif form.errors:
>response.flash = 'Error'
>else:
>pass
>return dict()
> 
> 
> def reset_all():
>if form.accepts(request.vars, formname=None):
>response.flash = 'Resert all'
>elif form.errors:
>response.flash = 'Error'
>else:
>pass
>return dict()
> 
> But action functions (reset, reset_all) will not call. Am I doing
> anything wrong?
> 
> Thanks for advice,
> cheers
> 
> --
> Tom
> 
> Key fingerprint = 06C0 23C6 9EB7 0761 9807  65F4 7F6F 7EAB 496B 28AA
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
> 


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] webform actions

2010-02-27 Thread Thadeus Burgess
If your running the latest version of web2py, look at
controllers/appadmin.py in ccache function. It defines a form with
three buttons, (one toc lear ram, one to clear disk, and one to clear
both). Click the different submit button executes the appropriate
function.

-Thadeus





On Sat, Feb 27, 2010 at 5:08 PM, Jonathan Lundell  wrote:
> On Feb 27, 2010, at 3:00 PM, Tiago Almeida wrote:
>
> Don't know why functions reset, reset_all are not called but they reference
> a "form" variable which is not in scope? Do you have any global "form"?
>
> The logic below can't work, for lots of reasons.
> One is the one Tiago mentions. Another is that input elements do not have
> action attributes; forms do. There are ways to accomplish this kind of
> thing; most of them involve JavaScript.
> This might be helpful (though it's not the way I'd do
> it): http://www.javascript-coder.com/html-form/html-form-submit.phtml
>
> Regards,
> Tiago
> --
>
> On Sat, Feb 27, 2010 at 10:15 PM, Tomas Pelka  wrote:
>>
>> Hi all,
>>
>> have some troubles with web form which have more than one button. It is
>> obvious that one button (action connected with button) correspond with
>> one function.
>>
>> According manual this should work:
>> controler
>> -
>> def index():
>>  form = FORM('blah blah',
>>        INPUT(_type='submit', _value='Apply'),
>>        INPUT(_type='submit', _value='Reset', _action=URL(r=request,
>> f='reset'),
>>        INPUT(_type='submit', _value='Reset all', _action=URL(r=request,
>> f='reset_all'))
>>  if form.accepts(request.vars, session):
>>        pass
>>  elif form.errors:
>>        response.flash = 'Error'
>>  else:
>>        pass
>>  return dict(form=form)
>>
>>
>> def reset():
>>    if form.accepts(request.vars, formname=None):
>>        response.flash = 'Reset'
>>    elif form.errors:
>>        response.flash = 'Error'
>>    else:
>>        pass
>>    return dict()
>>
>>
>> def reset_all():
>>    if form.accepts(request.vars, formname=None):
>>        response.flash = 'Resert all'
>>    elif form.errors:
>>        response.flash = 'Error'
>>    else:
>>        pass
>>    return dict()
>>
>> But action functions (reset, reset_all) will not call. Am I doing
>> anything wrong?
>>
>> Thanks for advice,
>> cheers
>>
>> --
>> Tom
>>
>> Key fingerprint = 06C0 23C6 9EB7 0761 9807  65F4 7F6F 7EAB 496B 28AA
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/web2py?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] webform actions

2010-02-27 Thread Jonathan Lundell
On Feb 27, 2010, at 4:03 PM, Thadeus Burgess wrote:

> If your running the latest version of web2py, look at
> controllers/appadmin.py in ccache function. It defines a form with
> three buttons, (one toc lear ram, one to clear disk, and one to clear
> both). Click the different submit button executes the appropriate
> function.

A caveat, though: this approach is problematical if the form has a text input 
field and the user submits the form by typing return in an input field, rather 
than clicking a button.

The problem as I understand it is that in that case you're not guaranteed which 
button is returned. The culprit (no surprise) is IE. So if Tom's form gets 
submitted by a return in a text field, and the browser is IE, he presumably 
wants to see the Apply button, but might see one of the reset buttons 
instead--not what the user intended.

My approach is to use one submit button, and to make the other buttons 
type=button, with an onclick script to reinvoke the same controller with a 
button ID in vars. You'll typically check for that at the beginning of the 
controller.

I've been using it for a cancel button, as well as some application-specific 
functions, and it seems to work well.

> 
> -Thadeus
> 
> 
> 
> 
> 
> On Sat, Feb 27, 2010 at 5:08 PM, Jonathan Lundell  wrote:
>> On Feb 27, 2010, at 3:00 PM, Tiago Almeida wrote:
>> 
>> Don't know why functions reset, reset_all are not called but they reference
>> a "form" variable which is not in scope? Do you have any global "form"?
>> 
>> The logic below can't work, for lots of reasons.
>> One is the one Tiago mentions. Another is that input elements do not have
>> action attributes; forms do. There are ways to accomplish this kind of
>> thing; most of them involve JavaScript.
>> This might be helpful (though it's not the way I'd do
>> it): http://www.javascript-coder.com/html-form/html-form-submit.phtml
>> 
>> Regards,
>> Tiago
>> --
>> 
>> On Sat, Feb 27, 2010 at 10:15 PM, Tomas Pelka  wrote:
>>> 
>>> Hi all,
>>> 
>>> have some troubles with web form which have more than one button. It is
>>> obvious that one button (action connected with button) correspond with
>>> one function.
>>> 
>>> According manual this should work:
>>> controler
>>> -
>>> def index():
>>>  form = FORM('blah blah',
>>>INPUT(_type='submit', _value='Apply'),
>>>INPUT(_type='submit', _value='Reset', _action=URL(r=request,
>>> f='reset'),
>>>INPUT(_type='submit', _value='Reset all', _action=URL(r=request,
>>> f='reset_all'))
>>>  if form.accepts(request.vars, session):
>>>pass
>>>  elif form.errors:
>>>response.flash = 'Error'
>>>  else:
>>>pass
>>>  return dict(form=form)
>>> 
>>> 
>>> def reset():
>>>if form.accepts(request.vars, formname=None):
>>>response.flash = 'Reset'
>>>elif form.errors:
>>>response.flash = 'Error'
>>>else:
>>>pass
>>>return dict()
>>> 
>>> 
>>> def reset_all():
>>>if form.accepts(request.vars, formname=None):
>>>response.flash = 'Resert all'
>>>elif form.errors:
>>>response.flash = 'Error'
>>>else:
>>>pass
>>>return dict()
>>> 
>>> But action functions (reset, reset_all) will not call. Am I doing
>>> anything wrong?
>>> 
>>> Thanks for advice,
>>> cheers
>>> 
>>> --
>>> Tom
>>> 
>>> Key fingerprint = 06C0 23C6 9EB7 0761 9807  65F4 7F6F 7EAB 496B 28AA


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: webform actions

2010-02-27 Thread mr.freeze
Why not just do this?:

def index():
form = FORM('blah blah',
INPUT(_type='submit', _value='Apply',_name="apply"),
INPUT(_type='submit', _value='Reset',_name="reset"),
INPUT(_type='submit', _value='Reset
all',_name="resetall"))
if request.vars.apply:
pass #apply was clicked
elif request.vars.reset:
pass #reset was clicked
elif request.vars.resetall:
pass #resetall was clicked


On Feb 27, 6:30 pm, Jonathan Lundell  wrote:
> On Feb 27, 2010, at 4:03 PM, Thadeus Burgess wrote:
>
> > If your running the latest version of web2py, look at
> > controllers/appadmin.py in ccache function. It defines a form with
> > three buttons, (one toc lear ram, one to clear disk, and one to clear
> > both). Click the different submit button executes the appropriate
> > function.
>
> A caveat, though: this approach is problematical if the form has a text input 
> field and the user submits the form by typing return in an input field, 
> rather than clicking a button.
>
> The problem as I understand it is that in that case you're not guaranteed 
> which button is returned. The culprit (no surprise) is IE. So if Tom's form 
> gets submitted by a return in a text field, and the browser is IE, he 
> presumably wants to see the Apply button, but might see one of the reset 
> buttons instead--not what the user intended.
>
> My approach is to use one submit button, and to make the other buttons 
> type=button, with an onclick script to reinvoke the same controller with a 
> button ID in vars. You'll typically check for that at the beginning of the 
> controller.
>
> I've been using it for a cancel button, as well as some application-specific 
> functions, and it seems to work well.
>
>
>
> > -Thadeus
>
> > On Sat, Feb 27, 2010 at 5:08 PM, Jonathan Lundell  
> > wrote:
> >> On Feb 27, 2010, at 3:00 PM, Tiago Almeida wrote:
>
> >> Don't know why functions reset, reset_all are not called but they reference
> >> a "form" variable which is not in scope? Do you have any global "form"?
>
> >> The logic below can't work, for lots of reasons.
> >> One is the one Tiago mentions. Another is that input elements do not have
> >> action attributes; forms do. There are ways to accomplish this kind of
> >> thing; most of them involve JavaScript.
> >> This might be helpful (though it's not the way I'd do
> >> it):http://www.javascript-coder.com/html-form/html-form-submit.phtml
>
> >> Regards,
> >> Tiago
> >> --
>
> >> On Sat, Feb 27, 2010 at 10:15 PM, Tomas Pelka  wrote:
>
> >>> Hi all,
>
> >>> have some troubles with web form which have more than one button. It is
> >>> obvious that one button (action connected with button) correspond with
> >>> one function.
>
> >>> According manual this should work:
> >>> controler
> >>> -
> >>> def index():
> >>>  form = FORM('blah blah',
> >>>        INPUT(_type='submit', _value='Apply'),
> >>>        INPUT(_type='submit', _value='Reset', _action=URL(r=request,
> >>> f='reset'),
> >>>        INPUT(_type='submit', _value='Reset all', _action=URL(r=request,
> >>> f='reset_all'))
> >>>  if form.accepts(request.vars, session):
> >>>        pass
> >>>  elif form.errors:
> >>>        response.flash = 'Error'
> >>>  else:
> >>>        pass
> >>>  return dict(form=form)
>
> >>> def reset():
> >>>    if form.accepts(request.vars, formname=None):
> >>>        response.flash = 'Reset'
> >>>    elif form.errors:
> >>>        response.flash = 'Error'
> >>>    else:
> >>>        pass
> >>>    return dict()
>
> >>> def reset_all():
> >>>    if form.accepts(request.vars, formname=None):
> >>>        response.flash = 'Resert all'
> >>>    elif form.errors:
> >>>        response.flash = 'Error'
> >>>    else:
> >>>        pass
> >>>    return dict()
>
> >>> But action functions (reset, reset_all) will not call. Am I doing
> >>> anything wrong?
>
> >>> Thanks for advice,
> >>> cheers
>
> >>> --
> >>> Tom
>
> >>> Key fingerprint = 06C0 23C6 9EB7 0761 9807  65F4 7F6F 7EAB 496B 28AA
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] translation of the online book

2010-02-27 Thread Vidul Petrov
Hi all,

Some days ago I was happy to found out the online book, thank you
Massimo!

My intention is to translate it in Bulgarian.
Which is the best way to do this (probably there is a read / write
repository for the website, but I didn't find a link for it)?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: webform actions

2010-02-27 Thread Iceberg
I think Jonathan have given enough reason of why not.  There is
another post to discuss the same thing. 
http://groups.google.com/group/web2py/msg/79c1f847890a6b60

In short, do resist the temptation of using multiple submit buttons,
pal. :)

On Feb28, 9:36am, "mr.freeze"  wrote:
> Why not just do this?:
>
> def index():
>     form = FORM('blah blah',
>             INPUT(_type='submit', _value='Apply',_name="apply"),
>             INPUT(_type='submit', _value='Reset',_name="reset"),
>             INPUT(_type='submit', _value='Reset
> all',_name="resetall"))
>     if request.vars.apply:
>         pass #apply was clicked
>     elif request.vars.reset:
>         pass #reset was clicked
>     elif request.vars.resetall:
>         pass #resetall was clicked
>
> On Feb 27, 6:30 pm, Jonathan Lundell  wrote:
>
>
>
> > On Feb 27, 2010, at 4:03 PM, Thadeus Burgess wrote:
>
> > > If your running the latest version of web2py, look at
> > > controllers/appadmin.py in ccache function. It defines a form with
> > > three buttons, (one toc lear ram, one to clear disk, and one to clear
> > > both). Click the different submit button executes the appropriate
> > > function.
>
> > A caveat, though: this approach is problematical if the form has a text 
> > input field and the user submits the form by typing return in an input 
> > field, rather than clicking a button.
>
> > The problem as I understand it is that in that case you're not guaranteed 
> > which button is returned. The culprit (no surprise) is IE. So if Tom's form 
> > gets submitted by a return in a text field, and the browser is IE, he 
> > presumably wants to see the Apply button, but might see one of the reset 
> > buttons instead--not what the user intended.
>
> > My approach is to use one submit button, and to make the other buttons 
> > type=button, with an onclick script to reinvoke the same controller with a 
> > button ID in vars. You'll typically check for that at the beginning of the 
> > controller.
>
> > I've been using it for a cancel button, as well as some 
> > application-specific functions, and it seems to work well.
>
> > > -Thadeus
>
> > > On Sat, Feb 27, 2010 at 5:08 PM, Jonathan Lundell  
> > > wrote:
> > >> On Feb 27, 2010, at 3:00 PM, Tiago Almeida wrote:
>
> > >> Don't know why functions reset, reset_all are not called but they 
> > >> reference
> > >> a "form" variable which is not in scope? Do you have any global "form"?
>
> > >> The logic below can't work, for lots of reasons.
> > >> One is the one Tiago mentions. Another is that input elements do not have
> > >> action attributes; forms do. There are ways to accomplish this kind of
> > >> thing; most of them involve JavaScript.
> > >> This might be helpful (though it's not the way I'd do
> > >> it):http://www.javascript-coder.com/html-form/html-form-submit.phtml
>
> > >> Regards,
> > >> Tiago
> > >> --
>
> > >> On Sat, Feb 27, 2010 at 10:15 PM, Tomas Pelka  wrote:
>
> > >>> Hi all,
>
> > >>> have some troubles with web form which have more than one button. It is
> > >>> obvious that one button (action connected with button) correspond with
> > >>> one function.
>
> > >>> According manual this should work:
> > >>> controler
> > >>> -
> > >>> def index():
> > >>>  form = FORM('blah blah',
> > >>>        INPUT(_type='submit', _value='Apply'),
> > >>>        INPUT(_type='submit', _value='Reset', _action=URL(r=request,
> > >>> f='reset'),
> > >>>        INPUT(_type='submit', _value='Reset all', _action=URL(r=request,
> > >>> f='reset_all'))
> > >>>  if form.accepts(request.vars, session):
> > >>>        pass
> > >>>  elif form.errors:
> > >>>        response.flash = 'Error'
> > >>>  else:
> > >>>        pass
> > >>>  return dict(form=form)
>
> > >>> def reset():
> > >>>    if form.accepts(request.vars, formname=None):
> > >>>        response.flash = 'Reset'
> > >>>    elif form.errors:
> > >>>        response.flash = 'Error'
> > >>>    else:
> > >>>        pass
> > >>>    return dict()
>
> > >>> def reset_all():
> > >>>    if form.accepts(request.vars, formname=None):
> > >>>        response.flash = 'Resert all'
> > >>>    elif form.errors:
> > >>>        response.flash = 'Error'
> > >>>    else:
> > >>>        pass
> > >>>    return dict()
>
> > >>> But action functions (reset, reset_all) will not call. Am I doing
> > >>> anything wrong?
>
> > >>> Thanks for advice,
> > >>> cheers
>
> > >>> --
> > >>> Tom
>
> > >>> Key fingerprint = 06C0 23C6 9EB7 0761 9807  65F4 7F6F 7EAB 496B 28AA

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: webform actions

2010-02-27 Thread mr.freeze
I disagree, the behavior seems controllable to me and I use it often.
In IE, a submit done via the enter key on a text input doesn't send
any of the  wrote:
> I think Jonathan have given enough reason of why not.  There is
> another post to discuss the same 
> thing.http://groups.google.com/group/web2py/msg/79c1f847890a6b60
>
> In short, do resist the temptation of using multiple submit buttons,
> pal. :)
>
> On Feb28, 9:36am, "mr.freeze"  wrote:
>
> > Why not just do this?:
>
> > def index():
> >     form = FORM('blah blah',
> >             INPUT(_type='submit', _value='Apply',_name="apply"),
> >             INPUT(_type='submit', _value='Reset',_name="reset"),
> >             INPUT(_type='submit', _value='Reset
> > all',_name="resetall"))
> >     if request.vars.apply:
> >         pass #apply was clicked
> >     elif request.vars.reset:
> >         pass #reset was clicked
> >     elif request.vars.resetall:
> >         pass #resetall was clicked
>
> > On Feb 27, 6:30 pm, Jonathan Lundell  wrote:
>
> > > On Feb 27, 2010, at 4:03 PM, Thadeus Burgess wrote:
>
> > > > If your running the latest version of web2py, look at
> > > > controllers/appadmin.py in ccache function. It defines a form with
> > > > three buttons, (one toc lear ram, one to clear disk, and one to clear
> > > > both). Click the different submit button executes the appropriate
> > > > function.
>
> > > A caveat, though: this approach is problematical if the form has a text 
> > > input field and the user submits the form by typing return in an input 
> > > field, rather than clicking a button.
>
> > > The problem as I understand it is that in that case you're not guaranteed 
> > > which button is returned. The culprit (no surprise) is IE. So if Tom's 
> > > form gets submitted by a return in a text field, and the browser is IE, 
> > > he presumably wants to see the Apply button, but might see one of the 
> > > reset buttons instead--not what the user intended.
>
> > > My approach is to use one submit button, and to make the other buttons 
> > > type=button, with an onclick script to reinvoke the same controller with 
> > > a button ID in vars. You'll typically check for that at the beginning of 
> > > the controller.
>
> > > I've been using it for a cancel button, as well as some 
> > > application-specific functions, and it seems to work well.
>
> > > > -Thadeus
>
> > > > On Sat, Feb 27, 2010 at 5:08 PM, Jonathan Lundell  
> > > > wrote:
> > > >> On Feb 27, 2010, at 3:00 PM, Tiago Almeida wrote:
>
> > > >> Don't know why functions reset, reset_all are not called but they 
> > > >> reference
> > > >> a "form" variable which is not in scope? Do you have any global "form"?
>
> > > >> The logic below can't work, for lots of reasons.
> > > >> One is the one Tiago mentions. Another is that input elements do not 
> > > >> have
> > > >> action attributes; forms do. There are ways to accomplish this kind of
> > > >> thing; most of them involve JavaScript.
> > > >> This might be helpful (though it's not the way I'd do
> > > >> it):http://www.javascript-coder.com/html-form/html-form-submit.phtml
>
> > > >> Regards,
> > > >> Tiago
> > > >> --
>
> > > >> On Sat, Feb 27, 2010 at 10:15 PM, Tomas Pelka  
> > > >> wrote:
>
> > > >>> Hi all,
>
> > > >>> have some troubles with web form which have more than one button. It 
> > > >>> is
> > > >>> obvious that one button (action connected with button) correspond with
> > > >>> one function.
>
> > > >>> According manual this should work:
> > > >>> controler
> > > >>> -
> > > >>> def index():
> > > >>>  form = FORM('blah blah',
> > > >>>        INPUT(_type='submit', _value='Apply'),
> > > >>>        INPUT(_type='submit', _value='Reset', _action=URL(r=request,
> > > >>> f='reset'),
> > > >>>        INPUT(_type='submit', _value='Reset all', 
> > > >>> _action=URL(r=request,
> > > >>> f='reset_all'))
> > > >>>  if form.accepts(request.vars, session):
> > > >>>        pass
> > > >>>  elif form.errors:
> > > >>>        response.flash = 'Error'
> > > >>>  else:
> > > >>>        pass
> > > >>>  return dict(form=form)
>
> > > >>> def reset():
> > > >>>    if form.accepts(request.vars, formname=None):
> > > >>>        response.flash = 'Reset'
> > > >>>    elif form.errors:
> > > >>>        response.flash = 'Error'
> > > >>>    else:
> > > >>>        pass
> > > >>>    return dict()
>
> > > >>> def reset_all():
> > > >>>    if form.accepts(request.vars, formname=None):
> > > >>>        response.flash = 'Resert all'
> > > >>>    elif form.errors:
> > > >>>        response.flash = 'Error'
> > > >>>    else:
> > > >>>        pass
> > > >>>    return dict()
>
> > > >>> But action functions (reset, reset_all) will not call. Am I doing
> > > >>> anything wrong?
>
> > > >>> Thanks for advice,
> > > >>> cheers
>
> > > >>> --
> > > >>> Tom
>
> > > >>> Key fingerprint = 06C0 23C6 9EB7 0761 9807  65F4 7F6F 7EAB 496B 28AA
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To

[web2py] sql between function

2010-02-27 Thread Stelios Koroneos
Hi, I'm trying to make a query function that accepts two datetime.date
object(start_date and end_date), and returns all records that are
between start_date and end_date. 
However, I found nothing like a between function in the web2py manual,
so I was wondering what's the best way to achieve this.
I tried using the db.table.field.year(), db.table.field.month() and
db.table.field.day() but that would create a rather complex solution
-- 
Stelios S. Koroneos

Digital OPSiS - Embedded Intelligence

Tel +30 210 9858296 Ext 100
Fax +30 210 9858298
http://www.digital-opsis.com

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: webform actions

2010-02-27 Thread Jonathan Lundell
On Feb 27, 2010, at 6:25 PM, mr.freeze wrote:

> I disagree, the behavior seems controllable to me and I use it often.
> In IE, a submit done via the enter key on a text input doesn't send
> any of the  done with the enter key will send the first submit value. Just make
> your default submit the first one and you can determine what to do
> with your form. Here's a revised example:
> 
>form = FORM('blah blah',
>INPUT(_type='text', _value='test',_name="test"),
>INPUT(_type='submit', _value='Reset',_name="reset"),
>INPUT(_type='submit', _value='Apply',_name="apply"),
> 
>INPUT(_type='submit', _value='Reset
> all',_name="resetall"))
>if request.vars.apply:
>pass #clicked or enter was hit on FF
>elif request.vars.reset:
>pass #clicked
>elif request.vars.resetall:
>pass #clicked
>else:
>pass #enter was hit on IE, do apply
> 
> Maybe I'm missing something?

The main problem with that approach is that it relies on undocumented 
reverse-engineered behavior of IE. Now, that's something we're forced to do 
from time to time, but unless you're averse to using JavaScript, there are 
solutions (like Iceberg's and mine) that avoid the IE issue altogether.

Also, in my case, I don't actually need a submit button (vs a button button) 
for my cancel function, since I need to catch the cancel before calling 
accepts()--I don't want to invoke the validators on a cancel.

But if you really need multiple submits, and you're willing to use JavaScript, 
Iceberg's solution is slick.

Some interesting research on the IE problem: 
http://muffinresearch.co.uk/archives/2005/12/08/fun-with-multiple-submit-buttons/

> 
> 
> On Feb 27, 8:06 pm, Iceberg  wrote:
>> I think Jonathan have given enough reason of why not.  There is
>> another post to discuss the same 
>> thing.http://groups.google.com/group/web2py/msg/79c1f847890a6b60
>> 
>> In short, do resist the temptation of using multiple submit buttons,
>> pal. :)
>> 
>> On Feb28, 9:36am, "mr.freeze"  wrote:
>> 
>>> Why not just do this?:
>> 
>>> def index():
>>> form = FORM('blah blah',
>>> INPUT(_type='submit', _value='Apply',_name="apply"),
>>> INPUT(_type='submit', _value='Reset',_name="reset"),
>>> INPUT(_type='submit', _value='Reset
>>> all',_name="resetall"))
>>> if request.vars.apply:
>>> pass #apply was clicked
>>> elif request.vars.reset:
>>> pass #reset was clicked
>>> elif request.vars.resetall:
>>> pass #resetall was clicked
>> 
>>> On Feb 27, 6:30 pm, Jonathan Lundell  wrote:
>> 
 On Feb 27, 2010, at 4:03 PM, Thadeus Burgess wrote:
>> 
> If your running the latest version of web2py, look at
> controllers/appadmin.py in ccache function. It defines a form with
> three buttons, (one toc lear ram, one to clear disk, and one to clear
> both). Click the different submit button executes the appropriate
> function.
>> 
 A caveat, though: this approach is problematical if the form has a text 
 input field and the user submits the form by typing return in an input 
 field, rather than clicking a button.
>> 
 The problem as I understand it is that in that case you're not guaranteed 
 which button is returned. The culprit (no surprise) is IE. So if Tom's 
 form gets submitted by a return in a text field, and the browser is IE, he 
 presumably wants to see the Apply button, but might see one of the reset 
 buttons instead--not what the user intended.
>> 
 My approach is to use one submit button, and to make the other buttons 
 type=button, with an onclick script to reinvoke the same controller with a 
 button ID in vars. You'll typically check for that at the beginning of the 
 controller.
>> 
 I've been using it for a cancel button, as well as some 
 application-specific functions, and it seems to work well.
>> 
> -Thadeus
>> 
> On Sat, Feb 27, 2010 at 5:08 PM, Jonathan Lundell  
> wrote:
>> On Feb 27, 2010, at 3:00 PM, Tiago Almeida wrote:
>> 
>> Don't know why functions reset, reset_all are not called but they 
>> reference
>> a "form" variable which is not in scope? Do you have any global "form"?
>> 
>> The logic below can't work, for lots of reasons.
>> One is the one Tiago mentions. Another is that input elements do not have
>> action attributes; forms do. There are ways to accomplish this kind of
>> thing; most of them involve JavaScript.
>> This might be helpful (though it's not the way I'd do
>> it):http://www.javascript-coder.com/html-form/html-form-submit.phtml
>> 
>> Regards,
>> Tiago
>> --
>> 
>> On Sat, Feb 27, 2010 at 10:15 PM, Tomas Pelka  wrote:
>> 
>>> Hi all,
>> 
>>> have some troubles with web form which have more than one button. It is
>>> obvious that one button (action connected with button) correspond with
>>> one function.
>> 
>

Re: [web2py] sql between function

2010-02-27 Thread Thadeus Burgess
#and
db(db.table.field >= '2009-12-28')(db.table.field <= '2009-12-30').select()
#or
db(db.table.field == '2010-01-01' | db.table.field == request.now).select()

db(db.table.field.year() > '2008').select()

db(db.table.field.day() < '5').select()

-Thadeus





On Sat, Feb 27, 2010 at 3:52 PM, Stelios Koroneos
 wrote:
> Hi, I'm trying to make a query function that accepts two datetime.date
> object(start_date and end_date), and returns all records that are
> between start_date and end_date.
> However, I found nothing like a between function in the web2py manual,
> so I was wondering what's the best way to achieve this.
> I tried using the db.table.field.year(), db.table.field.month() and
> db.table.field.day() but that would create a rather complex solution
> --
> Stelios S. Koroneos
>
> Digital OPSiS - Embedded Intelligence
>
> Tel +30 210 9858296 Ext 100
> Fax +30 210 9858298
> http://www.digital-opsis.com
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: sql between function

2010-02-27 Thread mr.freeze
def datesearch():
matches=None
form =
SQLFORM.factory(Field('start_date','date',requires=IS_NOT_EMPTY()),
 
Field('end_date','date',requires=IS_NOT_EMPTY()))
if form.accepts(request.vars,session):
(sy,sm,sd) = (int(x) for x in form.vars.start_date.split('-'))
(ey,em,ed) = (int(x) for x in form.vars.end_date.split('-'))
query = (db.things.created_on >= datetime.date(sy,sm,sd)) &
(db.things.created_on <= datetime.date(ey,em,ed))
matches = db(query).select()
allrows = db().select(db.things.ALL)
return dict(form=form,matches=matches,allrows=allrows)



On Feb 27, 9:00 pm, Thadeus Burgess  wrote:
> #and
> db(db.table.field >= '2009-12-28')(db.table.field <= '2009-12-30').select()
> #or
> db(db.table.field == '2010-01-01' | db.table.field == request.now).select()
>
> db(db.table.field.year() > '2008').select()
>
> db(db.table.field.day() < '5').select()
>
> -Thadeus
>
> On Sat, Feb 27, 2010 at 3:52 PM, Stelios Koroneos
>
>  wrote:
> > Hi, I'm trying to make a query function that accepts two datetime.date
> > object(start_date and end_date), and returns all records that are
> > between start_date and end_date.
> > However, I found nothing like a between function in the web2py manual,
> > so I was wondering what's the best way to achieve this.
> > I tried using the db.table.field.year(), db.table.field.month() and
> > db.table.field.day() but that would create a rather complex solution
> > --
> > Stelios S. Koroneos
>
> > Digital OPSiS - Embedded Intelligence
>
> > Tel +30 210 9858296 Ext 100
> > Fax +30 210 9858298
> >http://www.digital-opsis.com
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: GAE delete() has subtle difference compared to native Web2Py

2010-02-27 Thread Richard
On Feb 4, 12:16 pm, mdipierro  wrote:
> do you use 2.5 or something else locally?

it would be because GAE uses 2.5:
http://code.google.com/appengine/docs/python/gettingstarted/devenvironment.html

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Iterate through form input

2010-02-27 Thread mr.freeze
Try this. It builds the form dynamically on the client and server so
you get to keep the benefits of SQLFORM (validation, etc):

def invite():
fields = [Field('email',requires=IS_EMAIL())]
for r in range(1, len(request.vars)):
if 'email%s' % str(r) in request.vars.keys():
fields.append(Field('email%s' %
str(r),requires=IS_EMAIL()))
form = SQLFORM.factory(table_name='invited',*fields)
submit = form.element('tr',_id='submit_record__row')
if form.accepts(request.vars,session,keepvalues=True):
request.flash = 'got it'
add_row = XML(form.element('tr'))
add_invite = INPUT(_type='button',_value='Add',
   _onclick="var c = jQuery('input[type=\"text
\"]').size();"\
"jQuery('#%s').remove();var newrow =
'%s';"\
"newrow = newrow.replace(new
RegExp('email','g'),'email'+c.toString());"\
"jQuery('form:first
table').append(newrow + '%s');" % \
 
(submit['_id'],add_row,submit.xml()))
return dict(form=form,add_invite=add_invite)



On Feb 26, 2:50 pm, minh  wrote:
> Hi,
>
> I want to make a page where users can enter e-mails to send an invite.
> There will be an array of input boxes (1 e-mail each box) and a send
> button.
>
> I was wondering what the best way to generate the form dynamically
> was... in case the user wanted to add more e-mails.
>
> Also, is there a way to iterate through the form elements so I don't
> have to worry about number/name of input fields?
>
> Thanks,
> Minh

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.