[web2py] Re: Smartgrid: Display name as string instead of id?

2014-02-26 Thread Tom Campbell
Thanks, Stifan! Turns out I was working too hard. This is the modern way to 
do it.

model db_pos.py:

db=DAL('sqlite://storage.sqlite')

db.define_table('supplier', Field('name'), format='%(name)s')

db.define_table('item', Field('name'), Field('supplied_by', db.supplier))

controller default.py:

@auth.requires_login()

def items():

   grid=SQLFORM.grid(db.item)

   return locals()

@auth.requires_login()

def suppliers():

   grid=SQLFORM.grid(db.supplier)

   return locals()

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] Roadmap

2014-02-26 Thread webpypy
Hi,

is there something like this

http://dev.splunk.com/view/web-framework/SP-CAAAER6

in the roadmap?

Regards,

Ashraf

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Strange 'SQLTABLE linkto' behaviour

2014-02-26 Thread mcamel
Looking at gluon/sqltml.py code i think i realized how 'linkto' works:

   - is a lambda is passed, it's used to generate the href
   - if not, a string is concatenated: href = '%s/%s/%s' % (linkto, 
   tablename, r_old)

The manual says nothing about expecting a lambda, so i figured out you have 
to pass an URL and after that, 'tablename' and 'r_old' were appended 
automatically to the args part. But it's not that way: if you do not pass a 
lambda, you only can pass the name of a function (and then 'tablename' and 
'r_old' are appended at the end).

Knowing that, this code seems to do the trick (replacing the empty string 
with the name of the function to redirect):

l = lambda field, type, ref: URL(f='', args=[ref, field], vars=dict(data='data 
in vars'))

If you agree you can close 1881 ticket. It's not a bug at the code (maybe 
at the manual).

By the way, is it proper to open issues to suggest corrections of the 
manual (i have a few)?.

Thanks.


El martes, 25 de febrero de 2014 23:30:14 UTC+1, Massimo Di Pierro escribió:

 Now I understand better. You cannot pass vars to linkto. That is by design 
 because in principle, the linkto function may need parameters specified by 
 the SQLFORM.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] Roadmap

2014-02-26 Thread Anthony
Are you saying you want an enterprise level machine data analysis framework 
built into web2py? Seems like a tall order, and more like something you would 
build on top of web2py rather than into the core framework.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Submit FORM not working in IE11

2014-02-26 Thread Davy Jacops
Problem seems to be linked to the surrounding page in which the page is 
displayed.
Not just linked to the browser, although IE seems to suffer more than 
others.
I have reduced the surrounding page from 3 cols to 1 col and it works in 
all browsers now.

DJ

Op dinsdag 25 februari 2014 21:55:42 UTC+1 schreef Davy Jacops:

 My web2py app is ready, and I was about to deploy, but
 just found out it doesn't work at al under Internet Explorer 11!

 I developed everything using safari, chrome  also tested in firefox.
 All working fine.

 But I have a form (generated via SQLFORM.factory) with a submit button.

 Using IE11: when pushing the SUBMIT button, is says working very 
 briefly, but then nothing at all happens.
 I cannot test if older IE versions have the same problem.

 Are there any special tricks to be applied for IE?

 Thank you for your help

 DJ


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Submit FORM not working in IE11

2014-02-26 Thread Anthony
Can you show some demo code that produces the problem? We might have a corner 
case bug that needs to be fixed.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Strange 'SQLTABLE linkto' behaviour

2014-02-26 Thread Massimo Di Pierro
Yes. I had forgotten about the lambda option. :-)

On Wednesday, 26 February 2014 03:44:21 UTC-6, mcamel wrote:

 Looking at gluon/sqltml.py code i think i realized how 'linkto' works:

- is a lambda is passed, it's used to generate the href
- if not, a string is concatenated: href = '%s/%s/%s' % (linkto, 
tablename, r_old)

 The manual says nothing about expecting a lambda, so i figured out you 
 have to pass an URL and after that, 'tablename' and 'r_old' were appended 
 automatically to the args part. But it's not that way: if you do not pass a 
 lambda, you only can pass the name of a function (and then 'tablename' and 
 'r_old' are appended at the end).

 Knowing that, this code seems to do the trick (replacing the empty string 
 with the name of the function to redirect):

 l = lambda field, type, ref: URL(f='', args=[ref, field], 
 vars=dict(data='data 
 in vars'))

 If you agree you can close 1881 ticket. It's not a bug at the code (maybe 
 at the manual).

 By the way, is it proper to open issues to suggest corrections of the 
 manual (i have a few)?.

 Thanks.


 El martes, 25 de febrero de 2014 23:30:14 UTC+1, Massimo Di Pierro 
 escribió:

 Now I understand better. You cannot pass vars to linkto. That is by 
 design because in principle, the linkto function may need parameters 
 specified by the SQLFORM.




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Tuning app performance for good response times on slow servers

2014-02-26 Thread Michele Comitini
check that there is not a problem with your dns setup where web2py runs.
use the profiler to find out it can give you some good hints.



2014-02-25 22:49 GMT+01:00 Niphlod niph...@gmail.com:

 try yourself. Take the welcome app from 2.8.2.
 If /welcome/default/index takes more than 50ms to be served, then it's the
 server/web2py config.
 My laptop of 4 years ago with Ubuntu 12.10 loads the page in 22ms with the
 rocket webserver.
 First round of fetching static assets with an empty cache takes it to
 360ms.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report 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.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Tuning app performance for good response times on slow servers

2014-02-26 Thread Kevin Bethke
what do you mean by profiler?
thanks

On Wed, Feb 26, 2014 at 5:10 PM, Michele Comitini
michele.comit...@gmail.com wrote:
 check that there is not a problem with your dns setup where web2py runs.
 use the profiler to find out it can give you some good hints.



 2014-02-25 22:49 GMT+01:00 Niphlod niph...@gmail.com:

 try yourself. Take the welcome app from 2.8.2.
 If /welcome/default/index takes more than 50ms to be served, then it's the
 server/web2py config.
 My laptop of 4 years ago with Ubuntu 12.10 loads the page in 22ms with the
 rocket webserver.
 First round of fetching static assets with an empty cache takes it to
 360ms.

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report 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.


 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report 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/fxcPflpF63o/unsubscribe.
 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.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: CSS table width not limited as wished

2014-02-26 Thread Dominique
Thank you Paolo.
It works perfectly on the test model.

But not on my app, for whatever reason...
I'll investigate that later...

Anyway thank you very much
Dominique

Le mardi 25 février 2014 20:01:56 UTC+1, Paolo Caruccio a écrit :

 Please try with:

 table#t1 input{width:auto;}


 Il giorno martedì 25 febbraio 2014 18:45:31 UTC+1, Dominique ha scritto:

 Unfortunately, no ...

 Le mardi 25 février 2014 18:29:38 UTC+1, Massimo Di Pierro a écrit :

 I think the problem may be the size of the INPUT. Try add this in style

 input { width: 50px; } 

  

 On Tuesday, 25 February 2014 10:49:07 UTC-6, Dominique wrote:

 Hello Massino,

 Thank you so much for spending some of your time for me. I appreciate.

 The following codes will show you my problem:
 In the controller:

 def form_test():
 form = FORM(TABLE(TR(FIELDSET('This is a test for Field 1:  ', 
 INPUT(_name='f1', id='f1')),
  FIELDSET('This is a test for Field 2:  ', 
 INPUT(_name='f2', id='f2')),
  FIELDSET('This is a test for Field 3:  ', 
 INPUT(_name='f3', id='f3')),
  FIELDSET('This is a test for Field 4:  ', 
 INPUT(_name='f4', id='f4')),
  FIELDSET('This is a test for Field 3:  ', 
 INPUT(_name='f5', id='f5'))
  ), _id='t1'))
 return dict(form=form)


 In the view:

 {{extend 'layout.html'}}
 style type=text/css
 table  {  font-size: 12px; max-width:80%}
 td{font-weight:bold;vertical-align:top;}
 fieldset {width:25%; border: groove}
 /style
 {{=form}}

 What I get and what I want are shown in the attached images: I want 
 all the fields to appear on screen without scrollbars.
 Note that the image what I want is just the code (form + css script) 
 copied in notepad and opened in firefox. 

 The table css properties I add in my script seem not to be taken into 
 account in web2py.
 The point is that I don't know which web2py file I need to modify (and 
 where).

 I hope it's clearer ;)

 Thank you for your help
 Dominique



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Submit FORM not working in IE11

2014-02-26 Thread Davy Jacops
I am trying to isolate the problem.

Situation: the web2py form is embedded in an iframe on drupalgardens site.
The web2py server is on Amazon EC2 machine running ubuntu.

What I found out so far:
When I take a PC (mac, windows, it doesn't matter) with any browser (IE, 
safari for sure), then at first the popups and the submit actions are NOT 
working.
The submit button says working for a second and then nothing happens.

BUT if I then play around with that PC for a while, and surf directly to 
the ubuntu server (without iframe), possibly loggin in, then suddenly the 
popups and submit button start working.
When I then try it on that same PC with the iframe, it works as well (from 
the drupalgardens site).

Seems that something needs to pass a gate once and then it works for that 
PC.
certificates?? 

Still root cause is unknown.
My site is not deployable like this :(

DJ


When I use a 

Op dinsdag 25 februari 2014 21:55:42 UTC+1 schreef Davy Jacops:

 My web2py app is ready, and I was about to deploy, but
 just found out it doesn't work at al under Internet Explorer 11!

 I developed everything using safari, chrome  also tested in firefox.
 All working fine.

 But I have a form (generated via SQLFORM.factory) with a submit button.

 Using IE11: when pushing the SUBMIT button, is says working very 
 briefly, but then nothing at all happens.
 I cannot test if older IE versions have the same problem.

 Are there any special tricks to be applied for IE?

 Thank you for your help

 DJ


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] input validation and redirection -- how?

2014-02-26 Thread Austin Taylor
Hello,

I setup a form similar to the display form on the tutorial:

def display_form():
form = FORM('Your name:',
  INPUT(_name='userinput', 
requires=IS_IPV4()),INPUT(_type='submit'))
if form.process().accepted:
session.flash = 'form accepted'
redirect(URL('next'))
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill the form'
return dict(form=form)

but for some reason it takes ANY user input and runs the redirect function, 
even if there is no user input.

How could I have the input validated and then perform a redirection if it 
approved. I thought that is what the form.process().accepted was for.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: CSS table width not limited as wished

2014-02-26 Thread Paolo Caruccio
Generally speaking the issue is due to a rule in web2py.css 
(https://github.com/web2py/web2py/blob/master/applications/welcome/static/css/web2py.css#L33):

[type=text], [type=password], select {
  margin-right: 5px; width: 300px;
}

You should override this rule in your css (increasing the specificity).
There are several ways to accomplish this goal. One is that in my previous 
post.
Another, more general and therefore less controllable, is:

[type=text], [type=password], select {
  width: auto !important;
}


Il giorno mercoledì 26 febbraio 2014 18:04:08 UTC+1, Dominique ha scritto:

 Thank you Paolo.
 It works perfectly on the test model.

 But not on my app, for whatever reason...
 I'll investigate that later...

 Anyway thank you very much
 Dominique

 Le mardi 25 février 2014 20:01:56 UTC+1, Paolo Caruccio a écrit :

 Please try with:

 table#t1 input{width:auto;}


 Il giorno martedì 25 febbraio 2014 18:45:31 UTC+1, Dominique ha scritto:

 Unfortunately, no ...

 Le mardi 25 février 2014 18:29:38 UTC+1, Massimo Di Pierro a écrit :

 I think the problem may be the size of the INPUT. Try add this in style

 input { width: 50px; } 

  

 On Tuesday, 25 February 2014 10:49:07 UTC-6, Dominique wrote:

 Hello Massino,

 Thank you so much for spending some of your time for me. I appreciate.

 The following codes will show you my problem:
 In the controller:

 def form_test():
 form = FORM(TABLE(TR(FIELDSET('This is a test for Field 1:  ', 
 INPUT(_name='f1', id='f1')),
  FIELDSET('This is a test for Field 2:  ', 
 INPUT(_name='f2', id='f2')),
  FIELDSET('This is a test for Field 3:  ', 
 INPUT(_name='f3', id='f3')),
  FIELDSET('This is a test for Field 4:  ', 
 INPUT(_name='f4', id='f4')),
  FIELDSET('This is a test for Field 3:  ', 
 INPUT(_name='f5', id='f5'))
  ), _id='t1'))
 return dict(form=form)


 In the view:

 {{extend 'layout.html'}}
 style type=text/css
 table  {  font-size: 12px; max-width:80%}
 td{font-weight:bold;vertical-align:top;}
 fieldset {width:25%; border: groove}
 /style
 {{=form}}

 What I get and what I want are shown in the attached images: I want 
 all the fields to appear on screen without scrollbars.
 Note that the image what I want is just the code (form + css script) 
 copied in notepad and opened in firefox. 

 The table css properties I add in my script seem not to be taken into 
 account in web2py.
 The point is that I don't know which web2py file I need to modify (and 
 where).

 I hope it's clearer ;)

 Thank you for your help
 Dominique



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Submit FORM not working in IE11

2014-02-26 Thread LightDot
Sounds like SSL certs or cookies. I remember once troubleshooting 
Facebook's OAuth frantically for an hour before I realized my browser had 
3rd party cookies blocked. :)

Does either of the sites use SSL? If it does, does it have a valid cert or 
do you need to confirm an exception in your browser? For cookies, you could 
temporarily disable session checking for the form in question and see the 
result.

if form.process(session=None).accepted:
...code...

Regards


On Wednesday, February 26, 2014 6:08:53 PM UTC+1, Davy Jacops wrote:

 I am trying to isolate the problem.

 Situation: the web2py form is embedded in an iframe on drupalgardens site.
 The web2py server is on Amazon EC2 machine running ubuntu.

 What I found out so far:
 When I take a PC (mac, windows, it doesn't matter) with any browser (IE, 
 safari for sure), then at first the popups and the submit actions are NOT 
 working.
 The submit button says working for a second and then nothing happens.

 BUT if I then play around with that PC for a while, and surf directly to 
 the ubuntu server (without iframe), possibly loggin in, then suddenly the 
 popups and submit button start working.
 When I then try it on that same PC with the iframe, it works as well (from 
 the drupalgardens site).

 Seems that something needs to pass a gate once and then it works for that 
 PC.
 certificates?? 

 Still root cause is unknown.
 My site is not deployable like this :(

 DJ


 When I use a 

 Op dinsdag 25 februari 2014 21:55:42 UTC+1 schreef Davy Jacops:

 My web2py app is ready, and I was about to deploy, but
 just found out it doesn't work at al under Internet Explorer 11!

 I developed everything using safari, chrome  also tested in firefox.
 All working fine.

 But I have a form (generated via SQLFORM.factory) with a submit button.

 Using IE11: when pushing the SUBMIT button, is says working very 
 briefly, but then nothing at all happens.
 I cannot test if older IE versions have the same problem.

 Are there any special tricks to be applied for IE?

 Thank you for your help

 DJ



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: CSS table width not limited as wished

2014-02-26 Thread Dominique
Fantastic !
Now that works fine !
I changed the line 33 of web2py.css as you advised.

Thank you very much Paolo !
Dominique

Le mercredi 26 février 2014 20:09:36 UTC+1, Paolo Caruccio a écrit :

 Generally speaking the issue is due to a rule in web2py.css (
 https://github.com/web2py/web2py/blob/master/applications/welcome/static/css/web2py.css#L33
 ):

 [type=text], [type=password], select {
   margin-right: 5px; width: 300px;
 }

 You should override this rule in your css (increasing the specificity).
 There are several ways to accomplish this goal. One is that in my previous 
 post.
 Another, more general and therefore less controllable, is:

 [type=text], [type=password], select {
   width: auto !important;
 }


 Il giorno mercoledì 26 febbraio 2014 18:04:08 UTC+1, Dominique ha scritto:

 Thank you Paolo.
 It works perfectly on the test model.

 But not on my app, for whatever reason...
 I'll investigate that later...

 Anyway thank you very much
 Dominique

 Le mardi 25 février 2014 20:01:56 UTC+1, Paolo Caruccio a écrit :

 Please try with:

 table#t1 input{width:auto;}


 Il giorno martedì 25 febbraio 2014 18:45:31 UTC+1, Dominique ha scritto:

 Unfortunately, no ...

 Le mardi 25 février 2014 18:29:38 UTC+1, Massimo Di Pierro a écrit :

 I think the problem may be the size of the INPUT. Try add this in style

 input { width: 50px; } 

  

 On Tuesday, 25 February 2014 10:49:07 UTC-6, Dominique wrote:

 Hello Massino,

 Thank you so much for spending some of your time for me. I appreciate.

 The following codes will show you my problem:
 In the controller:

 def form_test():
 form = FORM(TABLE(TR(FIELDSET('This is a test for Field 1:  ', 
 INPUT(_name='f1', id='f1')),
  FIELDSET('This is a test for Field 2:  ', 
 INPUT(_name='f2', id='f2')),
  FIELDSET('This is a test for Field 3:  ', 
 INPUT(_name='f3', id='f3')),
  FIELDSET('This is a test for Field 4:  ', 
 INPUT(_name='f4', id='f4')),
  FIELDSET('This is a test for Field 3:  ', 
 INPUT(_name='f5', id='f5'))
  ), _id='t1'))
 return dict(form=form)


 In the view:

 {{extend 'layout.html'}}
 style type=text/css
 table  {  font-size: 12px; max-width:80%}
 td{font-weight:bold;vertical-align:top;}
 fieldset {width:25%; border: groove}
 /style
 {{=form}}

 What I get and what I want are shown in the attached images: I want 
 all the fields to appear on screen without scrollbars.
 Note that the image what I want is just the code (form + css 
 script) copied in notepad and opened in firefox. 

 The table css properties I add in my script seem not to be taken into 
 account in web2py.
 The point is that I don't know which web2py file I need to modify 
 (and where).

 I hope it's clearer ;)

 Thank you for your help
 Dominique



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Strange 'SQLTABLE linkto' behaviour

2014-02-26 Thread LightDot


On Wednesday, February 26, 2014 10:44:21 AM UTC+1, mcamel wrote:

 ...
 If you agree you can close 1881 ticket. It's not a bug at the code (maybe 
 at the manual).

 By the way, is it proper to open issues to suggest corrections of the 
 manual (i have a few)?.

 Thanks.


You can also open an issue or make a pull request at the book's github repo:

https://github.com/mdipierro/web2py-book

Regards

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: CSS table width not limited as wished

2014-02-26 Thread Paolo Caruccio
I'm glad to hear this but please keep in mind that the modify you made will 
change the width of all elements with text and password type attribute 
as well as select elements.
Therefore if you will be able to target only the interested elements it 
will be better. For example:

table#t1 [type=text], table#t1 [type=password], table#t1 select {
  width: auto !important;
}

should also work but only for the elements children of the table with 
id=t1.

Moreover, I suggest you to don't modify web2py files. In the specific case 
you should create your css file and reference it in the layout.html as last 
css file. 

Il giorno mercoledì 26 febbraio 2014 20:39:08 UTC+1, Dominique ha scritto:

 Fantastic !
 Now that works fine !
 I changed the line 33 of web2py.css as you advised.

 Thank you very much Paolo !
 Dominique

 Le mercredi 26 février 2014 20:09:36 UTC+1, Paolo Caruccio a écrit :

 Generally speaking the issue is due to a rule in web2py.css (
 https://github.com/web2py/web2py/blob/master/applications/welcome/static/css/web2py.css#L33
 ):

 [type=text], [type=password], select {
   margin-right: 5px; width: 300px;
 }

 You should override this rule in your css (increasing the specificity).
 There are several ways to accomplish this goal. One is that in my 
 previous post.
 Another, more general and therefore less controllable, is:

 [type=text], [type=password], select {
   width: auto !important;
 }


 Il giorno mercoledì 26 febbraio 2014 18:04:08 UTC+1, Dominique ha scritto:

 Thank you Paolo.
 It works perfectly on the test model.

 But not on my app, for whatever reason...
 I'll investigate that later...

 Anyway thank you very much
 Dominique

 Le mardi 25 février 2014 20:01:56 UTC+1, Paolo Caruccio a écrit :

 Please try with:

 table#t1 input{width:auto;}


 Il giorno martedì 25 febbraio 2014 18:45:31 UTC+1, Dominique ha scritto:

 Unfortunately, no ...

 Le mardi 25 février 2014 18:29:38 UTC+1, Massimo Di Pierro a écrit :

 I think the problem may be the size of the INPUT. Try add this in 
 style

 input { width: 50px; } 

  

 On Tuesday, 25 February 2014 10:49:07 UTC-6, Dominique wrote:

 Hello Massino,

 Thank you so much for spending some of your time for me. I 
 appreciate.

 The following codes will show you my problem:
 In the controller:

 def form_test():
 form = FORM(TABLE(TR(FIELDSET('This is a test for Field 1:  ', 
 INPUT(_name='f1', id='f1')),
  FIELDSET('This is a test for Field 2:  ', 
 INPUT(_name='f2', id='f2')),
  FIELDSET('This is a test for Field 3:  ', 
 INPUT(_name='f3', id='f3')),
  FIELDSET('This is a test for Field 4:  ', 
 INPUT(_name='f4', id='f4')),
  FIELDSET('This is a test for Field 3:  ', 
 INPUT(_name='f5', id='f5'))
  ), _id='t1'))
 return dict(form=form)


 In the view:

 {{extend 'layout.html'}}
 style type=text/css
 table  {  font-size: 12px; max-width:80%}
 td{font-weight:bold;vertical-align:top;}
 fieldset {width:25%; border: groove}
 /style
 {{=form}}

 What I get and what I want are shown in the attached images: I want 
 all the fields to appear on screen without scrollbars.
 Note that the image what I want is just the code (form + css 
 script) copied in notepad and opened in firefox. 

 The table css properties I add in my script seem not to be taken 
 into account in web2py.
 The point is that I don't know which web2py file I need to modify 
 (and where).

 I hope it's clearer ;)

 Thank you for your help
 Dominique



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Tuning app performance for good response times on slow servers

2014-02-26 Thread Michele Comitini
$ pip install RunSnakeRun
$ mkdir /tmp/w2prof
$ python web2py.py -F /tmp/w2prof

access to the slow page on web2py with the browser a few times

$ runsnake /tmp/w2prof/*







2014-02-26 17:14 GMT+01:00 Kevin Bethke kevin.bet...@gmail.com:

 what do you mean by profiler?
 thanks

 On Wed, Feb 26, 2014 at 5:10 PM, Michele Comitini
 michele.comit...@gmail.com wrote:
  check that there is not a problem with your dns setup where web2py runs.
  use the profiler to find out it can give you some good hints.
 
 
 
  2014-02-25 22:49 GMT+01:00 Niphlod niph...@gmail.com:
 
  try yourself. Take the welcome app from 2.8.2.
  If /welcome/default/index takes more than 50ms to be served, then it's
 the
  server/web2py config.
  My laptop of 4 years ago with Ubuntu 12.10 loads the page in 22ms with
 the
  rocket webserver.
  First round of fetching static assets with an empty cache takes it to
  360ms.
 
  --
  Resources:
  - http://web2py.com
  - http://web2py.com/book (Documentation)
  - http://github.com/web2py/web2py (Source code)
  - https://code.google.com/p/web2py/issues/list (Report 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.
 
 
  --
  Resources:
  - http://web2py.com
  - http://web2py.com/book (Documentation)
  - http://github.com/web2py/web2py (Source code)
  - https://code.google.com/p/web2py/issues/list (Report 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/fxcPflpF63o/unsubscribe.
  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.

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report 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.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] Ckeditor plugin - Update ckeditor

2014-02-26 Thread Tim Richardson
Do you refer to a plugin downloaded from web2py slices? Or do you mean your own 
installation of ckeditor ?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] GAE / Memcache consistency minor change request.

2014-02-26 Thread Matt
Hi there,

I've noticed a small variation between two parts of web2py.

The memcache client MemcacheClient in gluon.contrib.memcache.__init__.py 
supports the ability to control the default timeout via the 
default_time_expire parameter.

Whereas the version that supports GAE does not. It would be great if this 
could be changed as at the moment when you follow the example suggested 
example:

http://web2py.com/book/default/chapter/13#Sessions-in-memcache

  from gluon.contrib.gae_memcache import MemcacheClient
  from gluon.contrib.memdb import MEMDB
  cache.memcache = MemcacheClient(request)
  cache.ram = cache.disk = cache.memcache
  session.connect(request,response, db = MEMDB(cache.memcache.client))

You can't change the session timeout from the default of 300.

All that's required is to change gluon.contrib.gae_memcache to something 
like:

class MemcacheClient(object):

client = Client()

def __init__(self, request, default_time_expire = 300):
self.request = request
self.default_time_expire = default_time_expire

def __call__(
self,
key,
f,
time_expire=self.default_time_expire,
):
key = '%s/%s' % (self.request.application, key)
dt = time_expire
value = None
obj = self.client.get(key)

Hope that's possible.

Thanks in advance,
Matt

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] custom auth

2014-02-26 Thread Asimionese Alexandru

Hi folks, we have one table in database with users wich contains 3 fields, 
id, email, password. How can I use Auth object with this table without 
creating additional fields like registration_key, registration_id ??
actually I don't want to touch the tables because it's used by other 
applications writen in php.

auth.settings.table_user_name = 'sf_login'

db.define_table(
auth.settings.table_user_name,
Field('email', length=128, default='', unique=True), # required
Field('password', 'password', length=512,# required
  readable=False, label='Password'),
Field('registration_key', length=512,# required
  writable=False, readable=False, default=''),
Field('reset_password_key', length=512,  # required
  writable=False, readable=False, default=''),
Field('registration_id', length=512, # required
  writable=False, readable=False, default=''))

custom_auth_table = db[auth.settings.table_user_name]
custom_auth_table.password.requires = [IS_STRONG()]
custom_auth_table.email.requires = 
[IS_EMAIL(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db, 
custom_auth_table.email)]
auth.settings.table_user = custom_auth_table

auth.define_tables(username=False, signature=False)

I tried without them but this seems to be required in order to use Auth

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] Show referenced records in form that only belong to author

2014-02-26 Thread brahama von
Hi guys!

How is the approach to do this?

Here's the model
-
db.define_table('uploads',
Field('up_name','string',requires=IS_NOT_EMPTY()),
Field('mainfile','upload'),
Field('thumb','upload',writable=False,readable=False),
Field('up_author',db.auth_user,requires=IS_NOT_EMPTY()),
Field('up_post','reference post'),
format='%(up_name)s')

db.uploads.up_author.writable = db.uploads.up_author.readable = False

db.define_table('post',
Field('summary','string',requires=IS_NOT_EMPTY()),
Field('author',db.auth_user,requires=IS_NOT_EMPTY()),
Field('body','text'),
format='%(summary)s')

db.post.author.writable = db.post.author.readable = False
db.uploads.up_post.requires = IS_IN_DB(db,db.post,'%(summary)s')


So when i want the user to upload an image so it can be related to the post 
i only want to show the posts in the form that the user owns.

controller
--
@auth.requires_login()
def newimage():
dbtable = db.uploads  #uploads table name
if auth.is_logged_in:
dbtable.up_author.default = auth.user.id

form = SQLFORM(dbtable)
return dict(form=form)


It has a few more lines but are for testing and practice as i am really new 
to web2py :)

That is all. Thanks for any advice.

Cheers!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: custom auth

2014-02-26 Thread Anthony
I think you would probably have to write your own custom login and 
registration code. For login, you might be able to subclass Auth and just 
re-write the login_bare method.

Anthony

On Wednesday, February 26, 2014 5:13:24 PM UTC-5, Asimionese Alexandru 
wrote:


 Hi folks, we have one table in database with users wich contains 3 fields, 
 id, email, password. How can I use Auth object with this table without 
 creating additional fields like registration_key, registration_id ??
 actually I don't want to touch the tables because it's used by other 
 applications writen in php.

 auth.settings.table_user_name = 'sf_login'

 db.define_table(
 auth.settings.table_user_name,
 Field('email', length=128, default='', unique=True), # required
 Field('password', 'password', length=512,# required
   readable=False, label='Password'),
 Field('registration_key', length=512,# required
   writable=False, readable=False, default=''),
 Field('reset_password_key', length=512,  # required
   writable=False, readable=False, default=''),
 Field('registration_id', length=512, # required
   writable=False, readable=False, default=''))

 custom_auth_table = db[auth.settings.table_user_name]
 custom_auth_table.password.requires = [IS_STRONG()]
 custom_auth_table.email.requires = 
 [IS_EMAIL(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db, 
 custom_auth_table.email)]
 auth.settings.table_user = custom_auth_table

 auth.define_tables(username=False, signature=False)

 I tried without them but this seems to be required in order to use Auth


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Show referenced records in form that only belong to author

2014-02-26 Thread Anthony
db.uploads.up_post.requires = IS_IN_DB(db(db.post.author == auth.user_id), 
db.post,'%(summary)s')

The IS_IN_DB validator takes a Set object as the first argument, which can 
be used to filter the allowable records.

Anthony

On Wednesday, February 26, 2014 5:23:41 PM UTC-5, brahama von wrote:

 Hi guys!

 How is the approach to do this?

 Here's the model
 -
 db.define_table('uploads',
 Field('up_name','string',requires=IS_NOT_EMPTY()),
 Field('mainfile','upload'),
 Field('thumb','upload',writable=False,readable=False),
 Field('up_author',db.auth_user,requires=IS_NOT_EMPTY()),
 Field('up_post','reference post'),
 format='%(up_name)s')

 db.uploads.up_author.writable = db.uploads.up_author.readable = False

 db.define_table('post',
 Field('summary','string',requires=IS_NOT_EMPTY()),
 Field('author',db.auth_user,requires=IS_NOT_EMPTY()),
 Field('body','text'),
 format='%(summary)s')

 db.post.author.writable = db.post.author.readable = False
 db.uploads.up_post.requires = IS_IN_DB(db,db.post,'%(summary)s')


 So when i want the user to upload an image so it can be related to the 
 post i only want to show the posts in the form that the user owns.

 controller
 --
 @auth.requires_login()
 def newimage():
 dbtable = db.uploads  #uploads table name
 if auth.is_logged_in:
 dbtable.up_author.default = auth.user.id

 form = SQLFORM(dbtable)
 return dict(form=form)


 It has a few more lines but are for testing and practice as i am really 
 new to web2py :)

 That is all. Thanks for any advice.

 Cheers!



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: webcam application

2014-02-26 Thread 黄祥
i assume you already had your own database table for store the video file.
*e.g. not tested*
*models/db.py*
from gluon import current
current.db = db
current.auth = auth
current.mail = mail
current.session = session
current.response = response
current.T = T

*controllers/default.py*
import video

auth.requires_login()(lambda: None)()

def video():
return video.grid_0(db.video)

*modules/video.py*
from gluon import *

def grid_0(table):
grid = SQLFORM.grid(table)
return locals()

*views/default/video.html*
{{extend 'layout.html'}}

{{=grid}}

ref:
http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] Weird truncate performance problem after upgrade to 2.8.2

2014-02-26 Thread Rene Dohmen
Hi Web2py-Users,

We have an app which imports data form a .csv file into a sqlite table. The 
CSV has 70k lines. 
Once a week we re-import data with a new .csv.

The controller that handles this job:
1) handles the upload and moves it to location for future reference
2) truncates the main table and 2 subtables (with linked data, main table 
has a auth.signature)
3) imports the .csv and use the info in the data to refill the other 2 
tables.

Before our update from 2.4.6  to 2.8.2 it was very fast. Max 10-15 seconds, 
for steps 1-3.

After the update (still not 100% sure if the update to 2.8 caused it; 
because we did add other functionality also and updated web2py itself); we 
had performance issues; The import suddenly needed somewhere between 15m 
and 1 hour. After a lot of debugging we isolated the problem to the 
truncate part of the steps.
The truncate of 68000 records took 2040 seconds (with a delete form 
appadmin: 3 seconds for 100 records).

We tried it from appadmin also, tried execute_sql; but they all had the 
same issue.

As a workaround we now drop the table from sqlite (via sqlite3 and a 
os.system call), delete the *tablename.table file from the databases/ 
folder and then import the data again. But a more web2py-ish solution would 
be welcome. ;)

Any suggestions in what could cause the problem are more then welcome.

Kind Regards

Rene

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Bug on version 2.8.2

2014-02-26 Thread Rene Dohmen
Hi Paulo,

Doesn't seem like a bug to me.
More like a typo you made in the model...

But if I remember correctly you would get an error defining a reference to 
a non existing table in older web2py releases.

You could also build the reference like this;
Field('image', db.image)

That way you would get an error when db.image doesn't exist. 

The reference notation can also be used for circular references...
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Self-Reference-and-aliases

Kind Regards 

Rene



On Tuesday, February 25, 2014 11:07:18 AM UTC+1, Paulo Ramos wrote:

 Well, this isn't a question, but a bug report (I'm new to the list).


 I was following online book, chapter 3, with a small difference. Instead 
 of using singular on tables names I use plural, so I give to the image 
 table the name 'images'. However I made a mistake when referencing images 
 in posts, i.e., I used Field('image_id', 'reference image'), instead of 
 Field('image_id', 'reference images'). Of course, when I tried to post a 
 comment an error message came up. After spending several minutes to figure 
 where the error was (well in this case the ticket system was not so helpful 
 because always pointed to the controller and not the model, where the 
 mistake was), I fix it, but the error message continue. I went to the 
 sql.log file, and table name still was in singular, so I change that in 
 sql.log. No changes, the error continue, albeit the multiple success word 
 in the end of sql.log.

 The solution I found was delete the storage.sqlite. After that everything 
 went smooth.


 I'm almost sure that this is a bug in DAL module.


 HTH,


 Paulo





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] Which Postgresql version?

2014-02-26 Thread Carlos Zenteno
do I use postgresql 9.1, 9.2 or 9.3 with web2py?

does it work ok with all of them?
does psycopg2 works ok with any version of it and web2py?

any tips on admin tools for linux for postgresql?

thanks...

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] Website + Web2py

2014-02-26 Thread Carlos Zenteno
I would like to have a website in front of web2py, 
probably one of those one pagers that are in vogue nowadays.

What is the best way to achieve this?

An html page that links to web2py?
A web2py static page?

I am thinking on having a blog too,
for that I either going to use one of the web2py blog apps
that exist or a Pelican static one.
Any advice/opinions on the two options?

thanks again...

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: postgres beginner questions: passwords, peer authentication, dev/production

2014-02-26 Thread Dave S


On Wednesday, February 19, 2014 12:15:20 PM UTC-8, Joe Barnhart wrote:

 I have a model file 0_globals.py which I have under source control.  It 
 defines overall constants for the site, including the connection string. 
  On each development machine I have a file 1_locals.py which overrides 
 selected variables in the globals file.  It is NOT under source control and 
 is unique for each development machine (since I code from a variety of 
 machines).

 Model files are loaded in alphabetical order, so the 0_globals file is 
 loaded first, then some constants are overwritten by 1_locals.  This is 
 simple and grut but it works amazingly well.  It also works without any 
 special features of the source code control system (I don't use git but 
 mercurial).


Niphlod's technique of source-controlling the locals file under a different 
name (e.g., 1_locals_sys5) and then renaming it after the pull/clone would 
still work.  This would allow you to track how a system is configured, 
especially if it needs to evolve for new apps.  This doesn't require any 
special features in mercurial, just an entry on your installation checklist 
to make sure you do the rename (or copy).  But as long as you have the file 
recoverable *in some way*, you should be good.

/dps

 


 -- Joe B.

 Globals
 # coding: utf8
 from gluon import current
 from gluon.storage import Storage
 from gluon.custom_import import track_changes

 settings = Storage()
 current.settings=settings

 # Override any settings in a file called 1-locals.py
 # but do NOT include the local file in the HG repo
 # AVOID changing this file, which IS in the repo.

 settings.title = 'My Wunnerful Website'
 settings.subtitle = XML('Some clever tagline goes here!')
 settings.author = 'me_ofcourse'
 settings.author_email = 'ad...@mysite.com javascript:'
 settings.keywords = ''
 settings.description = ''
 settings.layout_theme = 'Default'
 settings.formstyle = 'bootstrap'
 settings.table_page_size = 25
 settings.upload = None
 settings.fake = False
 settings.scheduler = True
 settings.use_blob = False
 settings.migrate = True
 settings.migrate2 = True
 settings.lazy = True
 settings.database_uri = 'postgres://wouldntyoulike:toknow@localhost/mydb'
 settings.pool_size = 10
 track_changes(True)
 # stripe DEVELOPMENT keys.
 settings.stripe_secret = 'sk_test_sorrynocanseesecretkey'
 settings.stripe_public = 'pk_test_sorrynocanseepublickey'
 # janrain keys.
 settings.janrain_key = 'somebiggobbledygookkeyhere'
 settings.janrain_domain = 'secure-swim-smarter.com'
 settings.janrain_appid = 'anotherrandomlookingthinghere'
 T.current_languages = ['null']

 Locals:
 # code: utf8
 # Settings for site on my iMac computer

 settings.migrate = False
 settings.migrate2 = False
 #settings.lazy = False
 #settings.database_uri = 
 'postgres://mylocalname:andpassword@localhost/mydb'
 #settings.pool_size = 10
 #track_changes(False)
 #settings.use_blob = False
 settings.scheduler = False
 #settings.fake = True





 On Sunday, February 16, 2014 1:20:05 PM UTC-8, Tim Richardson wrote:

 postgres has peer authentication. 
 If I have mapped OS user www-data to a postgres role, and if apache runs 
 as www-data, can I use peer authentication in web2py and therefore not code 
 a password in?
 It seems that the connection string is parsed for user and password.

 The main reason I want to avoid a password is that it having a different 
 password in development and production becomes a nuisance. 
 However, everyone must have this inconvenience; what's the solution that 
 I'm missing? (I use git between development and production)




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Version Control advice

2014-02-26 Thread Dave S


On Wednesday, February 19, 2014 11:21:26 PM UTC-8, User wrote:

 I also agree with separate repositories per app.

 My web2py folder is a mercurial repository (I cloned the web2py repository 
 http://code.google.com/p/web2py/source/checkout) Then for each 
 application I want to make, I create a new repository for that application 
 in the web2py/applications folder.  So you end up with a nested repository 
 structure but they actually play nicely and don't interfere with each other 
 (thanks to the ignore files)

 This way I can update web2py as needed to get new versions or bug fixes.  
 And my applications are in separate repositories because they really have 
 nothing to do with web2py core.


Using the web2py mercurial interface, a repository is created for each app 
where you use the interface.  Seems pretty reasonable to me.  There are 
plenty of times where the only thing relating two apps is that you're 
running both on web2py.

(The interface is very simplified, but if you need branching or other 
special features of mercurial you can do that from the command line easily 
enough; note that web2py doesn't install mercurial, just detects that you 
already have it.)


/dps

 

 On Wednesday, February 19, 2014 6:00:37 AM UTC-5, Tim Richardson wrote:

 Well, I'm not very sophisticated but I have separate git repositories per 
 app, I can't any advantages in having one repository for everything.

 On Wednesday, 19 February 2014 12:13:13 UTC+11, Carlos Zenteno wrote:

 Do you guys version control just the /applications directory or the 
 whole web2py tree?

 What is better for auto-deployment when pushing to the production repo?

 Thanks...



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: postgres beginner questions: passwords, peer authentication, dev/production

2014-02-26 Thread Dave S


On Wednesday, February 26, 2014 7:51:20 PM UTC-8, Dave S wrote:



 On Wednesday, February 19, 2014 12:15:20 PM UTC-8, Joe Barnhart wrote:

 I have a model file 0_globals.py which I have under source control.  It 
 defines overall constants for the site, including the connection string. 
  On each development machine I have a file 1_locals.py which overrides 
 selected variables in the globals file.  It is NOT under source control and 
 is unique for each development machine (since I code from a variety of 
 machines).

 Model files are loaded in alphabetical order, so the 0_globals file is 
 loaded first, then some constants are overwritten by 1_locals.  This is 
 simple and grut but it works amazingly well.  It also works without any 
 special features of the source code control system (I don't use git but 
 mercurial).


 Niphlod's technique of source-controlling the locals file under a 
 different name (e.g., 1_locals_sys5) and then renaming it after the 
 pull/clone would still work.  This would allow you to track how a system is 
 configured, especially if it needs to evolve for new apps.  This doesn't 
 require any special features in mercurial, just an entry on your 
 installation checklist to make sure you do the rename (or copy).  But as 
 long as you have the file recoverable *in some way*, you should be good.


I think this is also the territory that chef and puppet are trying to cover.


/dps


  


 -- Joe B.

 Globals
 # coding: utf8
 from gluon import current
 from gluon.storage import Storage
 from gluon.custom_import import track_changes

 settings = Storage()
 current.settings=settings

 # Override any settings in a file called 1-locals.py
 # but do NOT include the local file in the HG repo
 # AVOID changing this file, which IS in the repo.

 settings.title = 'My Wunnerful Website'
 settings.subtitle = XML('Some clever tagline goes here!')
 settings.author = 'me_ofcourse'
 settings.author_email = 'ad...@mysite.com'
 settings.keywords = ''
 settings.description = ''
 settings.layout_theme = 'Default'
 settings.formstyle = 'bootstrap'
 settings.table_page_size = 25
 settings.upload = None
 settings.fake = False
 settings.scheduler = True
 settings.use_blob = False
 settings.migrate = True
 settings.migrate2 = True
 settings.lazy = True
 settings.database_uri = 'postgres://wouldntyoulike:toknow@localhost/mydb'
 settings.pool_size = 10
 track_changes(True)
 # stripe DEVELOPMENT keys.
 settings.stripe_secret = 'sk_test_sorrynocanseesecretkey'
 settings.stripe_public = 'pk_test_sorrynocanseepublickey'
 # janrain keys.
 settings.janrain_key = 'somebiggobbledygookkeyhere'
 settings.janrain_domain = 'secure-swim-smarter.com'
 settings.janrain_appid = 'anotherrandomlookingthinghere'
 T.current_languages = ['null']

 Locals:
 # code: utf8
 # Settings for site on my iMac computer

 settings.migrate = False
 settings.migrate2 = False
 #settings.lazy = False
 #settings.database_uri = 
 'postgres://mylocalname:andpassword@localhost/mydb'
 #settings.pool_size = 10
 #track_changes(False)
 #settings.use_blob = False
 settings.scheduler = False
 #settings.fake = True





 On Sunday, February 16, 2014 1:20:05 PM UTC-8, Tim Richardson wrote:

 postgres has peer authentication. 
 If I have mapped OS user www-data to a postgres role, and if apache runs 
 as www-data, can I use peer authentication in web2py and therefore not code 
 a password in?
 It seems that the connection string is parsed for user and password.

 The main reason I want to avoid a password is that it having a different 
 password in development and production becomes a nuisance. 
 However, everyone must have this inconvenience; what's the solution that 
 I'm missing? (I use git between development and production)




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Weird truncate performance problem after upgrade to 2.8.2

2014-02-26 Thread Anthony
What happens if you take the exact SQL that web2py executes and instead 
execute it outside of web2py altogether (i.e., via some other database 
client)?

On Wednesday, February 26, 2014 7:06:46 PM UTC-5, Rene Dohmen wrote:

 Hi Web2py-Users,

 We have an app which imports data form a .csv file into a sqlite table. 
 The CSV has 70k lines. 
 Once a week we re-import data with a new .csv.

 The controller that handles this job:
 1) handles the upload and moves it to location for future reference
 2) truncates the main table and 2 subtables (with linked data, main table 
 has a auth.signature)
 3) imports the .csv and use the info in the data to refill the other 2 
 tables.

 Before our update from 2.4.6  to 2.8.2 it was very fast. Max 10-15 
 seconds, for steps 1-3.

 After the update (still not 100% sure if the update to 2.8 caused it; 
 because we did add other functionality also and updated web2py itself); we 
 had performance issues; The import suddenly needed somewhere between 15m 
 and 1 hour. After a lot of debugging we isolated the problem to the 
 truncate part of the steps.
 The truncate of 68000 records took 2040 seconds (with a delete form 
 appadmin: 3 seconds for 100 records).

 We tried it from appadmin also, tried execute_sql; but they all had the 
 same issue.

 As a workaround we now drop the table from sqlite (via sqlite3 and a 
 os.system call), delete the *tablename.table file from the databases/ 
 folder and then import the data again. But a more web2py-ish solution would 
 be welcome. ;)

 Any suggestions in what could cause the problem are more then welcome.

 Kind Regards

 Rene



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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: Roadmap

2014-02-26 Thread webpypy
I am saying that the feature of data analysis should be there.
The simplest form of existence is through a comprehensive example.
Later the decision will be made to go embedded or on the top.
...scheduled in the roadmap.

Ashraf

On Wednesday, February 26, 2014 3:08:55 PM UTC+3, Anthony wrote:

 Are you saying you want an enterprise level machine data analysis 
 framework built into web2py? Seems like a tall order, and more like 
 something you would build on top of web2py rather than into the core 
 framework.

 Anthony


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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] how to add termscondition hyperlink to registration from next to the field element

2014-02-26 Thread Andrey K
Greeting,
I can not figure out how to add link to the Registration from next to the 
field. In my case next to terms and condition checkbox. 
Could you give me a clue on how to deal with it?

At the moment I have this:

db.py:
auth.settings.extra_fields['auth_user']= [
Field('Terms','boolean', requires=IS_NOT_EMPTY(error_message='you must 
agree with TermsConditioens'), label = 'TermsConditions', comment='Please 
agree with it')
]

I have tried:
1)add another field such as:
Field('myterms',represent=lambda id:SPAN(A('terms',_href=URL('index'
2)add representation to the Terms field: 
Field('Terms','boolean',represent=lambda 
id:SPAN(A('terms',_href=URL('index', 
requires=IS_NOT_EMPTY(error_message='you must agree with 
TermsConditioens'), label = 'TermsConditions', comment='Please agree with 
it')

Unfortunately none of these works. Help!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report 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.