[web2py] Database Triggers

2013-05-21 Thread Apoorve Mohan
Hi

I want to know whether there is a support for database triggers in web2py. 
I can't find any documentation on-line. Please suggest me some links.

--
Thanks and Regards

 Apoorve

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Database Triggers

2013-05-21 Thread Niphlod
there's no functionality to write triggers . They're too much dependant 
(syntax-wise) on the db backend.
But, web2py exposes some nice callbacks that can deal with most of the 
corner-cases where you'd need a database triggers

http://web2py.com/books/default/chapter/29/06#before-and-after-callbacks

Il giorno martedì 21 maggio 2013 09:07:00 UTC+2, Apoorve Mohan ha scritto:
>
> Hi
>
> I want to know whether there is a support for database triggers in web2py. 
> I can't find any documentation on-line. Please suggest me some links.
>
> --
> Thanks and Regards
>
>  Apoorve
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] can not migrate MySQL when deleting referenced field?

2013-05-21 Thread Mika Sjöman
Hi

Does anyone know how to delete a reference field from MySQL? I get an error 
from MySQL when I try to remove the field from the table 


 going from:

db.define_table('tecken',
Field('hsk_level',type='list:string'),
Field('streak_id', type='reference streak', writable=True))

### To:

db.define_table('tecken',
Field('hsk_level',type='list:string'))

This is the error I get:

 (1025, "Error on rename of 
'./dominochinese/#sql-7bc_b1' to './dominochinese/tecken' (errno: 150)")

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Jurgis Pralgauskis
Hi, 

clicking ticket link each time becomes frustrating (time wasting) [SOLVED] 
:)

I looked arround and tried example from 
http://www.dev-explorer.com/articles/full-page-iframe
you only need to escape % for sizing.
my routes.py: http://pastebin.com/bfKYEhet



ps.: could error message be customized per app? 
then I could include in my demo (skeleton) app for students - as my 
students work through web interface (and I don't want to bother them too 
much with other issues)...

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Niphlod
there are routes to manage custom error pages.
http://web2py.com/books/default/chapter/29/04#Routes-on-error

Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis ha 
scritto:
>
> Hi, 
>
> clicking ticket link each time becomes frustrating (time wasting) [SOLVED] 
> :)
>
> I looked arround and tried example from 
> http://www.dev-explorer.com/articles/full-page-iframe
> you only need to escape % for sizing.
> my routes.py: http://pastebin.com/bfKYEhet
>
>
>
> ps.: could error message be customized per app? 
> then I could include in my demo (skeleton) app for students - as my 
> students work through web interface (and I don't want to bother them too 
> much with other issues)...
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Jurgis Pralgauskis
but rootes are described per web2py, not per app..?


On Tue, May 21, 2013 at 10:49 AM, Niphlod  wrote:

> there are routes to manage custom error pages.
> http://web2py.com/books/default/chapter/29/04#Routes-on-error
>
> Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis ha
> scritto:
>
>> Hi,
>>
>> clicking ticket link each time becomes frustrating (time wasting)
>> [SOLVED] :)
>>
>> I looked arround and tried example from http://www.dev-explorer.**
>> com/articles/full-page-iframe
>> you only need to escape % for sizing.
>> my routes.py: http://pastebin.**com/bfKYEhet
>>
>>
>>
>> ps.: could error message be customized per app?
>> then I could include in my demo (skeleton) app for students - as my
>> students work through web interface (and I don't want to bother them too
>> much with other issues)...
>>
>>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Jurgis Pralgauskis
I mean routes.py is in web2py root, not in app folder..


On Tue, May 21, 2013 at 11:47 AM, Jurgis Pralgauskis <
jurgis.pralgaus...@gmail.com> wrote:

> but rootes are described per web2py, not per app..?
>
>
> On Tue, May 21, 2013 at 10:49 AM, Niphlod  wrote:
>
>> there are routes to manage custom error pages.
>> http://web2py.com/books/default/chapter/29/04#Routes-on-error
>>
>> Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis ha
>> scritto:
>>
>>> Hi,
>>>
>>> clicking ticket link each time becomes frustrating (time wasting)
>>> [SOLVED] :)
>>>
>>> I looked arround and tried example from http://www.dev-explorer.**
>>> com/articles/full-page-iframe
>>> you only need to escape % for sizing.
>>> my routes.py: http://pastebin.**com/bfKYEhet
>>>
>>>
>>>
>>> ps.: could error message be customized per app?
>>> then I could include in my demo (skeleton) app for students - as my
>>> students work through web interface (and I don't want to bother them too
>>> much with other issues)...
>>>
>>>  --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> Jurgis Pralgauskis
> tel: 8-616 77613;
> Don't worry, be happy and make things better ;)
> http://galvosukykla.lt
>



-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Query not supported, but it generates a valid SQL-level query

2013-05-21 Thread Johann Spies

On 20/05/2013 12:53, Niphlod wrote:
if it doens't say "query not supported" we'll know that the failing 
part is in fact the bit that tries to count the records.

Are there any plans to correct this problem or should I create a ticket?

Regards
Johann

--
Johann SpiesTelefoon: 021-808 4699
Databestuurder /  Data manager  Faks: 021-883 3691

Sentrum vir Navorsing oor Evaluasie, Wetenskap en Tegnologie
Centre for Research on Evaluation, Science and Technology
Universiteit Stellenbosch.

 "And the world passeth away, and the lust thereof: but
  he that doeth the will of God abideth for ever."
 I John 2:17

E-pos vrywaringsklousule

Hierdie e-pos mag vertroulike inligting bevat en mag regtens geprivilegeerd 
wees en is slegs bedoel vir die persoon aan wie dit geadresseer is. Indien u 
nie die bedoelde ontvanger is nie, word u hiermee in kennis gestel dat u 
hierdie dokument geensins mag gebruik, versprei of kopieer nie. Stel ook 
asseblief die sender onmiddellik per telefoon in kennis en vee die e-pos uit. 
Die Universiteit aanvaar nie aanspreeklikheid vir enige skade, verlies of 
uitgawe wat voortspruit uit hierdie e-pos en/of die oopmaak van enige lês 
aangeheg by hierdie e-pos nie.

E-mail disclaimer

This e-mail may contain confidential information and may be legally privileged 
and is intended only for the person to whom it is addressed. If you are not the 
intended recipient, you are notified that you may not use, distribute or copy 
this document in any manner whatsoever. Kindly also notify the sender 
immediately by telephone, and delete the e-mail. The University does not accept 
liability for any damage, loss or expense arising from this e-mail and/or 
accessing any files attached to this e-mail.

--

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

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Query not supported, but it generates a valid SQL-level query

2013-05-21 Thread Niphlod
create a ticket so it gets tracked. Please post an example complete with 
models and a few records to test it out.

Il giorno martedì 21 maggio 2013 11:21:29 UTC+2, Johann Spies ha scritto:
>
> On 20/05/2013 12:53, Niphlod wrote: 
> > if it doens't say "query not supported" we'll know that the failing 
> > part is in fact the bit that tries to count the records. 
> Are there any plans to correct this problem or should I create a ticket? 
>
> Regards 
> Johann 
>
> -- 
> Johann SpiesTelefoon: 021-808 4699 
> Databestuurder /  Data managerFaks: 021-883 3691 
>
> Sentrum vir Navorsing oor Evaluasie, Wetenskap en Tegnologie 
> Centre for Research on Evaluation, Science and Technology 
> Universiteit Stellenbosch. 
>
>   "And the world passeth away, and the lust thereof: but 
>he that doeth the will of God abideth for ever." 
>   I John 2:17 
>
> E-pos vrywaringsklousule 
>
> Hierdie e-pos mag vertroulike inligting bevat en mag regtens 
> geprivilegeerd wees en is slegs bedoel vir die persoon aan wie dit 
> geadresseer is. Indien u nie die bedoelde ontvanger is nie, word u hiermee 
> in kennis gestel dat u hierdie dokument geensins mag gebruik, versprei of 
> kopieer nie. Stel ook asseblief die sender onmiddellik per telefoon in 
> kennis en vee die e-pos uit. Die Universiteit aanvaar nie aanspreeklikheid 
> vir enige skade, verlies of uitgawe wat voortspruit uit hierdie e-pos en/of 
> die oopmaak van enige lês aangeheg by hierdie e-pos nie. 
>
> E-mail disclaimer 
>
> This e-mail may contain confidential information and may be legally 
> privileged and is intended only for the person to whom it is addressed. If 
> you are not the intended recipient, you are notified that you may not use, 
> distribute or copy this document in any manner whatsoever. Kindly also 
> notify the sender immediately by telephone, and delete the e-mail. The 
> University does not accept liability for any damage, loss or expense 
> arising from this e-mail and/or accessing any files attached to this 
> e-mail. 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Hey Massimo, how do you market and watch for web2py news, and other metrics and tricks.

2013-05-21 Thread Massimo Di Pierro
Actually no. I used to watch web2py using google alerts but I have not done 
so recently. Usually if something interesting comes up people from this 
list email me about it.

On Monday, 20 May 2013 14:52:19 UTC-5, smoggy wrote:
>
> Hi Massimo,
>
> I'm launching a business and i need some launching + metrics lessons. I've 
> followed you in reddit and Hacker news and i found you're are everywhere, 
> monitoring and defending web2py. The ptional questions about that 
> omnipresence are:
>
> 1) how do you market 
> 2) and watch for web2py news, event everywhere
> 3) and other metrics and tricks.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Hey Massimo, how do you market and watch for web2py news, and other metrics and tricks.

2013-05-21 Thread Niphlod
lol, we all love human minions ^_^ 


Il giorno martedì 21 maggio 2013 11:54:43 UTC+2, Massimo Di Pierro ha 
scritto:
>
> Actually no. I used to watch web2py using google alerts but I have not 
> done so recently. Usually if something interesting comes up people from 
> this list email me about it.
>
> On Monday, 20 May 2013 14:52:19 UTC-5, smoggy wrote:
>>
>> Hi Massimo,
>>
>> I'm launching a business and i need some launching + metrics lessons. 
>> I've followed you in reddit and Hacker news and i found you're are 
>> everywhere, monitoring and defending web2py. The ptional questions about 
>> that omnipresence are:
>>
>> 1) how do you market 
>> 2) and watch for web2py news, event everywhere
>> 3) and other metrics and tricks.
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Can not add external library like SPARQWrapper

2013-05-21 Thread YIFAN NING
I have been trying to add SPARQWrapper into web2py framework. However, no 
matter I use the python carry with web2py-version 2.5.1 or the python with 
mac-version 2.7.3, there is still come with the error " No module named SPARQLWrapper". Besides, If the 
external library should be add into the folder 
"web2py/web2py.app/Contents/Resources/site-packages" 
or web2py/web2py.app/Contents/Resources/lib or anywhere else. Please give 
me some advice how to add SPARQWrapper for Web2py. I had struggling with 
this problem a long time. Thanks a lot.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] friendly URL for user profile

2013-05-21 Thread Júlia Rizza
So I have this on my *routes.py*:

routers = dict(
BASE = dict(
default_application = 'kolaborativa',
default_controller = 'default',
default_function = 'index'
),
)

routes_in = (
# do not reroute admin unless you want to disable it
(BASE + '/admin', '/admin/default/index'),
(BASE + '/admin/$anything', '/admin/$anything'),
# do not reroute appadmin unless you want to disable it
(BASE + '/$app/appadmin', '/$app/appadmin/index'),
(BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
# do not reroute static files
(BASE + '/$app/static/$anything', '/$app/static/$anything'),
# reroute favicon and robots, use exable for lack of better choice
('/favicon.ico', '/examples/static/favicon.ico'),
('/robots.txt', '/examples/static/robots.txt'),
# do other stuff
((r'.*http://otherdomain.com.* (?P.*)', r'/app/ctr\g')),
# remove the BASE prefix
('/$username', BASE + 'user_info/$username'),
)

routes_out = (
# do not reroute admin unless you want to disable it
('/admin/$anything', BASE + '/admin/$anything'),
# do not reroute appadmin unless you want to disable it
('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
# do not reroute static files
('/$app/static/$anything', BASE + '/$app/static/$anything'),
# do other stuff
(r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
(r'/app(?P.*)', r'\g'),
# restore the BASE prefix
(BASE + 'user_info/$username', '/$username'),
)

This way I still need to access* http://localhost:8000/user_info/username*to 
see the user profile and I want to access just 
*http://localhost:8000/username*.
Can someone help me?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: friendly URL for user profile

2013-05-21 Thread Massimo Di Pierro
Hello Julia,
you have lines like
(BASE + '/admin', '/admin/default/index'),
what is the value of BASE?


On Monday, 20 May 2013 19:48:16 UTC-5, Júlia Rizza wrote:
>
> So I have this on my *routes.py*:
>
> routers = dict(
> BASE = dict(
> default_application = 'kolaborativa',
> default_controller = 'default',
> default_function = 'index'
> ),
> )
>
> routes_in = (
> # do not reroute admin unless you want to disable it
> (BASE + '/admin', '/admin/default/index'),
> (BASE + '/admin/$anything', '/admin/$anything'),
> # do not reroute appadmin unless you want to disable it
> (BASE + '/$app/appadmin', '/$app/appadmin/index'),
> (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
> # do not reroute static files
> (BASE + '/$app/static/$anything', '/$app/static/$anything'),
> # reroute favicon and robots, use exable for lack of better choice
> ('/favicon.ico', '/examples/static/favicon.ico'),
> ('/robots.txt', '/examples/static/robots.txt'),
> # do other stuff
> ((r'.*http://otherdomain.com.* (?P.*)', r'/app/ctr\g')),
> # remove the BASE prefix
> ('/$username', BASE + 'user_info/$username'),
> )
>
> routes_out = (
> # do not reroute admin unless you want to disable it
> ('/admin/$anything', BASE + '/admin/$anything'),
> # do not reroute appadmin unless you want to disable it
> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
> # do not reroute static files
> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
> # do other stuff
> (r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
> (r'/app(?P.*)', r'\g'),
> # restore the BASE prefix
> (BASE + 'user_info/$username', '/$username'),
> )
>
> This way I still need to access* http://localhost:8000/user_info/username*to 
> see the user profile and I want to access just 
> *http://localhost:8000/username*.
> Can someone help me?
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Can not add external library like SPARQWrapper

2013-05-21 Thread Massimo Di Pierro
Please download the web2py source version, not the Mac version.

On Monday, 20 May 2013 20:56:17 UTC-5, YIFAN NING wrote:
>
> I have been trying to add SPARQWrapper into web2py framework. However, no 
> matter I use the python carry with web2py-version 2.5.1 or the python with 
> mac-version 2.7.3, there is still come with the error " 'exceptions.ImportError'> No module named SPARQLWrapper". Besides, If the 
> external library should be add into the folder 
> "web2py/web2py.app/Contents/Resources/site-packages" 
> or web2py/web2py.app/Contents/Resources/lib or anywhere else. Please give 
> me some advice how to add SPARQWrapper for Web2py. I had struggling with 
> this problem a long time. Thanks a lot.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: friendly URL for user profile

2013-05-21 Thread Anthony
Also, note that you cannot mix the two rewrite systems (i.e., you cannot 
have both a "routers" dict and routes_in/routes_out -- you have to pick one 
or the other method of specifying routes).

Anthony

On Tuesday, May 21, 2013 7:49:04 AM UTC-4, Massimo Di Pierro wrote:
>
> Hello Julia,
> you have lines like
> (BASE + '/admin', '/admin/default/index'),
> what is the value of BASE?
>
>
> On Monday, 20 May 2013 19:48:16 UTC-5, Júlia Rizza wrote:
>>
>> So I have this on my *routes.py*:
>>
>> routers = dict(
>> BASE = dict(
>> default_application = 'kolaborativa',
>> default_controller = 'default',
>> default_function = 'index'
>> ),
>> )
>>
>> routes_in = (
>> # do not reroute admin unless you want to disable it
>> (BASE + '/admin', '/admin/default/index'),
>> (BASE + '/admin/$anything', '/admin/$anything'),
>> # do not reroute appadmin unless you want to disable it
>> (BASE + '/$app/appadmin', '/$app/appadmin/index'),
>> (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
>> # do not reroute static files
>> (BASE + '/$app/static/$anything', '/$app/static/$anything'),
>> # reroute favicon and robots, use exable for lack of better choice
>> ('/favicon.ico', '/examples/static/favicon.ico'),
>> ('/robots.txt', '/examples/static/robots.txt'),
>> # do other stuff
>> ((r'.*http://otherdomain.com.* (?P.*)', r'/app/ctr\g')),
>> # remove the BASE prefix
>> ('/$username', BASE + 'user_info/$username'),
>> )
>>
>> routes_out = (
>> # do not reroute admin unless you want to disable it
>> ('/admin/$anything', BASE + '/admin/$anything'),
>> # do not reroute appadmin unless you want to disable it
>> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
>> # do not reroute static files
>> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
>> # do other stuff
>> (r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
>> (r'/app(?P.*)', r'\g'),
>> # restore the BASE prefix
>> (BASE + 'user_info/$username', '/$username'),
>> )
>>
>> This way I still need to access* http://localhost:8000/user_info/username
>> * to see the user profile and I want to access just *
>> http://localhost:8000/username*.
>> Can someone help me?
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Anthony
routes_onerror can specify app-specific routes.

On Tuesday, May 21, 2013 4:48:01 AM UTC-4, Jurgis Pralgauskis wrote:
>
> I mean routes.py is in web2py root, not in app folder..
>
>
> On Tue, May 21, 2013 at 11:47 AM, Jurgis Pralgauskis <
> jurgis.pr...@gmail.com > wrote:
>
>> but rootes are described per web2py, not per app..?
>>
>>
>> On Tue, May 21, 2013 at 10:49 AM, Niphlod 
>> > wrote:
>>
>>> there are routes to manage custom error pages.
>>> http://web2py.com/books/default/chapter/29/04#Routes-on-error
>>>
>>> Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis ha 
>>> scritto:
>>>
 Hi, 

 clicking ticket link each time becomes frustrating (time wasting) 
 [SOLVED] :)

 I looked arround and tried example from http://www.dev-explorer.**
 com/articles/full-page-iframe
 you only need to escape % for sizing.
 my routes.py: http://pastebin.**com/bfKYEhet



 ps.: could error message be customized per app? 
 then I could include in my demo (skeleton) app for students - as my 
 students work through web interface (and I don't want to bother them too 
 much with other issues)...

  -- 
>>>  
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>
>>
>> -- 
>> Jurgis Pralgauskis
>> tel: 8-616 77613;
>> Don't worry, be happy and make things better ;)
>> http://galvosukykla.lt 
>>
>
>
>
> -- 
> Jurgis Pralgauskis
> tel: 8-616 77613;
> Don't worry, be happy and make things better ;)
> http://galvosukykla.lt 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Send registration email directly from local server?

2013-05-21 Thread Lamps902
Interesting info, Ales. Thanks!

On Monday, May 20, 2013 7:09:06 PM UTC-5, LightDot wrote:
>
> Gmail's SMTP has a limit of 100 recipients per single message, max 500 
> different recipients per day. A large number of undeliverable messages will 
> get you in trouble regardless of the limits. In case of a ban, the account 
> gets locked for 24h.
>
> Yahoo has similar limitations as Gmail. Hotmail used to have a 100 
> recipients per day limit and Outlook.com has this at appx. 300 per day now 
> - it varies according to the account age, etc.. I'm pretty sure all 
> mentioned providers take such factors into account. So a completely new 
> account might get locked up much faster than on that is years old.
>
> Lamps902, one can customize "from", "reply-to" etc. regardless of the SMTP 
> server used - so no need to actually use your domain with gmail, for 
> example. You just need a working SMTP... A little bit of additional code 
> could also enable web2py to rotate between several SMTP servers, according 
> to some simple rules... Anyway, I would recommend a private, well 
> administered SMTP instead. Much less hassle.
>
> In the GNU/linux world, having an ability to send mail locally is 
> practically a given thing - most of the distributions have this 
> functionality out of the box by using the ubiquitous sendmail. Even if it 
> isn't actually sendmail anymore, the functionality is there (together with 
> the symlink named "sendmail"). In web2py, you should be able to simply use 
> localhost:25 as SMTP (might need additional authentication, might not. It 
> depends...). Not quite independent of the system used, but there it is...
>
> Regards,
> Ales
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] SQLTABLE extracolumn

2013-05-21 Thread Geo
Greetings,
I'm using web2py Version 2.3.2 (2012-12-17 15:03:30) stable
and I'm trying to use SQLTABLE extracolumn but It does not work.

To simplify testing I tried it on db.auth_user.

def index():
extracolums = [{'label':A('Extra',_href='#'),
'class': '', #class name of the header
'width':'', #width in pixels or %
'content':lambda row, rc: A('Edit',_href='edit/%s'%row.
id),
'selected': False #agregate class selected to this 
column
}]

table = SQLTABLE(db(db.auth_user).select(), extracolums=extracolums)
return dict(table=table)


but the result table only shows the columns:

auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, 
auth_user.password, auth_user.registration_key, 
auth_user.reset_password_key, auth_user.registration_id


I tried various combinations of 'label' (with or without A), 'class' 
(commented, empty string, "string") and 'width' (commented, empty string, 
100, "100", "100px", "100%") but nothing happened.


Any advice?

Thanks

Geo



-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: friendly URL for user profile

2013-05-21 Thread Niphlod
PS: BASE is '' by default in recent routes.example.py distribution.

Il giorno martedì 21 maggio 2013 13:49:04 UTC+2, Massimo Di Pierro ha 
scritto:
>
> Hello Julia,
> you have lines like
> (BASE + '/admin', '/admin/default/index'),
> what is the value of BASE?
>
>
> On Monday, 20 May 2013 19:48:16 UTC-5, Júlia Rizza wrote:
>>
>> So I have this on my *routes.py*:
>>
>> routers = dict(
>> BASE = dict(
>> default_application = 'kolaborativa',
>> default_controller = 'default',
>> default_function = 'index'
>> ),
>> )
>>
>> routes_in = (
>> # do not reroute admin unless you want to disable it
>> (BASE + '/admin', '/admin/default/index'),
>> (BASE + '/admin/$anything', '/admin/$anything'),
>> # do not reroute appadmin unless you want to disable it
>> (BASE + '/$app/appadmin', '/$app/appadmin/index'),
>> (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
>> # do not reroute static files
>> (BASE + '/$app/static/$anything', '/$app/static/$anything'),
>> # reroute favicon and robots, use exable for lack of better choice
>> ('/favicon.ico', '/examples/static/favicon.ico'),
>> ('/robots.txt', '/examples/static/robots.txt'),
>> # do other stuff
>> ((r'.*http://otherdomain.com.* (?P.*)', r'/app/ctr\g')),
>> # remove the BASE prefix
>> ('/$username', BASE + 'user_info/$username'),
>> )
>>
>> routes_out = (
>> # do not reroute admin unless you want to disable it
>> ('/admin/$anything', BASE + '/admin/$anything'),
>> # do not reroute appadmin unless you want to disable it
>> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
>> # do not reroute static files
>> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
>> # do other stuff
>> (r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
>> (r'/app(?P.*)', r'\g'),
>> # restore the BASE prefix
>> (BASE + 'user_info/$username', '/$username'),
>> )
>>
>> This way I still need to access* http://localhost:8000/user_info/username
>> * to see the user profile and I want to access just *
>> http://localhost:8000/username*.
>> Can someone help me?
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: friendly URL for user profile

2013-05-21 Thread Massimo Di Pierro
I think you want:

BASE = ''

routes_in = (
# do not reroute admin unless you want to disable it
(BASE + '/admin/$anything', '/admin/$anything'),
# do not reroute appadmin unless you want to disable it
(BASE + '/$app/appadmin', '/$app/appadmin/index'),
(BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
# do not reroute static files
(BASE + '/$app/static/$anything', '/$app/static/$anything'),
# reroute favicon and robots, use exable for lack of better choice
(BASE + '/favicon.ico', '/examples/static/favicon.ico'),
(BASE + '/robots.txt', '/examples/static/robots.txt'),
# kolaborativa specific
(BASE + '/$username', BASE + 
'/kolaborativa/default/user_info/$username'),
(BASE + '/kolaborativa/$anything', BASE + '/kolaborativa/$anything'),
)

routes_out = (
# do not reroute admin unless you want to disable it
('/admin/$anything', BASE + '/admin/$anything'),
# do not reroute appadmin unless you want to disable it
('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
# do not reroute static files
('/$app/static/$anything', BASE + '/$app/static/$anything'),
# do other stuff
(r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
(r'/app(?P.*)', r'\g'),
# restore the BASE prefix
('/kolaborativa/default/user_info/$username', BASE+'/$username'),
)


Mind that you will no longer be able to do visit:

http://.../admin

because it will be interpreted as a username. You can instead do

http://.../admin/default/site

Hope this helps.

Massimo


On Monday, 20 May 2013 19:48:16 UTC-5, Júlia Rizza wrote:
>
> So I have this on my *routes.py*:
>
> routers = dict(
> BASE = dict(
> default_application = 'kolaborativa',
> default_controller = 'default',
> default_function = 'index'
> ),
> )
>
> routes_in = (
> # do not reroute admin unless you want to disable it
> (BASE + '/admin', '/admin/default/index'),
> (BASE + '/admin/$anything', '/admin/$anything'),
> # do not reroute appadmin unless you want to disable it
> (BASE + '/$app/appadmin', '/$app/appadmin/index'),
> (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
> # do not reroute static files
> (BASE + '/$app/static/$anything', '/$app/static/$anything'),
> # reroute favicon and robots, use exable for lack of better choice
> ('/favicon.ico', '/examples/static/favicon.ico'),
> ('/robots.txt', '/examples/static/robots.txt'),
> # do other stuff
> ((r'.*http://otherdomain.com.* (?P.*)', r'/app/ctr\g')),
> # remove the BASE prefix
> ('/$username', BASE + 'user_info/$username'),
> )
>
> routes_out = (
> # do not reroute admin unless you want to disable it
> ('/admin/$anything', BASE + '/admin/$anything'),
> # do not reroute appadmin unless you want to disable it
> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
> # do not reroute static files
> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
> # do other stuff
> (r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
> (r'/app(?P.*)', r'\g'),
> # restore the BASE prefix
> (BASE + 'user_info/$username', '/$username'),
> )
>
> This way I still need to access* http://localhost:8000/user_info/username*to 
> see the user profile and I want to access just 
> *http://localhost:8000/username*.
> Can someone help me?
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: SQLTABLE extracolumn

2013-05-21 Thread Anthony
It's extracolumns, not extracolums.

On Tuesday, May 21, 2013 8:23:25 AM UTC-4, Geo wrote:
>
> Greetings,
> I'm using web2py Version 2.3.2 (2012-12-17 15:03:30) stable
> and I'm trying to use SQLTABLE extracolumn but It does not work.
>
> To simplify testing I tried it on db.auth_user.
>
> def index():
> extracolums = [{'label':A('Extra',_href='#'),
> 'class': '', #class name of the header
> 'width':'', #width in pixels or %
> 'content':lambda row, rc: A('Edit',_href='edit/%s'%row
> .id),
> 'selected': False #agregate class selected to this 
> column
> }]
> 
> table = SQLTABLE(db(db.auth_user).select(), extracolums=extracolums)
> return dict(table=table)
>
>
> but the result table only shows the columns:
>
> auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, 
> auth_user.password, auth_user.registration_key, 
> auth_user.reset_password_key, auth_user.registration_id
>
>
> I tried various combinations of 'label' (with or without A), 'class' 
> (commented, empty string, "string") and 'width' (commented, empty string, 
> 100, "100", "100px", "100%") but nothing happened.
>
>
> Any advice?
>
> Thanks
>
> Geo
>
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] REF: Server Error being returned after db insert

2013-05-21 Thread Teddy Nyambe
I have this unusual behavior, this code adds data to the server quiet ok
but returns "Server Error" am expecting an integer

*#Controller*
*
*
def saveData():
insertID = db.mytable.insert(
field1= request.vars.field1,
field2 = request.vars.field2
)
return insertID

Data gets saved quiet well, but the insertID displays "Server Error" I was
thinking it returns an ID
-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: REF: Server Error being returned after db insert

2013-05-21 Thread Massimo Di Pierro
def saveData():
insertID = db.mytable.insert(
field1= request.vars.field1,
field2 = request.vars.field2
)
return str(insertID) ### must return a string not a Reference object.



On Tuesday, 21 May 2013 07:44:11 UTC-5, software.ted wrote:
>
> I have this unusual behavior, this code adds data to the server quiet ok 
> but returns "Server Error" am expecting an integer
>
> *#Controller*
> *
> *
> def saveData():
> insertID = db.mytable.insert(
> field1= request.vars.field1,
> field2 = request.vars.field2
> )
> return insertID
>
> Data gets saved quiet well, but the insertID displays "Server Error" I was 
> thinking it returns an ID
> -- 
>
> ...
> Teddy Lubasi Nyambe
> Opensource Zambia
> Lusaka, ZAMBIA
>
> Cell: +260 97 7760473
> website: http://www.opensource.org.zm
>
> ~/
> Human Knowledge belongs to the world! - AntiTrust
>
> Man is a tool-using animal. Without tools he is nothing, with tools he is 
> all - Thomas Carlyle 1795-1881
>
> /~ 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: REF: Server Error being returned after db insert

2013-05-21 Thread Teddy Nyambe
Geish!!! how could i have missed that Thanx!



On Tue, May 21, 2013 at 2:45 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> def saveData():
> insertID = db.mytable.insert(
> field1= request.vars.field1,
> field2 = request.vars.field2
> )
> return str(insertID) ### must return a string not a Reference object.
>
>
>
> On Tuesday, 21 May 2013 07:44:11 UTC-5, software.ted wrote:
>>
>> I have this unusual behavior, this code adds data to the server quiet ok
>> but returns "Server Error" am expecting an integer
>>
>> *#Controller*
>> *
>> *
>> def saveData():
>> insertID = db.mytable.insert(
>> field1= request.vars.field1,
>> field2 = request.vars.field2
>> )
>> return insertID
>>
>> Data gets saved quiet well, but the insertID displays "Server Error" I
>> was thinking it returns an ID
>> --
>> ..**..**
>> ...
>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he is
>> all - Thomas Carlyle 1795-1881
>>
>> /~
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] friendly URL for user profile

2013-05-21 Thread Jonathan Lundell
Don't mix the two router styles.

You can set default_application/controller/function outside the context of a 
router; see routes.example.com.

On 20 May 2013, at 5:48 PM, Júlia Rizza  wrote:

> So I have this on my routes.py:
> 
> routers = dict(
> BASE = dict(
> default_application = 'kolaborativa',
> default_controller = 'default',
> default_function = 'index'
> ),
> )
> 
> routes_in = (
> # do not reroute admin unless you want to disable it
> (BASE + '/admin', '/admin/default/index'),
> (BASE + '/admin/$anything', '/admin/$anything'),
> # do not reroute appadmin unless you want to disable it
> (BASE + '/$app/appadmin', '/$app/appadmin/index'),
> (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
> # do not reroute static files
> (BASE + '/$app/static/$anything', '/$app/static/$anything'),
> # reroute favicon and robots, use exable for lack of better choice
> ('/favicon.ico', '/examples/static/favicon.ico'),
> ('/robots.txt', '/examples/static/robots.txt'),
> # do other stuff
> ((r'.*http://otherdomain.com.* (?P.*)', r'/app/ctr\g')),
> # remove the BASE prefix
> ('/$username', BASE + 'user_info/$username'),
> )
> 
> routes_out = (
> # do not reroute admin unless you want to disable it
> ('/admin/$anything', BASE + '/admin/$anything'),
> # do not reroute appadmin unless you want to disable it
> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
> # do not reroute static files
> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
> # do other stuff
> (r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
> (r'/app(?P.*)', r'\g'),
> # restore the BASE prefix
> (BASE + 'user_info/$username', '/$username'),
> )
> 
> This way I still need to access http://localhost:8000/user_info/username to 
> see the user profile and I want to access just http://localhost:8000/username.
> Can someone help me?
> 
> 
> -- 
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] friendly URL for user profile

2013-05-21 Thread Jonathan Lundell
On 21 May 2013, at 6:20 AM, Jonathan Lundell  wrote:

> You can set default_application/controller/function outside the context of a 
> router; see routes.example.com.

routes.example.py, that is

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Jurgis Pralgauskis
but even app-specific routes must be specified outside app folder (in
web2py root)?


On Tue, May 21, 2013 at 3:01 PM, Anthony  wrote:

> routes_onerror can specify app-specific routes.
>
>
> On Tuesday, May 21, 2013 4:48:01 AM UTC-4, Jurgis Pralgauskis wrote:
>
>> I mean routes.py is in web2py root, not in app folder..
>>
>>
>> On Tue, May 21, 2013 at 11:47 AM, Jurgis Pralgauskis <
>> jurgis.pr...@gmail.com> wrote:
>>
>>> but rootes are described per web2py, not per app..?
>>>
>>>
>>> On Tue, May 21, 2013 at 10:49 AM, Niphlod  wrote:
>>>
 there are routes to manage custom error pages.
 http://web2py.com/books/**default/chapter/29/04#Routes-**on-error

 Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis ha
 scritto:

> Hi,
>
> clicking ticket link each time becomes frustrating (time wasting)
> [SOLVED] :)
>
> I looked arround and tried example from http://www.dev-explorer.**c**
> om/articles/full-page-iframe
> you only need to escape % for sizing.
> my routes.py: 
> http://pastebin.**com**/bfKYEhet
>
>
>
> ps.: could error message be customized per app?
> then I could include in my demo (skeleton) app for students - as my
> students work through web interface (and I don't want to bother them too
> much with other issues)...
>
>  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 topic/web2py/Qg1O99ojkdo/**unsubscribe?hl=en
 .
 To unsubscribe from this group and all its topics, send an email to
 web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .



>>>
>>>
>>>
>>> --
>>> Jurgis Pralgauskis
>>> tel: 8-616 77613;
>>> Don't worry, be happy and make things better ;)
>>> http://galvosukykla.lt
>>>
>>
>>
>>
>> --
>> Jurgis Pralgauskis
>> tel: 8-616 77613;
>> Don't worry, be happy and make things better ;)
>> http://galvosukykla.lt
>>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: update_or_insert doesn't always return the corresponding row id

2013-05-21 Thread Robin Manoli
is it really another query? isn't there already a query to see if there is 
a post to update?

it's quite strange that an id is only returned if a new row is inserted, it 
is not very logical.

even if this function is not to be changed, how about the possibility to 
add, when you really need the id:
db.update_or_insert(condition, values).id()?

Den tisdagen den 23:e oktober 2012 kl. 10:25:38 UTC+2 skrev Niphlod:
>
> that would require another query (no thanks!). No database on an update 
> gives you back the ids of the records you updated, just the number of rows.
>
> Suppose you did db.update_or_insert(condition, values)
>
> If you are in the need just db(condition).select(table.id) after that.
>
> On Tuesday, October 23, 2012 3:15:44 AM UTC+2, Adi wrote:
>>
>> Stumbled upon the same thing.
>>
>> Understood that possibly results could  have more ids when key is 
>> different from primary key, e.g (name=='john'), but would it be possible to 
>> return an additional parameter with update id(s), if they are known? 
>>
>> return newid, updateids
>>
>>
>> On Friday, December 30, 2011 12:31:37 PM UTC-5, olivier wrote:
>>>
>>> The "insert" method returns the id of the inserted row. 
>>> The "update_or_insert" method returns the id of the inserted row, but 
>>> returns None in case of an update... 
>>>
>>> Why is it so? 
>>>
>>> I have a case in which I want to update_or_insert and then further 
>>> update the corresponding row (to track the status of a long running 
>>> process). 
>>> I would rather have the method to always output the id of the updated/ 
>>> inserted row... 
>>> Or is there any use-case you would like to discriminate between the 
>>> fact you inserted or update a row? 
>>>
>>> What do you think? 
>>>
>>>   -Olivier 
>>>
>>>
>>> From dal.py (I added the proposed modification) 
>>> === 
>>>
>>> def update_or_insert(self, key=DEFAULT, **values): 
>>>   if key==DEFAULT: 
>>> record = self(**values) 
>>>   else: 
>>> record = self(key) 
>>>if record: 
>>> record.update_record(**values) 
>>> newid = None  #--> why not record['id']  
>>>else: 
>>>  newid = self.insert(**values) 
>>>return newid
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: update_or_insert doesn't always return the corresponding row id

2013-05-21 Thread Niphlod


Il giorno martedì 21 maggio 2013 16:42:46 UTC+2, Robin Manoli ha scritto:
>
> is it really another query? isn't there already a query to see if there is 
> a post to update?


come up with a SQL syntax that returns the PK of updated records and we'll 
try it. I'm pretty sure there isn't any but I'm open to possible 
implementations.
 
 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] rss feed

2013-05-21 Thread greaneym
hello,
I am trying to learn about rss feeds.

using the feed_parser.py I can have a view with 
rss_aggregator 

that will correctly display this feed,
http://w1.weather.gov/xml/current_obs/KDPA.xml

Also if, instead of that view I use,
{{=LOAD('default','rss_aggregator')}}

It still partially works with no errors, but does not load any image files.

How can I make this view show the associated image files from the noaa site?

Additionally I tried the pluginwiki wp2 file from the application cookbook 
and wow, is that nice, but trying the rss feed in that
I get an error about 
d.channel.title, and more errors about that dict. I use this view,

{{ =plugin_wiki.widget('aggregator',max_entries=4, 
feed='http://w1.weather.gov/xml/current_obs/KDPA.xml') }}

but this xml feed does work,
{{ =plugin_wiki.widget('aggregator',max_entries=4, 
feed='feed://www.rss.noaa.gov/noaa-gov.xml') }}

so I'm learning that xml feeds work differently.

How can I get http://w1.weather.gov/xml/current_obs/KDPA.xml to work either 
with the LOAD command and it will find the image files, too,
or with the plugin-wiki?


Thanks for any suggestions,

Margaret

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: update_or_insert doesn't always return the corresponding row id

2013-05-21 Thread Robin Manoli
I mean before doing the update, how does web2py know if there is a record 
to update? I mean to get the id from there.

Den tisdagen den 21:e maj 2013 kl. 17:04:40 UTC+2 skrev Niphlod:
>
>
>
> Il giorno martedì 21 maggio 2013 16:42:46 UTC+2, Robin Manoli ha scritto:
>>
>> is it really another query? isn't there already a query to see if there 
>> is a post to update?
>
>
> come up with a SQL syntax that returns the PK of updated records and we'll 
> try it. I'm pretty sure there isn't any but I'm open to possible 
> implementations.
>  
>  
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Inner join with condition

2013-05-21 Thread Robin Manoli
I'm trying to get records using inner join, but the result I get is wrong.

Here is my code, in a view:
*{{for page in pages:}}page.name
*
*{{for row in db( db.tag.id==db.page_tag.tag_id, 
db.page_tag.page_id==page.id ).select():}}{{=row.tag.name+str(page.id)}} 
{{pass}}
*
*{{pass}}
*

The tables page and tag are in a many-to-many relation with the table 
page_tag. Since I'm looping each page in the outer loop, I want to find all 
of each page's tags. Each row of page_tag belongs to one tag(and one page), 
so it has a one-to-many relation to the tagtable, right?

Now, I want to inner join tag with page_tag, but select only those rows 
which has page_id==page.id. Is this query correct for that purpose? What am 
I doing wrong?
*db(*
*db.tag.id==db.page_tag.tag_id, # do the JOIN*
*db.page_tag.page_id==page.id # do the WHERE*
*).select()*

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Error page with ticket in iframe -- no need for extra click each time ;)?

2013-05-21 Thread Anthony
You can app-specific routes in the app folder, but then you still need to 
specify routes_app in the root routes.py to tell web2py which apps have 
app-specific routes.

Anthony

On Tuesday, May 21, 2013 10:01:41 AM UTC-4, Jurgis Pralgauskis wrote:
>
> but even app-specific routes must be specified outside app folder (in 
> web2py root)?
>
>
> On Tue, May 21, 2013 at 3:01 PM, Anthony  >wrote:
>
>> routes_onerror can specify app-specific routes.
>>
>>
>> On Tuesday, May 21, 2013 4:48:01 AM UTC-4, Jurgis Pralgauskis wrote:
>>
>>> I mean routes.py is in web2py root, not in app folder..
>>>
>>>
>>> On Tue, May 21, 2013 at 11:47 AM, Jurgis Pralgauskis <
>>> jurgis.pr...@gmail.com> wrote:
>>>
 but rootes are described per web2py, not per app..?


 On Tue, May 21, 2013 at 10:49 AM, Niphlod  wrote:

> there are routes to manage custom error pages.
> http://web2py.com/books/**default/chapter/29/04#Routes-**on-error
>
> Il giorno martedì 21 maggio 2013 09:40:09 UTC+2, Jurgis Pralgauskis ha 
> scritto:
>
>> Hi, 
>>
>> clicking ticket link each time becomes frustrating (time wasting) 
>> [SOLVED] :)
>>
>> I looked arround and tried example from http://www.dev-explorer.**c**
>> om/articles/full-page-iframe
>> you only need to escape % for sizing.
>> my routes.py: 
>> http://pastebin.**com**/bfKYEhet
>>
>>
>>
>> ps.: could error message be customized per app? 
>> then I could include in my demo (skeleton) app for students - as my 
>> students work through web interface (and I don't want to bother them too 
>> much with other issues)...
>>
>>  -- 
>  
> --- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**
> topic/web2py/Qg1O99ojkdo/**unsubscribe?hl=en
> .
>  To unsubscribe from this group and all its topics, send an email to 
> web2py+un...@**googlegroups.com.
>
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>  
>  
>



 -- 
 Jurgis Pralgauskis
 tel: 8-616 77613;
 Don't worry, be happy and make things better ;)
 http://galvosukykla.lt 

>>>
>>>
>>>
>>> -- 
>>> Jurgis Pralgauskis
>>> tel: 8-616 77613;
>>> Don't worry, be happy and make things better ;)
>>> http://galvosukykla.lt 
>>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/Qg1O99ojkdo/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Jurgis Pralgauskis
> tel: 8-616 77613;
> Don't worry, be happy and make things better ;)
> http://galvosukykla.lt 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Memory leak, SQLite, Windows (7, 2008)

2013-05-21 Thread Simon Ashley
Experiencing memory leaks when updating 500k records using either of the 
following routines. 
Quite reproducible, and running tests on both windows 7 and 2008 servers 
(servers with 8 and 12G ram)
Initial speed tests suggest 100 recs per second, but routines fail to 
complete after 3 hours. 
Have tried with and without caching.
Using current trunk and stable versions.

Currently exporting the entire db, deleting the database and reimporting 
(have tried rebuilds through SQLite Manager).
If that doesn't work, looking at swapping databases, but before we do that 
... Any comments or ideas?

Wondering if the initial selects are too big and need to be split?
(haven't tried caching to the disk yet)
If that is the issue, are there any recommended strategies?


def update_TABLE_A_1():
import datetime
a = datetime.datetime.now()
q = db1(db1.TABLE_A.ITEM_ID == db1.TABLE_B.id).select(cache=(cache.ram,
600),cacheable=True, limitby=(0,100)) #limitby merely to test speed and 
ranges, tried with and without caching
for row in q:
db1.TABLE_A.update_or_insert(db1.TABLE_A.ITEM_ID == 
row.TABLE_B.id,FIELD_A1 
= row.TABLE_B.FIELD_B2, FIELD_A2 = row.TABLE_B.FIELD_B3, FIELD_A3 = row.
TABLE_B.FIELD_B4, FIELD_A4 = row.TABLE_B.FIELD_B5)
b = datetime.datetime.now()
b1 = b-a
return str(b1)


def update_TABLE_A_2():
import datetime
a = datetime.datetime.now()
q = db1(db1.TABLE_A > 0).select(limitby=(0,100))
for row in q:
q1 = db1(db1.TABLE_B == row.id).select(cache=(cache.ram,600),
cacheable=True, limitby=(0,1))
row.update_record(FIELD_A = q1[0].FIELD_B1, FIELD_B = q1[0].FIELD_B2
, FIELD_C = q1[0].FIELD_B3, FIELD_D = q1[0].FIELD_B4)
b = datetime.datetime.now()
b1 = b-a
b2 = b1.seconds/1000
return (str(b1), str(b2))

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: update_or_insert doesn't always return the corresponding row id

2013-05-21 Thread Anthony
.update_or_insert() does in fact do an initial query to retrieve the first 
record that matches, so presumably it could just return the id of that 
record rather than returning None. The problem, though, is that you would 
then have no way of knowing whether it had done an update or an insert. A 
better option might be for it to return the entire record in case of an 
update -- then you can distinguish between an insert (which returns and id) 
and an update (which returns a record). However, that might create backward 
compatibility problems in cases where a test for any return value is used 
to distinguish insert from update. To get around that, perhaps we could add 
an argument to explicitly request the record:

db.mytable.update_or_insert(_return_record=True, name='Bob', city='Chicago')

_return_record would default to False to preserve backward compatibility.

Anthony

On Tuesday, May 21, 2013 11:26:27 AM UTC-4, Robin Manoli wrote:
>
> I mean before doing the update, how does web2py know if there is a record 
> to update? I mean to get the id from there.
>
> Den tisdagen den 21:e maj 2013 kl. 17:04:40 UTC+2 skrev Niphlod:
>>
>>
>>
>> Il giorno martedì 21 maggio 2013 16:42:46 UTC+2, Robin Manoli ha scritto:
>>>
>>> is it really another query? isn't there already a query to see if there 
>>> is a post to update?
>>
>>
>> come up with a SQL syntax that returns the PK of updated records and 
>> we'll try it. I'm pretty sure there isn't any but I'm open to possible 
>> implementations.
>>  
>>  
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: How to store data records for recurrent jQuery call

2013-05-21 Thread Alan Etkin

>
> You could then write some javascript to populate block 2 using the rec 
> object created...
>

I think this alternative should do what you want too:

(in a view)

{{=SCRIPT("""
var myRows = %(rows)s;
""" % dict(rows=.select().as_json()))}}


Then you can access the record values in myRows[n].fieldname from the 
jQuery event handlers.
 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Inner join with condition

2013-05-21 Thread Anthony


> *db(*
> *db.tag.id==db.page_tag.tag_id, # do the JOIN*
> *db.page_tag.page_id==page.id # do the WHERE*
> *).select()*
>

Where did you see that syntax for a multi-condition query? For queries with 
multiple conditions, you either use & or chain calls to the Set objects:

db((query1) & (query2) & (query3)).select()

or

db(query1)(query2)(query3).select()

If you want to view the SQL generated by a select, call ._select() instead 
of .select() -- that will return a string with the SQL rather than actually 
executing the query (there's also ._update(), ._insert(),  ._delete(), and 
._count()). Another option is to include {{=response.toolbar()}} in the 
view, which includes a button to show all the queries done during the 
request (and how long they took). You can also access this information 
directly via db._timings at any time. Finally, db._lastsql can be used to 
view the most recently executed SQL command.

Anthony

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Scaling + performance tips to prepare for launch

2013-05-21 Thread smogzer
Hi folks,

I'm about to launch my site (http://nizen.net) and before launching i would
like some scaling tips.

Right now i've done the following:
- using cloudflare for CDN.
- compiled web2py .py -> .pyc
- in 0.py session.forget(response)
- settings.migrate = False

I'm using openshift also. If i try to reach the big sites (engadget,
reddit, etc) i fear it may get the site broken.

Any (other) tips ?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Scaling + performance tips to prepare for launch

2013-05-21 Thread Niphlod
the session.forget(response) will render all session related features 
useless. Use wisely.
I'd add lazy_tables=True to your points, as well as a good cache backend 
and possibily the use of wise cache headers in the response.

On Tuesday, May 21, 2013 7:34:28 PM UTC+2, smoggy wrote:
>
> Hi folks,
>
> I'm about to launch my site (http://nizen.net) and before launching i 
> would like some scaling tips.
>
> Right now i've done the following:
> - using cloudflare for CDN.
> - compiled web2py .py -> .pyc
> - in 0.py session.forget(response)
> - settings.migrate = False
>
> I'm using openshift also. If i try to reach the big sites (engadget, 
> reddit, etc) i fear it may get the site broken.
>
> Any (other) tips ?
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Session variables disappearing

2013-05-21 Thread Rob Mayhue
Hi everyone,

Long time lurker... first question I've had to ask. I usually find answers 
here without having to ask.

I'm having a problem with session variables I've added when a user logs in 
disappearing after a while and throwing exceptions when attempting to 
access them later on and I'm trying to get this sorted.

I'm adding the session variables 
using auth.settings.login_onaccept.append(_load_settings). The 
_load_settings() function gets some account settings from the database and 
adds them into the users session. The app has been in limited use for about 
a month now and a while ago I started seeing tickets with exceptions being 
thrown when I'm trying to access the session variables and/or change them. 
When looking at the tickets and examining the session variables, all of the 
auth variables are all present but all of the variables that were added 
using auth.settings.login_onaccept.append() are gone. There is no 
indication that the user was ever logged out or that the session expired 
etc.

A search of this list about similar questions seemed to indicate a 
possibility of the IP address changing due to some type of IP address 
rotation scheme etc., a proxy deleting session cookies, or some other 
similar thing, but I guess where I'm getting confused is; wouldn't the 
entire session get blown away which would require the user to need to login 
again? It seems as if the user has been logged in the entire time and 
somehow the variables I added where removed.

It only seems to happen occasionally, not during every user session, so it 
may be related to one of the conditions covered previously, but I don't see 
consistent similarities in the tickets (i.e. same user agent etc), only the 
errors are the same.

Has anyone else seen this before and/or is my strategy of using the session 
the best way to accomplish adding global per user variables?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] no web2py version showing?

2013-05-21 Thread Len Conrad
above my CHECK FOR UPGRADES button:

"Version

(2, 3, 2, datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable')
(Running on Rocket 1.2.6)"


... on FF and Chrome.


Is this right?


Len

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: friendly URL for user profile

2013-05-21 Thread Júlia Rizza
Thank you all! I'm less confused now about the routes and it's everything 
working.
Thanks for the code Massimo, it makes everything much more easier to 
understand.

Em terça-feira, 21 de maio de 2013 09h37min30s UTC-3, Massimo Di Pierro 
escreveu:
>
> I think you want:
>
> BASE = ''
>
> routes_in = (
> # do not reroute admin unless you want to disable it
> (BASE + '/admin/$anything', '/admin/$anything'),
> # do not reroute appadmin unless you want to disable it
> (BASE + '/$app/appadmin', '/$app/appadmin/index'),
> (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
> # do not reroute static files
> (BASE + '/$app/static/$anything', '/$app/static/$anything'),
> # reroute favicon and robots, use exable for lack of better choice
> (BASE + '/favicon.ico', '/examples/static/favicon.ico'),
> (BASE + '/robots.txt', '/examples/static/robots.txt'),
> # kolaborativa specific
> (BASE + '/$username', BASE + 
> '/kolaborativa/default/user_info/$username'),
> (BASE + '/kolaborativa/$anything', BASE + '/kolaborativa/$anything'),
> )
>
> routes_out = (
> # do not reroute admin unless you want to disable it
> ('/admin/$anything', BASE + '/admin/$anything'),
> # do not reroute appadmin unless you want to disable it
> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
> # do not reroute static files
> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
> # do other stuff
> (r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
> (r'/app(?P.*)', r'\g'),
> # restore the BASE prefix
> ('/kolaborativa/default/user_info/$username', BASE+'/$username'),
> )
>
>
> Mind that you will no longer be able to do visit:
>
> http://.../admin
>
> because it will be interpreted as a username. You can instead do
>
> http://.../admin/default/site
>
> Hope this helps.
>
> Massimo
>
>
> On Monday, 20 May 2013 19:48:16 UTC-5, Júlia Rizza wrote:
>>
>> So I have this on my *routes.py*:
>>
>> routers = dict(
>> BASE = dict(
>> default_application = 'kolaborativa',
>> default_controller = 'default',
>> default_function = 'index'
>> ),
>> )
>>
>> routes_in = (
>> # do not reroute admin unless you want to disable it
>> (BASE + '/admin', '/admin/default/index'),
>> (BASE + '/admin/$anything', '/admin/$anything'),
>> # do not reroute appadmin unless you want to disable it
>> (BASE + '/$app/appadmin', '/$app/appadmin/index'),
>> (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
>> # do not reroute static files
>> (BASE + '/$app/static/$anything', '/$app/static/$anything'),
>> # reroute favicon and robots, use exable for lack of better choice
>> ('/favicon.ico', '/examples/static/favicon.ico'),
>> ('/robots.txt', '/examples/static/robots.txt'),
>> # do other stuff
>> ((r'.*http://otherdomain.com.* (?P.*)', r'/app/ctr\g')),
>> # remove the BASE prefix
>> ('/$username', BASE + 'user_info/$username'),
>> )
>>
>> routes_out = (
>> # do not reroute admin unless you want to disable it
>> ('/admin/$anything', BASE + '/admin/$anything'),
>> # do not reroute appadmin unless you want to disable it
>> ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
>> # do not reroute static files
>> ('/$app/static/$anything', BASE + '/$app/static/$anything'),
>> # do other stuff
>> (r'.*http://otherdomain.com.* /app/ctr(?P.*)', r'\g'),
>> (r'/app(?P.*)', r'\g'),
>> # restore the BASE prefix
>> (BASE + 'user_info/$username', '/$username'),
>> )
>>
>> This way I still need to access* http://localhost:8000/user_info/username
>> * to see the user profile and I want to access just *
>> http://localhost:8000/username*.
>> Can someone help me?
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Memory leak, SQLite, Windows (7, 2008)

2013-05-21 Thread Niphlod
500k records for 2 tables (total 1M) on SQLite, heavy update scenario.. 
I really hope you'll manage that outside the normal web environment to 
avoid timeout issues that are likely to happen.
I'll try to reproduce though.

On Tuesday, May 21, 2013 6:35:14 PM UTC+2, Simon Ashley wrote:
>
> Experiencing memory leaks when updating 500k records using either of the 
> following routines. 
> Quite reproducible, and running tests on both windows 7 and 2008 servers 
> (servers with 8 and 12G ram)
> Initial speed tests suggest 100 recs per second, but routines fail to 
> complete after 3 hours. 
> Have tried with and without caching.
> Using current trunk and stable versions.
>
> Currently exporting the entire db, deleting the database and reimporting 
> (have tried rebuilds through SQLite Manager).
> If that doesn't work, looking at swapping databases, but before we do that 
> ... Any comments or ideas?
>
> Wondering if the initial selects are too big and need to be split?
> (haven't tried caching to the disk yet)
> If that is the issue, are there any recommended strategies?
>
>
> def update_TABLE_A_1():
> import datetime
> a = datetime.datetime.now()
> q = db1(db1.TABLE_A.ITEM_ID == db1.TABLE_B.id).select(cache=(cache.ram
> ,600),cacheable=True, limitby=(0,100)) #limitby merely to test speed 
> and ranges, tried with and without caching
> for row in q:
> db1.TABLE_A.update_or_insert(db1.TABLE_A.ITEM_ID == row.TABLE_B.id
> , FIELD_A1 = row.TABLE_B.FIELD_B2, FIELD_A2 = row.TABLE_B.FIELD_B3,FIELD_A3 
> = row.TABLE_B.FIELD_B4, FIELD_A4 = row.TABLE_B.FIELD_B5)
> b = datetime.datetime.now()
> b1 = b-a
> return str(b1)
>
>
> def update_TABLE_A_2():
> import datetime
> a = datetime.datetime.now()
> q = db1(db1.TABLE_A > 0).select(limitby=(0,100))
> for row in q:
> q1 = db1(db1.TABLE_B == row.id).select(cache=(cache.ram,600),
> cacheable=True, limitby=(0,1))
> row.update_record(FIELD_A = q1[0].FIELD_B1, FIELD_B = q1[0].
> FIELD_B2, FIELD_C = q1[0].FIELD_B3, FIELD_D = q1[0].FIELD_B4)
> b = datetime.datetime.now()
> b1 = b-a
> b2 = b1.seconds/1000
> return (str(b1), str(b2))
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Memory leak, SQLite, Windows (7, 2008)

2013-05-21 Thread Niphlod
using the first method without cache (see below, it seems unuseful) no 
leaks at least in ubuntu.
30k records updated/inserted in a little less than 5 minutes.
storage.db is roughly 2 GB.
Memory usage is 400MB, give or take.

the second method is incorrect as posted ... maybe there are a few typos in 
it (and surely it doesn't replicate the first one (it just updates without 
inserting))

In any case for a live application those needs to be managed outside 
web2py. While you do those procedures the db is entirely locked, so it's a 
no-go if you want to do something with it in the meantime.


PS: why caching is involved ?
once you cache the resultset it's invalidated from the updates you're doing 
in it subsequently. It's just wasting ram on a not valid resultset anyway 
^_^
Also, forget cache.disk, it wont' definitely be faster than SQLite.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Please explain how this query works

2013-05-21 Thread bracquet
Is there a section in the online web2py book that explains Niphlod's way to 
building a query?

Near the bottom of this 
thread 
there 
is:

all_in_one = db(
(db.products.id == db.product_filter.product_id) &
(db.filters.id == db.product_filter.filter_id) 
)

Then to get all corresponding rows in product_filter table,

all_in_one_hoodies = all_in_one(db.filters.name == "hoodie").select()

I understand his cumbersome example, where you have to select a resultset 
and then pass that to another select(). But I don't understand how I can 
pass all_in_one() a parameter and how it knows to return all products which 
have the "hoodie" filter name.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Please explain how this query works

2013-05-21 Thread Anthony
db(some_query) creates a DAL Set object (on which you can then call methods 
such as .select(), .update(), etc.). A Set object is also callable, and if 
you call it by passing in another query, it will simply add the new query 
as an AND condition. So, that code is just equivalent to:

db(
(db.products.id == db.product_filter.product_id) &
(db.filters.id == db.product_filter.filter_id) &
(db.filters.name == "hoodie")
)

or

db(db.products.id == db.product_filter.product_id)(db.filters.id == db.
product_filter.filter_id)\
(db.filters.name == "hoodie")

The idea is that you can create a base Set object and then use it to create 
more specific sets by adding different conditions.

Anthony

On Tuesday, May 21, 2013 4:02:00 PM UTC-4, brac...@gmail.com wrote:
>
> Is there a section in the online web2py book that explains Niphlod's way 
> to building a query?
>
> Near the bottom of this 
> thread
>  there 
> is:
>
> all_in_one = db(
> (db.products.id == db.product_filter.product_id) &
> (db.filters.id == db.product_filter.filter_id) 
> )
>
> Then to get all corresponding rows in product_filter table,
>
> all_in_one_hoodies = all_in_one(db.filters.name == "hoodie").select()
>
> I understand his cumbersome example, where you have to select a resultset 
> and then pass that to another select(). But I don't understand how I can 
> pass all_in_one() a parameter and how it knows to return all products which 
> have the "hoodie" filter name.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Please explain how this query works

2013-05-21 Thread Anthony
Note, I'm not sure the fact that a Set is callable is documented in the 
book.

On Tuesday, May 21, 2013 4:14:48 PM UTC-4, Anthony wrote:
>
> db(some_query) creates a DAL Set object (on which you can then call 
> methods such as .select(), .update(), etc.). A Set object is also callable, 
> and if you call it by passing in another query, it will simply add the new 
> query as an AND condition. So, that code is just equivalent to:
>
> db(
> (db.products.id == db.product_filter.product_id) &
> (db.filters.id == db.product_filter.filter_id) &
> (db.filters.name == "hoodie")
> )
>
> or
>
> db(db.products.id == db.product_filter.product_id)(db.filters.id == db.
> product_filter.filter_id)\
>   (db.filters.name == "hoodie")
>
> The idea is that you can create a base Set object and then use it to 
> create more specific sets by adding different conditions.
>
> Anthony
>
> On Tuesday, May 21, 2013 4:02:00 PM UTC-4, brac...@gmail.com wrote:
>>
>> Is there a section in the online web2py book that explains Niphlod's way 
>> to building a query?
>>
>> Near the bottom of this 
>> thread
>>  there 
>> is:
>>
>> all_in_one = db(
>> (db.products.id == db.product_filter.product_id) &
>> (db.filters.id == db.product_filter.filter_id) 
>> )
>>
>> Then to get all corresponding rows in product_filter table,
>>
>> all_in_one_hoodies = all_in_one(db.filters.name == "hoodie").select()
>>
>> I understand his cumbersome example, where you have to select a resultset 
>> and then pass that to another select(). But I don't understand how I can 
>> pass all_in_one() a parameter and how it knows to return all products which 
>> have the "hoodie" filter name.
>>
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Inner join with condition

2013-05-21 Thread Robin Manoli
ok that worked... thanks

I suppose I had my eyes on this line of code...

db.person.update_or_insert(name='John',birthplace='Chicago')


Den tisdagen den 21:e maj 2013 kl. 19:18:29 UTC+2 skrev Anthony:
>
>
> *db(*
>> *db.tag.id==db.page_tag.tag_id, # do the JOIN*
>> *db.page_tag.page_id==page.id # do the WHERE*
>> *).select()*
>>
>
> Where did you see that syntax for a multi-condition query? For queries 
> with multiple conditions, you either use & or chain calls to the Set 
> objects:
>
> db((query1) & (query2) & (query3)).select()
>
> or
>
> db(query1)(query2)(query3).select()
>
> If you want to view the SQL generated by a select, call ._select() instead 
> of .select() -- that will return a string with the SQL rather than actually 
> executing the query (there's also ._update(), ._insert(),  ._delete(), and 
> ._count()). Another option is to include {{=response.toolbar()}} in the 
> view, which includes a button to show all the queries done during the 
> request (and how long they took). You can also access this information 
> directly via db._timings at any time. Finally, db._lastsql can be used to 
> view the most recently executed SQL command.
>
> Anthony
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Please explain how this query works

2013-05-21 Thread bracquet
Hm, but how does it know to return a set object from the product_filter 
table rather than the product or filter table?

And what does these two queries mean when it comes executing the queries?
(db.products.id == db.product_filter.product_id) &
(db.filters.id == db.product_filter.filter_id) &

Does it work something like this: 

Return the set object that contains the filter name "hoodie"
(db.filters.name == "hoodie")

Then, knowing the id of the filter from the previous result set, find all 
the matching filter id in the product_filter table.
 (db.filters.id == db.product_filter.filter_id)

Now find all the products that has the same filter ids?
 (db.products.id == db.product_filter.product_id) &

But then why even do the last part? Wouldn't db.filters.id == 
db.product_filter.filter_id already give you the rows you'd want from 
product_filter table?

On Tuesday, May 21, 2013 4:19:29 PM UTC-4, Anthony wrote:
>
> Note, I'm not sure the fact that a Set is callable is documented in the 
> book.
>
> On Tuesday, May 21, 2013 4:14:48 PM UTC-4, Anthony wrote:
>>
>> db(some_query) creates a DAL Set object (on which you can then call 
>> methods such as .select(), .update(), etc.). A Set object is also callable, 
>> and if you call it by passing in another query, it will simply add the new 
>> query as an AND condition. So, that code is just equivalent to:
>>
>> db(
>> (db.products.id == db.product_filter.product_id) &
>> (db.filters.id == db.product_filter.filter_id) &
>> (db.filters.name == "hoodie")
>> )
>>
>> or
>>
>> db(db.products.id == db.product_filter.product_id)(db.filters.id == db.
>> product_filter.filter_id)\
>>   (db.filters.name == "hoodie")
>>
>> The idea is that you can create a base Set object and then use it to 
>> create more specific sets by adding different conditions.
>>
>> Anthony
>>
>> On Tuesday, May 21, 2013 4:02:00 PM UTC-4, brac...@gmail.com wrote:
>>>
>>> Is there a section in the online web2py book that explains Niphlod's 
>>> way to building a query?
>>>
>>> Near the bottom of this 
>>> thread
>>>  there 
>>> is:
>>>
>>> all_in_one = db(
>>> (db.products.id == db.product_filter.product_id) &
>>> (db.filters.id == db.product_filter.filter_id) 
>>> )
>>>
>>> Then to get all corresponding rows in product_filter table,
>>>
>>> all_in_one_hoodies = all_in_one(db.filters.name == "hoodie").select()
>>>
>>> I understand his cumbersome example, where you have to select a 
>>> resultset and then pass that to another select(). But I don't understand 
>>> how I can pass all_in_one() a parameter and how it knows to return all 
>>> products which have the "hoodie" filter name.
>>>
>>>
>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Scaling + performance tips to prepare for launch

2013-05-21 Thread Paolo valleri
It is worth to check this too 
https://developers.google.com/speed/pagespeed/insights

Paolo

On Tuesday, May 21, 2013 8:40:20 PM UTC+2, Niphlod wrote:
>
> the session.forget(response) will render all session related features 
> useless. Use wisely.
> I'd add lazy_tables=True to your points, as well as a good cache backend 
> and possibily the use of wise cache headers in the response.
>
> On Tuesday, May 21, 2013 7:34:28 PM UTC+2, smoggy wrote:
>>
>> Hi folks,
>>
>> I'm about to launch my site (http://nizen.net) and before launching i 
>> would like some scaling tips.
>>
>> Right now i've done the following:
>> - using cloudflare for CDN.
>> - compiled web2py .py -> .pyc
>> - in 0.py session.forget(response)
>> - settings.migrate = False
>>
>> I'm using openshift also. If i try to reach the big sites (engadget, 
>> reddit, etc) i fear it may get the site broken.
>>
>> Any (other) tips ?
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Please explain how this query works

2013-05-21 Thread Niphlod
all those (query) just add a bit of "where" clause in the select that you 
pass to the db.
you can use them with db((query) & (query) & (query)) or with 
db(query)(query)(query) ... the resulting select passed to the db would be 
the same!

On Tuesday, May 21, 2013 10:43:48 PM UTC+2, brac...@gmail.com wrote:
>
> Hm, but how does it know to return a set object from the product_filter 
> table rather than the product or filter table?
>
> And what does these two queries mean when it comes executing the queries?
> (db.products.id == db.product_filter.product_id) &
> (db.filters.id == db.product_filter.filter_id) &
>
> Does it work something like this: 
>
> Return the set object that contains the filter name "hoodie"
> (db.filters.name == "hoodie")
>
> Then, knowing the id of the filter from the previous result set, find all 
> the matching filter id in the product_filter table.
>  (db.filters.id == db.product_filter.filter_id)
>
> Now find all the products that has the same filter ids?
>  (db.products.id == db.product_filter.product_id) &
>
> But then why even do the last part? Wouldn't db.filters.id == 
> db.product_filter.filter_id already give you the rows you'd want from 
> product_filter table?
>
> On Tuesday, May 21, 2013 4:19:29 PM UTC-4, Anthony wrote:
>>
>> Note, I'm not sure the fact that a Set is callable is documented in the 
>> book.
>>
>> On Tuesday, May 21, 2013 4:14:48 PM UTC-4, Anthony wrote:
>>>
>>> db(some_query) creates a DAL Set object (on which you can then call 
>>> methods such as .select(), .update(), etc.). A Set object is also callable, 
>>> and if you call it by passing in another query, it will simply add the new 
>>> query as an AND condition. So, that code is just equivalent to:
>>>
>>> db(
>>> (db.products.id == db.product_filter.product_id) &
>>> (db.filters.id == db.product_filter.filter_id) &
>>> (db.filters.name == "hoodie")
>>> )
>>>
>>> or
>>>
>>> db(db.products.id == db.product_filter.product_id)(db.filters.id == db.
>>> product_filter.filter_id)\
>>>   (db.filters.name == "hoodie")
>>>
>>> The idea is that you can create a base Set object and then use it to 
>>> create more specific sets by adding different conditions.
>>>
>>> Anthony
>>>
>>> On Tuesday, May 21, 2013 4:02:00 PM UTC-4, brac...@gmail.com wrote:

 Is there a section in the online web2py book that explains Niphlod's 
 way to building a query?

 Near the bottom of this 
 thread
  there 
 is:

 all_in_one = db(
 (db.products.id == db.product_filter.product_id) &
 (db.filters.id == db.product_filter.filter_id) 
 )

 Then to get all corresponding rows in product_filter table,

 all_in_one_hoodies = all_in_one(db.filters.name == "hoodie").select()

 I understand his cumbersome example, where you have to select a 
 resultset and then pass that to another select(). But I don't understand 
 how I can pass all_in_one() a parameter and how it knows to return all 
 products which have the "hoodie" filter name.




-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: rss feed

2013-05-21 Thread Massimo Di Pierro


On Tuesday, 21 May 2013 10:05:47 UTC-5, greaneym wrote:
>
> hello,
> I am trying to learn about rss feeds.
>
> using the feed_parser.py I can have a view with 
>  href="/{{=request.application}}/default/rss_aggregator">rss_aggregator
>  
>
> that will correctly display this feed,
> http://w1.weather.gov/xml/current_obs/KDPA.xml
>
>
This appears to be an XML file, not and RSS feed. The header says:

http://www.w3.org/2001/XMLSchema";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

 
xsi:noNamespaceSchemaLocation="http://www.weather.gov/view/current_observation.xsd";>

 

> Also if, instead of that view I use,
> {{=LOAD('default','rss_aggregator')}}
>
> It still partially works with no errors, but does not load any image files.
>
> How can I make this view show the associated image files from the noaa 
> site?
>
> Additionally I tried the pluginwiki wp2 file from the application cookbook 
> and wow, is that nice, but trying the rss feed in that
> I get an error about 
> d.channel.title, and more errors about that dict. I use this view,
>
> {{ =plugin_wiki.widget('aggregator',max_entries=4, feed='
> http://w1.weather.gov/xml/current_obs/KDPA.xml') }}
>
> but this xml feed does work,
> {{ =plugin_wiki.widget('aggregator',max_entries=4, feed='feed://
> www.rss.noaa.gov/noaa-gov.xml') }}
>
> so I'm learning that xml feeds work differently.
>
> How can I get http://w1.weather.gov/xml/current_obs/KDPA.xml to work 
> either with the LOAD command and it will find the image files, too,
> or with the plugin-wiki?
>

Please do not use plugin_wiki. It is deprecates as almost all of its 
features are not in web2py core.


 

>
>
> Thanks for any suggestions,
>
> Margaret
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: no web2py version showing?

2013-05-21 Thread Massimo Di Pierro
No but you have an old version. This should be fixed in more recent 
versions.

On Tuesday, 21 May 2013 13:04:01 UTC-5, WebToePie wrote:
>
>
> above my CHECK FOR UPGRADES button:
>
> "Version
>
> (2, 3, 2, datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable')
> (Running on Rocket 1.2.6)"
>
>
> ... on FF and Chrome.
>
>
> Is this right?
>
>
> Len
>
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Memory leak, SQLite, Windows (7, 2008)

2013-05-21 Thread Massimo Di Pierro
I think what you see what is not leak but a memory increase. You are simply 
putting lots of data in cache.ram.
In web2py cache always increases unless you clear it. It does not run in 
constant memory.

On Tuesday, 21 May 2013 11:35:14 UTC-5, Simon Ashley wrote:
>
> Experiencing memory leaks when updating 500k records using either of the 
> following routines. 
> Quite reproducible, and running tests on both windows 7 and 2008 servers 
> (servers with 8 and 12G ram)
> Initial speed tests suggest 100 recs per second, but routines fail to 
> complete after 3 hours. 
> Have tried with and without caching.
> Using current trunk and stable versions.
>
> Currently exporting the entire db, deleting the database and reimporting 
> (have tried rebuilds through SQLite Manager).
> If that doesn't work, looking at swapping databases, but before we do that 
> ... Any comments or ideas?
>
> Wondering if the initial selects are too big and need to be split?
> (haven't tried caching to the disk yet)
> If that is the issue, are there any recommended strategies?
>
>
> def update_TABLE_A_1():
> import datetime
> a = datetime.datetime.now()
> q = db1(db1.TABLE_A.ITEM_ID == db1.TABLE_B.id).select(cache=(cache.ram
> ,600),cacheable=True, limitby=(0,100)) #limitby merely to test speed 
> and ranges, tried with and without caching
> for row in q:
> db1.TABLE_A.update_or_insert(db1.TABLE_A.ITEM_ID == row.TABLE_B.id
> , FIELD_A1 = row.TABLE_B.FIELD_B2, FIELD_A2 = row.TABLE_B.FIELD_B3,FIELD_A3 
> = row.TABLE_B.FIELD_B4, FIELD_A4 = row.TABLE_B.FIELD_B5)
> b = datetime.datetime.now()
> b1 = b-a
> return str(b1)
>
>
> def update_TABLE_A_2():
> import datetime
> a = datetime.datetime.now()
> q = db1(db1.TABLE_A > 0).select(limitby=(0,100))
> for row in q:
> q1 = db1(db1.TABLE_B == row.id).select(cache=(cache.ram,600),
> cacheable=True, limitby=(0,1))
> row.update_record(FIELD_A = q1[0].FIELD_B1, FIELD_B = q1[0].
> FIELD_B2, FIELD_C = q1[0].FIELD_B3, FIELD_D = q1[0].FIELD_B4)
> b = datetime.datetime.now()
> b1 = b-a
> b2 = b1.seconds/1000
> return (str(b1), str(b2))
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Memory leak, SQLite, Windows (7, 2008)

2013-05-21 Thread Simon Ashley
Thanks Niphlod

Yep, sorry for the typos (@ 4am the brain doesn't function correctly). 
Main point was to describe the 2 methods.
(*update_or_insert *and *row.update_record*)
Actual code would have been too heavy. 

Routines were tested with limitby=(0,1000) in the selects. 
Caching only involved in the *non update* selects (i.e. the reference 
table). 
Improves performance by 50% or more.

Will attempt to break it down into smaller chucks, to see if memory 
releases.

Routines would be eventually handled by a/the scheduler, and while this is 
basically a one off, there will be others requiring the same or greater 
heavy updates.
While will move off SQLite, using it at present for initial data prep.
Wanted to use the DAL as much as possible to make stuff as portable as 
possible in the meantime.

Also using multiple databases to mitigate locking issues.

Will report back.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: rss feed

2013-05-21 Thread Massimo Di Pierro
I think these are the feeds:

feed://alerts.weather.gov/cap/wwaatmget.php?x=ILZ013&y=0

They are in Atom format:




The NOA page is a bit confusing.


On Tuesday, 21 May 2013 10:05:47 UTC-5, greaneym wrote:
>
> hello,
> I am trying to learn about rss feeds.
>
> using the feed_parser.py I can have a view with 
>  href="/{{=request.application}}/default/rss_aggregator">rss_aggregator
>  
>
> that will correctly display this feed,
> http://w1.weather.gov/xml/current_obs/KDPA.xml
>
> Also if, instead of that view I use,
> {{=LOAD('default','rss_aggregator')}}
>
> It still partially works with no errors, but does not load any image files.
>
> How can I make this view show the associated image files from the noaa 
> site?
>
> Additionally I tried the pluginwiki wp2 file from the application cookbook 
> and wow, is that nice, but trying the rss feed in that
> I get an error about 
> d.channel.title, and more errors about that dict. I use this view,
>
> {{ =plugin_wiki.widget('aggregator',max_entries=4, feed='
> http://w1.weather.gov/xml/current_obs/KDPA.xml') }}
>
> but this xml feed does work,
> {{ =plugin_wiki.widget('aggregator',max_entries=4, feed='feed://
> www.rss.noaa.gov/noaa-gov.xml') }}
>
> so I'm learning that xml feeds work differently.
>
> How can I get http://w1.weather.gov/xml/current_obs/KDPA.xml to work 
> either with the LOAD command and it will find the image files, too,
> or with the plugin-wiki?
>
>
> Thanks for any suggestions,
>
> Margaret
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Please explain how this query works

2013-05-21 Thread Robin Manoli
it's explained here:
http://web2py.com/books/default/chapter/29/06#Many-to-many

Den tisdagen den 21:e maj 2013 kl. 22:02:00 UTC+2 skrev brac...@gmail.com:
>
> Is there a section in the online web2py book that explains Niphlod's way 
> to building a query?
>
> Near the bottom of this 
> thread
>  there 
> is:
>
> all_in_one = db(
> (db.products.id == db.product_filter.product_id) &
> (db.filters.id == db.product_filter.filter_id) 
> )
>
> Then to get all corresponding rows in product_filter table,
>
> all_in_one_hoodies = all_in_one(db.filters.name == "hoodie").select()
>
> I understand his cumbersome example, where you have to select a resultset 
> and then pass that to another select(). But I don't understand how I can 
> pass all_in_one() a parameter and how it knows to return all products which 
> have the "hoodie" filter name.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Please explain how this query works

2013-05-21 Thread Anthony

>
> Hm, but how does it know to return a set object from the product_filter 
> table rather than the product or filter table?


Set objects are not associated with a particular table -- they represent a 
set of records to be returned by the db, which may involve a join of 
multiple tables. Basically, the Set object specifies the WHERE clauses in a 
SQL query.
 

> And what does these two queries mean when it comes executing the queries?
> (db.products.id == db.product_filter.product_id) &
> (db.filters.id == db.product_filter.filter_id) &
>

In SQL, there are two ways to specify an inner join -- one is by using the 
INNER JOIN (or just JOIN) command, and the other is by adding a WHERE 
clause that equates the primary key of one table with the associated 
foreign key from the other table. The above queries are using the latter 
method (in web2py, to use the former method, you pass the "join" argument 
to the .select() method).
 

> Does it work something like this: 
>
> Return the set object that contains the filter name "hoodie"
> (db.filters.name == "hoodie")
>
> Then, knowing the id of the filter from the previous result set, find all 
> the matching filter id in the product_filter table.
>  (db.filters.id == db.product_filter.filter_id)
>
> Now find all the products that has the same filter ids?
>  (db.products.id == db.product_filter.product_id) &
>

No, the above find products with id's that match the product_id of the 
records from db.product_filter, not that match the filter id's (there are 
no filter id's in the db.products table). As noted above, the immediately 
preceding two queries are used to join the db.product_filter table to the 
db.filters and db.products tables, respectively. This is necessary because 
this is a many-to-many relationship.

Anthony

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: no web2py version showing?

2013-05-21 Thread Len Conrad
yeah, ok, I tried the page reload and upgrade button, several times before
postting, but something seem corrupted

the upgrade button doesn't do anything

the  rest of web2ypy seems to work correctly

Len



On Tue, May 21, 2013 at 5:26 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> No but you have an old version. This should be fixed in more recent
> versions.
>
>
> On Tuesday, 21 May 2013 13:04:01 UTC-5, WebToePie wrote:
>>
>>
>> above my CHECK FOR UPGRADES button:
>>
>> "Version
>>
>> (2, 3, 2, datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable')
>> (Running on Rocket 1.2.6)"
>>
>>
>> ... on FF and Chrome.
>>
>>
>> Is this right?
>>
>>
>> Len
>>
>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: MYSQL SQL Query to DAL

2013-05-21 Thread Christian Espinoza
Well, so far, I think I've get a DAL query that works like the second SQL 
query(LEFT OUTER JOIN based):

db(db.simcard.phone_line==None).select(db.phone_line.ALL, db.simcard.ALL,
left=db.simcard.on((db.simcard.phone_line==db.phone_line.id)))

I wil trying to solve the main problem with the dropdown select.

Cheers!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] auth.signature modified_on, created_on using utc time

2013-05-21 Thread funmanhk
hi all,

I like to use table inheritance with auth.signature in my model. I see that 
it is working, but it doesn't use utc time. So i added my own field.

1) Is this a recommended approach or there are other ways to modify 
auth.signature?

db.define_table('demo_detail',
   Field('prototype_id', 'reference prototype',label='Prototype Title'),
   Field('info','text'),
   Field('storyboard', 'upload', label='Storyboard'),
   Field('modified_on', 'datetime', update=request.utcnow, writable = 
False),
   Field('created_on', 'datetime', update=request.utcnow, writable = False),
   auth.signature
)

2) I can't seem to see the auth.signature table in my appadmin. Where 
should i modify it if needed?
db.auth_userNew
 
Record 
db.auth_groupNew
 
Record 
db.auth_membershipNew
 
Record 
db.auth_permissionNew
 
Record 
db.auth_eventNew
 
Record 
db.auth_cas

Thank for your help.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: MYSQL SQL Query to DAL

2013-05-21 Thread Christian Espinoza
The problem now is how use that dal query into:

IS_IN_DB(query,db.phone_line.id, '%(phone_number)s')

Because a query object doesn't have a select attribute... :-/

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Upload field and SQLFORM.grid problem / bug?

2013-05-21 Thread David Marko
I have a table with upload field defined as follows: Field('file', 
'upload', uploadseparate=True) . When I create some items using database 
administration, the image is displayed correctly. When I involve 
SQLFORM.grid in my controller, the link to file is not correct. See two 
links below:

OK - this URL is produced by database administration interface
http://localhost:8000/periodicke_cinnosti/appadmin/download/db/item.file.8f5a1d4f8f222113.6e61747572616c6c5f30332e706e67.png

BAD - this URL is produced by SQLFORM.grid
http://localhost:8000/periodicke_cinnosti/default/form/download/item.file.8f5a1d4f8f222113.6e61747572616c6c5f30332e706e67.png

The difference is  'db' just after '/download/' in path. I'm running latest 
web2py trunk version.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Memory leak, SQLite, Windows (7, 2008)

2013-05-21 Thread Niphlod
next time post something close to reality, or reproducing it leads to 
nowhere.
Speed and memory-wise (not leak, but still...), use a straight update() 
over update_record.

BTW, what I still don't understand is you comparing update_or_insert to 
row.update_record they do very different things.
If you don't need the update_or_insert()  functionality - as it seems by 
the query you posted - just go for update(), it's a lot faster.

PS: don't measure times with loads like this on SQlite starting to tune 
your code (e.g. using cache.ram to store a 25k resultset) if you know 
you'll end up with another backend: you are wasting time (assuming you're 
passing to a serious db backend).

PS2: this would be the perfect candidate (memory-wise) to have web2py's DAL 
using iterators instead of doing a fetchall() and stuffing all in the Rows 
object :P

On Wednesday, May 22, 2013 12:34:18 AM UTC+2, Simon Ashley wrote:
>
> Thanks Niphlod
>
> Yep, sorry for the typos (@ 4am the brain doesn't function correctly). 
> Main point was to describe the 2 methods.
> (*update_or_insert *and *row.update_record*)
> Actual code would have been too heavy. 
>
> Routines were tested with limitby=(0,1000) in the selects. 
> Caching only involved in the *non update* selects (i.e. the reference 
> table). 
> Improves performance by 50% or more.
>
> Will attempt to break it down into smaller chucks, to see if memory 
> releases.
>
> Routines would be eventually handled by a/the scheduler, and while this is 
> basically a one off, there will be others requiring the same or greater 
> heavy updates.
> While will move off SQLite, using it at present for initial data prep.
> Wanted to use the DAL as much as possible to make stuff as portable as 
> possible in the meantime.
>
> Also using multiple databases to mitigate locking issues.
>
> Will report back.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.