Re: [web2py] Re: Problem in deploying ssl certificates to Rocket server.

2012-11-05 Thread Niphlod
the usual 

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mysitename.key -
out mysitename.crt

works ok.

Il giorno lunedì 5 novembre 2012 03:48:43 UTC+1, Amit ha scritto:

 Thanks Niphold for replying. How can I create server cetificate, CA 
 certificate and client certificate without password? I am using simpatica 
 application to create all these certificates on windows XP machine and this 
 application doesn't allow to create certificates without password so if you 
 know any other way to create these certificates without password on windows 
 then please do share me.

 waiting for your response.

 Thanks,
 Amit

 On Fri, Nov 2, 2012 at 6:23 PM, Niphlod nip...@gmail.com javascript:wrote:

 certs are supposed to be generated without passwords. Even in apache, 
 etc, if you protect them with a password it will be asked every time the 
 process is started, and web2py (rocket) doesn't support that.


 On Friday, November 2, 2012 6:21:00 AM UTC+1, Amit wrote:

 Hi ,

 I generated CA certificates, private key, server certificate and client 
 certificate using “Simpatica” application developed in web2py. 

 But when I tried to deploy the certificates to rocket server using below 
 command on windows XP machine:

  

 D:\web2py2.1.1\web2pyweb2py.**py --ssl_certificate=D:\**
 certificates\server\cert.pe

 m --ssl_private_key=D:\**certificates\private_key\**cacert.key 
 --ca-cert=D:\certific

 ates\CA_certificate\cacrt.pem

  

 It starts web2py server dialog asking about password and after giving 
 password, it displays below information on the command prompt:

  

 No handlers could be found for logger web2py

 web2py Web Framework

 Created by Massimo Di Pierro, Copyright 2007-2012

 Version 2.1.1 (2012-10-15 12:44:40) stable

 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(pg8000),

  IMAP(imaplib)

 please visit:

 https://127.0.0.1:8000

 starting browser...

 Enter PEM pass phrase:

 Enter PEM pass phrase:

 Enter PEM pass phrase:

  

 As per the sequence of certificates on command line, I gave password for 
 e.g. for cert.pem(server certificate file) , I have given Server@123, and 
 for cacert.key(CA private key) and cacert.pem(CA certificate) , I have 
 given test123.

 NOTE: These passwords are used while generating the respective 
 certificates means for generating cert.pem , I used Server@123 and so on.

 So on above scenario , I have given password Server@123,test123 and 
 test123 on command prompt but it is giving following error on browser:

  

 *Secure Connection Failed

  An error occurred during a connection to 127.0.0.1:8000.

 Cannot communicate securely with peer: no common encryption algorithm(s).

 (Error code: ssl_error_no_cypher_overlap)

   The page you are trying to view cannot be shown because the 
 authenticity of the received data could not be verified.
   Please contact the website owners to inform them of this problem. 
 Alternatively, use the command found in the help menu to report this broken 
 site.*

  

  

 Could anyone please help me out to resolve this issue?

  

 Regards,

 Amit

  -- 
  
  
  




-- 





[web2py] Re: Generate the nth Pell Number

2012-11-05 Thread stefaan
This looks like a homework assignment. 
Did you intend to post this in the web2py discussion group?
I doubt we would do you a favor solving your homework.


-- 





[web2py] Re: how to find the Manhattan distance of the given question in python

2012-11-05 Thread stefaan
How is this related to web2py? 
This is not a we solve your homework news group.
If you really expect help, try a more general-purpose newsgroup like 
comp.lang.python, 
and make sure you post your version of the code, pointing out where you are 
stuck, otherwise you might get very rude replies :)

-- 





Re: [web2py] Re: web2py 2.2.1 is OUT

2012-11-05 Thread LightDot
And you have it. Is there a specific bug that you're referring to, or..?

Regards,
Ales

On Monday, November 5, 2012 8:57:44 AM UTC+1, Hassan Alnatour wrote:

 Dear Massimo , 

 Great Work , but we really need  backward compatibility for old projects 
 .. 

 Regards,


-- 





Re: [web2py] Re: Problem in deploying ssl certificates to Rocket server.

2012-11-05 Thread Amit
I run the command to generate certificates:

*web2py.py --ssl_certificate=D:\certificates\server.crt
--ssl_private_key=D:\certificates\server_key.key
--ca-cert=D:\certificates\server.crt*

And when I run this, It gives warning message on command prompt:

*WARNING:web2py:unable to open SSL certificate. SSL is OFF*

and on browser it display following error message:

*SSL received a record that exceeded the maximum permissible length.

(Error code: ssl_error_rx_record_too_long)*


So no idea, how to resolve this?

Thanks,
Amit



On Mon, Nov 5, 2012 at 4:10 PM, Niphlod niph...@gmail.com wrote:

 the usual

 openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mysitename.key
 -out mysitename.crt

 works ok.

 Il giorno lunedì 5 novembre 2012 03:48:43 UTC+1, Amit ha scritto:

 Thanks Niphold for replying. How can I create server cetificate, CA
 certificate and client certificate without password? I am using simpatica
 application to create all these certificates on windows XP machine and this
 application doesn't allow to create certificates without password so if you
 know any other way to create these certificates without password on windows
 then please do share me.

 waiting for your response.

 Thanks,
 Amit

 On Fri, Nov 2, 2012 at 6:23 PM, Niphlod nip...@gmail.com wrote:

 certs are supposed to be generated without passwords. Even in apache,
 etc, if you protect them with a password it will be asked every time the
 process is started, and web2py (rocket) doesn't support that.


 On Friday, November 2, 2012 6:21:00 AM UTC+1, Amit wrote:

 Hi ,

 I generated CA certificates, private key, server certificate and client
 certificate using “Simpatica” application developed in web2py.

 But when I tried to deploy the certificates to rocket server using
 below command on windows XP machine:



 D:\web2py2.1.1\web2pyweb2py.**p**y --ssl_certificate=D:\**certifica**
 tes\server\cert.pe

 m --ssl_private_key=D:\**certifica**tes\private_key\**cacert.key
 --ca-cert=D:\certific

 ates\CA_certificate\cacrt.pem



 It starts web2py server dialog asking about password and after giving
 password, it displays below information on the command prompt:



 No handlers could be found for logger web2py

 web2py Web Framework

 Created by Massimo Di Pierro, Copyright 2007-2012

 Version 2.1.1 (2012-10-15 12:44:40) stable

 Database drivers available: SQLite(sqlite3), MySQL(pymysql),
 PostgreSQL(pg8000),

  IMAP(imaplib)

 please visit:

 https://127.0.0.1:8000

 starting browser...

 Enter PEM pass phrase:

 Enter PEM pass phrase:

 Enter PEM pass phrase:



 As per the sequence of certificates on command line, I gave password
 for e.g. for cert.pem(server certificate file) , I have given Server@123,
 and for cacert.key(CA private key) and cacert.pem(CA certificate) , I have
 given test123.

 NOTE: These passwords are used while generating the respective
 certificates means for generating cert.pem , I used Server@123 and so
 on.

 So on above scenario , I have given password Server@123,test123 and
 test123 on command prompt but it is giving following error on browser:



 *Secure Connection Failed

  An error occurred during a connection to 127.0.0.1:8000.

 Cannot communicate securely with peer: no common encryption
 algorithm(s).

 (Error code: ssl_error_no_cypher_overlap)

   The page you are trying to view cannot be shown because the
 authenticity of the received data could not be verified.
   Please contact the website owners to inform them of this problem.
 Alternatively, use the command found in the help menu to report this broken
 site.*





 Could anyone please help me out to resolve this issue?



 Regards,

 Amit

  --





  --





-- 





Re: [web2py] Re: Problem in deploying ssl certificates to Rocket server.

2012-11-05 Thread LightDot
One way I know of is the same Niphlod told you in his previous post - use 
openssl to generate the certificate. He gave you the complete command 
example, I don't know how to be clearer than that...

http://www.openssl.org/related/binaries.html

Regards,
Ales


On Monday, November 5, 2012 12:40:28 PM UTC+1, Amit wrote:

 I run the command to generate certificates:

 *web2py.py --ssl_certificate=D:\certificates\server.crt 
 --ssl_private_key=D:\certificates\server_key.key 
 --ca-cert=D:\certificates\server.crt*

 And when I run this, It gives warning message on command prompt:

 *WARNING:web2py:unable to open SSL certificate. SSL is OFF*

 and on browser it display following error message:

 *SSL received a record that exceeded the maximum permissible length.

 (Error code: ssl_error_rx_record_too_long)*


 So no idea, how to resolve this?

 Thanks,
 Amit



 On Mon, Nov 5, 2012 at 4:10 PM, Niphlod nip...@gmail.com javascript:wrote:

 the usual 

 openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mysitename.key 
 -out mysitename.crt

 works ok.

 Il giorno lunedì 5 novembre 2012 03:48:43 UTC+1, Amit ha scritto:

 Thanks Niphold for replying. How can I create server cetificate, CA 
 certificate and client certificate without password? I am using simpatica 
 application to create all these certificates on windows XP machine and this 
 application doesn't allow to create certificates without password so if you 
 know any other way to create these certificates without password on windows 
 then please do share me.

 waiting for your response.

 Thanks,
 Amit

 On Fri, Nov 2, 2012 at 6:23 PM, Niphlod nip...@gmail.com wrote:

 certs are supposed to be generated without passwords. Even in apache, 
 etc, if you protect them with a password it will be asked every time the 
 process is started, and web2py (rocket) doesn't support that.


 On Friday, November 2, 2012 6:21:00 AM UTC+1, Amit wrote:

 Hi ,

 I generated CA certificates, private key, server certificate and 
 client certificate using “Simpatica” application developed in web2py. 

 But when I tried to deploy the certificates to rocket server using 
 below command on windows XP machine:

  

 D:\web2py2.1.1\web2pyweb2py.**p**y --ssl_certificate=D:\**certifica**
 tes\server\cert.pe

 m --ssl_private_key=D:\**certifica**tes\private_key\**cacert.key 
 --ca-cert=D:\certific

 ates\CA_certificate\cacrt.pem

  

 It starts web2py server dialog asking about password and after giving 
 password, it displays below information on the command prompt:

  

 No handlers could be found for logger web2py

 web2py Web Framework

 Created by Massimo Di Pierro, Copyright 2007-2012

 Version 2.1.1 (2012-10-15 12:44:40) stable

 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(pg8000),

  IMAP(imaplib)

 please visit:

 https://127.0.0.1:8000

 starting browser...

 Enter PEM pass phrase:

 Enter PEM pass phrase:

 Enter PEM pass phrase:

  

 As per the sequence of certificates on command line, I gave password 
 for e.g. for cert.pem(server certificate file) , I have given Server@123, 
 and for cacert.key(CA private key) and cacert.pem(CA certificate) , I 
 have 
 given test123.

 NOTE: These passwords are used while generating the respective 
 certificates means for generating cert.pem , I used Server@123 and so on.

 So on above scenario , I have given password Server@123,test123 and 
 test123 on command prompt but it is giving following error on browser:

  

 *Secure Connection Failed

  An error occurred during a connection to 127.0.0.1:8000.

 Cannot communicate securely with peer: no common encryption 
 algorithm(s).

 (Error code: ssl_error_no_cypher_overlap)

   The page you are trying to view cannot be shown because the 
 authenticity of the received data could not be verified.
   Please contact the website owners to inform them of this problem. 
 Alternatively, use the command found in the help menu to report this 
 broken 
 site.*

  

  

 Could anyone please help me out to resolve this issue?

  

 Regards,

 Amit

  -- 
  
  
  


  -- 
  
  
  




-- 





[web2py] Re: how to find the Manhattan distance of the given question in python

2012-11-05 Thread Jose


El lunes, 5 de noviembre de 2012 03:01:00 UTC-3, Sanjeet Roy escribió:

 Assume a Taxicab is located at the origin (0,0) in the below Grid. The 
 hori-
 zontal and vertical lines in the Grid is the road on which his taxi can 
 move. If
 the cab wants to move to a place, say (3,4), the distance the cab has to 
 travel
 is (3 - 0) + (4 - 0) = 7 units. The distance calculated in this way is 
 called Man-
 hattan distance. In general, Manhattan distance between two points (x1 , 
 y1 )
 and (x2 , y2 ) is calculated as |x2 - x1 | + |y2 - y1 |. As you must be 
 aware, the
 Eucledian distance between the same two points is calculated as
 (x2 - x1 )2 + (y2 - y1 )2
 3
 Figure 1: Manhattan distance
 Given n points to the taxicab driver located at a position (x,y), he/she 
 has to
 arrange the points in the order of increasing manhattan distance. For 
 example,
 If (3,4), (5,3) and (2,2) are the points given to the cab driver who is at 
 the
 postion (1,1), then the driver will output (2,2), (3,4) and (5,3) as these 
 points
 are in the order of increasing distance from the Taxicab position (1,1).
 You are required to write a program to help the driver. The input is of the
 following format:
 * The first line will contain the position of the Taxicab. For example, the
 position could be ((3,0)).
 * Next line will contain the number of points. For your program 2 = n =
 100
 * Next n lines will contain the points with each point on a new line.
 After reading the input, your program should calculate Manhattan distance
 from the Taxicab position and arrange the points in the order of increasing
 Manhattan distance. Each point should be printed in a new line. If 
 Manhattan
 distance is equal for two points, first output the point that has the 
 least x co-
 ordinate.
 For Example:
 INPUT
 (2,0)
 4
 (3,4)
 4
 (0,1)
 (6,7)
 (2,3)
 OUTPUT
 (0,1)
 (2,3)
 (3,4)
 (6,7)


NetworkX [1]. Es much more than what you need.

[1] http://networkx.lanl.gov/ 

-- 





[web2py] Re: Scheduler Demo App

2012-11-05 Thread apps in tables
Hi,

What is the link for those demos?

Regards,

Ashraf

On Monday, November 5, 2012 4:59:36 AM UTC+3, villas wrote:

 Many thanks,  I love those demos :)


 On Monday, November 5, 2012 12:34:22 AM UTC, Niphlod wrote:

 ok, spotted the problem. Attaching the patch here, sent it to Massimo to 
 apply to trunk.

 On Monday, November 5, 2012 12:12:34 AM UTC+1, villas wrote:

 Hi Niphlod,

 Windows 7
 Running latest web2py trunk source.

 I restarted  web2py.py from commandline
 I started a separate process for scheduler:  python web2py.py -K 
 schedtest -D 0
 I went to the page as before and pressed the buttons.

 I noticed that when I DISABLE the worker I get continous lines of this...
 DEBUG:web2py.scheduler:Someone stopped me, sleeping until better times 
 come (2)
 DEBUG:web2py.scheduler:Someone stopped me, sleeping until better times 
 come (3)

 When I ENABLE the worker I get this line interspersed...
 DEBUG:web2py.scheduler:recording heartbeat (DISABLED)

 Yes,  it says DISABLED even though my browser is saying ENABLED.   Hmm

 I'll send the log separately because it doesn't seem to attach properly 
 to this post.



-- 





[web2py] REF: jQuery Buttons

2012-11-05 Thread Teddy Nyambe
Hi,

How can i add buttons with icons in web2py!!!



-- 
...
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

/~

-- 





Re: [web2py] REF: jQuery Buttons

2012-11-05 Thread Bruno Rocha
The web2py welcome app uses bootstrap so the right place to find it is in:
http://twitter.github.com/bootstrap/base-css.html#icons

a class=btn btn-small href=#i class=icon-star/i My button with
icon/a

-- 





[web2py] Typo in the online book

2012-11-05 Thread dederocks
I think there is a typo at 
http://www.web2py.com/books/default/chapter/29/06#count,-isempty,-delete,-update
 :

Just before the next section,

except that it calls the validators for the fields before performing the 
update. Notice that it only works if query involves a single table. The 
number of updated records can be found in re*t*.updated and errors will be 
ret.errors.

-- 





Re: [web2py] Re: web2py 2.2.1 is OUT

2012-11-05 Thread Vasile Ermicioi
read this thread from the beginning

me:
the problem with routes_apps_raw and unicode url not fixed :(

massimo:
True. We are discussing on web2py_developers how that should work.

see also
http://code.google.com/p/web2py/issues/detail?id=1105


On Mon, Nov 5, 2012 at 1:38 PM, LightDot light...@gmail.com wrote:

 And you have it. Is there a specific bug that you're referring to, or..?

 Regards,
 Ales




-- 





[web2py] Re: Scheduler Demo App

2012-11-05 Thread Niphlod
github.com/niphlod/w2p_scheduler_tests

Il giorno lunedì 5 novembre 2012 13:46:13 UTC+1, apps in tables ha scritto:

 Hi,

 What is the link for those demos?

 Regards,

 Ashraf

 On Monday, November 5, 2012 4:59:36 AM UTC+3, villas wrote:

 Many thanks,  I love those demos :)


 On Monday, November 5, 2012 12:34:22 AM UTC, Niphlod wrote:

 ok, spotted the problem. Attaching the patch here, sent it to Massimo to 
 apply to trunk.

 On Monday, November 5, 2012 12:12:34 AM UTC+1, villas wrote:

 Hi Niphlod,

 Windows 7
 Running latest web2py trunk source.

 I restarted  web2py.py from commandline
 I started a separate process for scheduler:  python web2py.py -K 
 schedtest -D 0
 I went to the page as before and pressed the buttons.

 I noticed that when I DISABLE the worker I get continous lines of 
 this...
 DEBUG:web2py.scheduler:Someone stopped me, sleeping until better times 
 come (2)
 DEBUG:web2py.scheduler:Someone stopped me, sleeping until better times 
 come (3)

 When I ENABLE the worker I get this line interspersed...
 DEBUG:web2py.scheduler:recording heartbeat (DISABLED)

 Yes,  it says DISABLED even though my browser is saying ENABLED.   Hmm

 I'll send the log separately because it doesn't seem to attach properly 
 to this post.



-- 





Re: [web2py] REF: jQuery Buttons

2012-11-05 Thread Teddy Nyambe
Thanks where can i find more class options for variety???

Wrb2py is rocking!!

On 11/5/12, Bruno Rocha rochacbr...@gmail.com wrote:
 The web2py welcome app uses bootstrap so the right place to find it is in:
 http://twitter.github.com/bootstrap/base-css.html#icons

 a class=btn btn-small href=#i class=icon-star/i My button with
 icon/a

 --






-- 
...
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

/~

-- 





[web2py] Problems with LOAD and redirect(..., type='auto')

2012-11-05 Thread David Sorrentino
Hello everybody, :)

In practice, I have a page (default/calculate.html) which in turn loads 
another page (forms/mansioni.load) by means of LOAD.
Here the code of the page* default/calculate.html*:
!--some other HTML code here--
div
{{=LOAD('forms', 'mansioni.load', ajax=True)}}
/div
!--some other HTML code here--

The page *forms/mansioni.load* contains just a form, as the following code 
shows.
{{=form}}

When I submit a form (correctly filled), I would like to redirect the 
parent page *(default/calculate.html*) to another page.
According to the online book, this seems to be possible by using the 
syntaxredirect(url,type='auto'). So I wrote the controller 
*forms.py* in this way:
def mansioni():
form = SQLFORM.factory(
Field('something', 'string', requires=(IS_NOT_EMPTY()))
)
if form.accepts(request, session):
redirect(URL('default', 'someOtherPage', extension=False), 
type='auto')
return dict(form=form)

Unfortunately, I get the following error:
TypeError: redirect() got an unexpected keyword argument 'type'

It looks like there is no such an argument for the method *redirect*.

The web2py version I am using is: 2.2.1 (2012-10-29 09:31:46) stable.
The application is running on GAE.

Some thoughts? :)

Best,
David

-- 





[web2py] Re: Problems with LOAD and redirect(..., type='auto')

2012-11-05 Thread Leonel Câmara
I believe what you want is now:

client_side=True


as an argument to the redirect, instead of the type='auto'

The book seems to be outdated in that part.

-- 





[web2py] Re: Embed pygame on web2py page

2012-11-05 Thread stefaan
Unless I misunderstand your intention, I don't think that is possible. 
Pygame is made for desktop applications. Those cannot be magically embedded 
in a webpage (gtk3 has a neat trick in this area, but it's not very 
relevant to this discussion).
If you want to create a game running in your browser, you should probably 
should check out javascript or something on top of it like pyjamas (pyjamas 
comes with a sample asteroid game).



-- 





Re: [web2py] Re: Problems with LOAD and redirect(..., type='auto')

2012-11-05 Thread David Sorrentino
Thanks a lot Leonel!
It works. ;)

Wish you a good day,
David


On 5 November 2012 15:27, Leonel Câmara leonelcam...@gmail.com wrote:

 I believe what you want is now:

 client_side=True


 as an argument to the redirect, instead of the type='auto'

 The book seems to be outdated in that part.

 --





-- 





Re: [web2py] Re: Looking for a way to combine auto-complete with adding a non-existing item.

2012-11-05 Thread Richard Vézina
Hello Bill,

SELECT OR ADD OPTION is begining to be old, I have been look at this last
week and there is conflict between Bootstrap style and jQueyr UI style so
the add botton beside the field is not working if boostrap is used in your
form.

I the coming weeks I will try to create a new
autocomplete_select_or_add_option widget base on Bootstrap Typeahead... I
play a bit with BS Typeahead last week and I found it pretty nice, but the
API is not well documented, so I had to google a lot.

Richard

On Sun, Nov 4, 2012 at 8:51 PM, Bill Thayer bill.tha...@live.com wrote:

 I still haven't gotten this to work but do need this functionality
 desperatley. Anyone else have any luck?

 --





-- 





[web2py] Re: MS SQL server

2012-11-05 Thread Andrew W
Yes, there are a lot of advantages, but if your legacy tables can't be changed ?

Is it worth exploring The addition of PK support in forms and the grid?  Not 
the most optimised solution, but one that you may have to do.

-- 





[web2py] Re: MS SQL server

2012-11-05 Thread Niphlod
I guess noone had free time to invest in it. Sourcecode is available, 
anyone can pitch in if he feels that's a major feature to add.

Il giorno lunedì 5 novembre 2012 16:42:13 UTC+1, Andrew W ha scritto:

 Yes, there are a lot of advantages, but if your legacy tables can't be 
 changed ?

 Is it worth exploring The addition of PK support in forms and the grid? 
  Not the most optimised solution, but one that you may have to do.


-- 





Re: [web2py] Re: Looking for a way to combine auto-complete with adding a non-existing item.

2012-11-05 Thread Bill Thayer
Thank youRichard. I've have exhausted everything I could think of to get it 
to work.

-- 





Re: [web2py] Re: Looking for a way to combine auto-complete with adding a non-existing item.

2012-11-05 Thread Richard Vézina
I never try with SQLFORM.grid, maybe the form is a bit different than CRUD
or SQLFORM one...

Did you try the dummy app that I attach?

Richard

On Mon, Nov 5, 2012 at 11:44 AM, Bill Thayer bill.tha...@live.com wrote:

 Thank youRichard. I've have exhausted everything I could think of to get
 it to work.

 --





-- 





Re: [web2py] Re: Looking for a way to combine auto-complete with adding a non-existing item.

2012-11-05 Thread Richard Vézina
sorry, I thought I had attach a example app, but I didn't...

Richard

On Mon, Nov 5, 2012 at 12:15 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 I never try with SQLFORM.grid, maybe the form is a bit different than CRUD
 or SQLFORM one...

 Did you try the dummy app that I attach?

 Richard


 On Mon, Nov 5, 2012 at 11:44 AM, Bill Thayer bill.tha...@live.com wrote:

 Thank youRichard. I've have exhausted everything I could think of to get
 it to work.

 --







-- 





[web2py] How many error tickets does a typical newbie handle?

2012-11-05 Thread Bill Thayer
The other day I read on web2py developers a discussion detailing Massimo's 
vision of web3py. Perhaps us newbies can start collecting our tickets to 
aide Massimo and the developers in understanding what is particularly 
difficult or perhaps could use better documentation. Currently I have *480 
tickets since 10/8* on my application before I decide to re-do it from 
scratch for the 4th (hopefully last) time. Tickets would provide a wealth 
of statistics about what us newbies are going through.

This time I decided to break my app up into 4 smaller applications. Start 
over and my 2nd try this morning (after deleting and starting over) I 
currently have 19 tickets in 45 minutes. When developing using SQLite I am 
now getting the same errors that I had early on in my development  

Adding columns is not trivial especial with all the combinations of: 
migrate_enabled={True|False}, fake_migrate={True|False}, 
migrate='web2py_session_APPNAME', migrate.settings={True|False}, 
migrate={'table_name'|True|False|migrate.settings}. My approach was to use 
the wizard to quickly whip out the app then add extra fields later so that 
i can develop in small iterations. If just the tickets for what I am going 
through this morning could be eliminated that would be huge!

FWIW,
Bill

-- 





[web2py] How to add a column?

2012-11-05 Thread Bill Thayer
Can't beleive this question does not come up in the search box. How do i 
add a column to a table using SQLlite? Simply adding hte field to the 
define table statement throws an error.

Using SQLlite I cannot add a Field. I get an error message:


OperationalError: no such column: source_via.substrate


No Joke Really? 


When I set migrate_enabled=True then the message changes to something like the 
table sourc_via does not exist


Of course it does since I just added the column that I'm being told does not 
exist either to it.


On top of all that I am back to the Rocket server locking up. It likes to do 
that so I have to use Task manager to close it. Could be that session.connect 
+SQLlite is not a good combinnation.

-- 





Re: [web2py] Re: Looking for a way to combine auto-complete with adding a non-existing item.

2012-11-05 Thread Bill Thayer
Now that is impressive. I did get it to work but not with SQLFORM or 
SQLFORM.smartgrid so that was a large part of my problem. 

When renderred in the view created by SQLGRID (clicking the ADD+ button) I 
would get the SQLFORM and the person fields were displayed with it's own 
submit button. This looked like it could be a bonus however the Add New 
link did not work (doesn't really need to if the form is already rendered) 
and information was not saved to the database. Confirmed this by visiting 
the grid again. I could see all of the users you added before.

Looks like I'll drop use of SQLFORM in favor of this widget.Thank you for 
the sample app. It made a big difference.

Regards,
Bill




-- 





Re: [web2py] Re: Looking for a way to combine auto-complete with adding a non-existing item.

2012-11-05 Thread Bill Thayer
This widget wouldn't break appadmin? would it? These are the many unknown 
things that really frustrate me about web2py.

I edited the models file to test my current troubles adding columns to 
tables that are already created. With your sample app, I was able to add 
the new table and then add columns to cats. However when i edited the cat 
to add a color or collar those new values were not saved.


db.define_table('collars',
Field('material', requires=IS_IN_SET(['leather', 'chain'])),
Field('size', requires=IS_IN_SET(['small', 'med', 
'large'])),
format='%(size)s %(material)s')

db.define_table('cat',
Field('name','string'),
Field('color', 'string'),
Field('collar', 'reference collars'),
Field('person_id', 'reference person', 
widget=AutocompleteWidgetSelectOrAddOption(request, 
db.person.first_name, 
id_field=db.person.id, 
limitby=(0,10), 
min_length=2, 
form_title=T('Add new person'), 
controller=default, 
function=add_person, 
button_text = T('Add new'))
),
format='%()s'
)

Regards,
Bill

-- 





Re: [web2py] Re: Looking for a way to combine auto-complete with adding a non-existing item.

2012-11-05 Thread Richard Vézina
I don't think appadmin is taking care of widget...

I don't follow you, are you talking that you add a column and the old entry
are NULL?

On Mon, Nov 5, 2012 at 2:48 PM, Bill Thayer bill.tha...@live.com wrote:

 This widget wouldn't break appadmin? would it? These are the many unknown
 things that really frustrate me about web2py.

 I edited the models file to test my current troubles adding columns to
 tables that are already created. With your sample app, I was able to add
 the new table and then add columns to cats. However when i edited the cat
 to add a color or collar those new values were not saved.


 db.define_table('collars',
 Field('material', requires=IS_IN_SET(['leather',
 'chain'])),
 Field('size', requires=IS_IN_SET(['small', 'med',
 'large'])),
 format='%(size)s %(material)s')

 db.define_table('cat',
 Field('name','string'),
 Field('color', 'string'),
 Field('collar', 'reference collars'),
 Field('person_id', 'reference person',
 widget=AutocompleteWidgetSelectOrAddOption(request,
 db.person.first_name,
 id_field=db.person.id,
 limitby=(0,10),
 min_length=2,
 form_title=T('Add new person'),
 controller=default,
 function=add_person,
 button_text = T('Add new'))
 ),
 format='%()s'
 )

 Regards,
 Bill

  --





-- 





Re: [web2py] Re: Looking for a way to combine auto-complete with adding a non-existing item.

2012-11-05 Thread Bill Thayer
Hi Richard,

In short...for myself and future searches...This widget works in a straight 
up crud form but with SQLFORM it has different behavior. Whether or not it 
is the source of appadmin not storing values is yet to be determined.

After my columns were successfully added, values were set to null 
automatically of course. When I tried using appadmin to change the values 
(note this has nothing to do with the widget except the widget happens to 
be rendered on the edit or create page) the values do not update. Not 
saying it's the widget, I just don't know.

Regards,
Bill


-- 





[web2py] Re: How to add a column?

2012-11-05 Thread Niphlod
in the normal way (i.e. a new Field(), with of course nothing set to 
prevent migrations, such as migrate=False in the table def, migrate=False, 
fake_migrate=False, migrate_enabled=False, fake_migrate_all=True in the 
DAL, etc).
There absolutely no problem on doing that.
With the first error it seems that you added a Field but you didn't let the 
table to migrate (i.e. web2py expected a column to be there already, and it 
didn't find that)
The second instead seems to point to a table that existed in the db and was 
dropped manually (assuming that you defined the table 'source_via' and 
you're trying to access it as 'source_via', your error seems like a typo 
'sourc_via' without the 'e').

PS: let me explain for others stumbling on this post on how migrations 
work. database/*.table files are there to hold the situation on the 
current database status.
With default settings (i.e., migrations turned on):
- the database/ folder holds all the table definitions as they are on the 
database (the *.table files)
- whenever a request comes in and your db.py is executed, web2py spots 
the differences between your .table files and the db.define_table() 
statements (table files holds a photography on what was the model the 
last time you executed db.py): if there are differencies (like a new 
column, or a new table) the table is created on the db (check sql.log for 
the statements used), and the .table file is updated to reflect what there 
is in the db

What happens if you set migrate=False in the table definition ? the check 
between the model in db.py and the .table file is skipped, and web2py 
assumes that on the db the table reflect exactly what there is in the model

What happens if you set fake_migrate=True in the table definition ? web2py 
assumes that on the db the table reflect exactly what there is in the 
model, the .table files are recreated 

What happens if you set fake_migrate_all=True in the DAL ? all .table files 
are recreated, and web2py assumes that on the db the db tables are 
reflecting the model.
 
What happens if you set migrate=False in the DAL? whatever table has no a 
specific migrate parameter, the migrate=False is applied to every table

This kind of errors can happen only if you messed with this logic, e.g.
db.define_table('test', Field('test1'), migrate=True) #web2py create the 
test table with the columns id and test1


then
db.define_table('test', Field('test1'), Field('test2'), 
migrate=False,fake_migrate
=True) # web2py assumes that you created manually on the db the column 
test2, and updates the .table file


then 
db.define_table('test', Field('test1'), Field('test2')) # web2py sees no 
change between the .table file and the model, but if there's not the column 
on the db, when you try to use it you'll get the no such column error



then you delete the 'test' .table file manually, then
db.define_table('test', Field('test1'), Field('test2'), migrate=True) #web2py 
assumes that the 'test' table is not on the db, because the corresponding 
.table file is not there, so it tries to create it, and you get the error 
table 'test' already exists on the db



or, you delete the 'test' .table file manually, and drop the table manually 
on the db then
db.define_table('test', Field('test1'), migrate=False) #web2py assumes that 
the table is already there, and when you try to use it you get the error 
table 'test' does not exist

PS: session.connect(db) where db is SQLite is bad on every possible level. 
Everytime a session changes you won't be able to write to the database 
(SQLite by default doesn't allow simultaneous writes). session.connect(db) 
is there to allow several web2py instances on different machines to NOT 
have the sessions/ folder shared among them (or when you don't have write 
access to the disk), and to be used with professional db (postgres, 
mssql, mysql, oracle, etc)
Even better is to use memcached or redis for sessions, if you have those 
available, or stick to cookie based sessions if your session data is little.

PS2: what's wrong with default file-based sessions anyway? Unless you have 
100 concurrent requests AND ~40K separate sessions there is absolutely no 
performance gain observable using other methods (db, redis, memcache, 
cookies). The only added feature is being able to have separate web2py 
instances on different servers without configuring a load balancer with 
sticky sessions in front of those.

-- 





[web2py] Re: How many error tickets does a typical newbie handle?

2012-11-05 Thread Niphlod
while developing you should NOT use any of the migrate, fake_migrate, 
migrate_enabled, etc. Zero tickets in regards of db migrations (unless you 
do something weird like trying to change a column type from string to 
integer).

The minute you go on production, deploy the app, hit the appadmin page (so 
all tables are created on your fresh production db), return to the db.py 
file and set migrate=False on the DAL.
Next iteration, you develop another piece of app, freeze it, update your 
production, set migrate=True on the DAL, re-hit the appadmin page, return 
to db.py and set migrate=False.
Next iteration, you screw some table (like converting a string column to an 
integer), the previous working method will NOT work (mostly because only 
you can know how to migrate that column (others call it fixturese.g. 
attempt a conversion and NULL all fields that doesn't cast to integers vs 
drop the column and readd and fill with default values, etc, etc, etc)). 
It's time to:
- manually alter the database (optionally applying your fixtures) so that 
the db reflects your model
- update your app
- optional step: set fake_migrate_all=True in the DAL, hit the appadmin 
page (so .table files are recreated) and reset fake_migrate_all to False
- set migrate=False on the DAL
- use you app

Didn't have ANY problems with this line of work in 2 years of deployment.

-- 





Re: [web2py] Re: Looking for a way to combine auto-complete with adding a non-existing item.

2012-11-05 Thread Richard Vézina
ok, yes I think there is a issue... In my app it working, but in the dummy
app it's not don't know why...

Maybe with SQLFORM you need to set the formstyle to divs.

Richard

On Mon, Nov 5, 2012 at 3:42 PM, Bill Thayer bill.tha...@live.com wrote:

 Hi Richard,

 In short...for myself and future searches...This widget works in a
 straight up crud form but with SQLFORM it has different
 behavior. Whether or not it is the source of appadmin not storing values is
 yet to be determined.

 After my columns were successfully added, values were set to null
 automatically of course. When I tried using appadmin to change the values
 (note this has nothing to do with the widget except the widget happens to
 be rendered on the edit or create page) the values do not update. Not
 saying it's the widget, I just don't know.

 Regards,
 Bill


  --





-- 





[web2py] Re: Scheduler Demo App

2012-11-05 Thread apps in tables
Thanks Niphlod,

I am having a small question about tvseries, what was the need for cherrypy 
beside web2py?

Regards,

Ashraf

On Monday, November 5, 2012 4:50:55 PM UTC+3, Niphlod wrote:

 github.com/niphlod/w2p_scheduler_tests

 Il giorno lunedì 5 novembre 2012 13:46:13 UTC+1, apps in tables ha scritto:

 Hi,

 What is the link for those demos?

 Regards,

 Ashraf

 On Monday, November 5, 2012 4:59:36 AM UTC+3, villas wrote:

 Many thanks,  I love those demos :)


 On Monday, November 5, 2012 12:34:22 AM UTC, Niphlod wrote:

 ok, spotted the problem. Attaching the patch here, sent it to Massimo 
 to apply to trunk.

 On Monday, November 5, 2012 12:12:34 AM UTC+1, villas wrote:

 Hi Niphlod,

 Windows 7
 Running latest web2py trunk source.

 I restarted  web2py.py from commandline
 I started a separate process for scheduler:  python web2py.py -K 
 schedtest -D 0
 I went to the page as before and pressed the buttons.

 I noticed that when I DISABLE the worker I get continous lines of 
 this...
 DEBUG:web2py.scheduler:Someone stopped me, sleeping until better 
 times come (2)
 DEBUG:web2py.scheduler:Someone stopped me, sleeping until better 
 times come (3)

 When I ENABLE the worker I get this line interspersed...
 DEBUG:web2py.scheduler:recording heartbeat (DISABLED)

 Yes,  it says DISABLED even though my browser is saying ENABLED.   Hmm

 I'll send the log separately because it doesn't seem to attach 
 properly to this post.



-- 





[web2py] Re: Scheduler Demo App

2012-11-05 Thread Niphlod
going offtopic here, but just to reply to your question none (in fact, 
there's no cherrypy lib in the app), just some of the ideas and the 
internals found crawling the code I used in the very first iterations of 
the deployment. 

It's listed in the credits area (as xbmc and couchpotato are) but no code 
was taken nor lib is used from those projects. Other libs that are included 
(or code was taken/adapted from) are specifically indicated. 

-- 





[web2py] Re: Import error with 2.2.1

2012-11-05 Thread Neil
No problem. Here is what I get:

 import matplotlib.pylab
Traceback (most recent call last):
  File console, line 1, in module
  File 
/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File 
/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/pylab.py,
 
line 221, in module
from matplotlib import mpl  # pulls in most modules
  File 
/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File 
/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/mpl.py,
 
line 10, in module
from matplotlib import figure
  File 
/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File 
/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/figure.py,
 
line 29, in module
from projections import projection_factory, get_projection_names, \
  File 
/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File 
/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/projections/__init__.py,
 
line 1, in module
from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
ImportError: cannot import name AitoffAxes

On Friday, November 2, 2012 3:48:53 PM UTC, Massimo Di Pierro wrote:

 I need your help. In gluon/custom_import.py can you replace

 except ImportError, e1: # line 84
 import_tb = sys.exc_info()[2]
 try:
 return NATIVE_IMPORTER(name, globals, locals, fromlist, 
 level) # line 87
 except ImportError, e3:
 raise ImportError, e1, import_tb  # there an import error 
 in the module

 with

 except ImportError, e1: # line 84
 import_tb = sys.exc_info()[2]
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level) 
 # line 87

 and see what changes?



 On Friday, 2 November 2012 09:09:03 UTC-5, Neil wrote:

 Can't see any potential conflicts. I have the problem for both 
 track_changes(True) and track_changes(False). When I import from shell:

 [aicbt@web331 web2py2.2.1]$ python web2py.py -S init
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2012
 Version 2.2.1 (2012-10-21 16:57:04) stable
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 MySQL(MySQLdb), PostgreSQL(psycopg2), PostgreSQL(pg8000), IMAP(imaplib)
 WARNING:web2py:import IPython error; use default python shell
 Python 2.7.3 (default, May 18 2012, 14:51:16)
 [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
 Type help, copyright, credits or license for more information.
 (InteractiveConsole)
  import matplotlib.pylab
 Traceback (most recent call last):
   File console, line 1, in module
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 77, in custom_importer
 raise ImportError, 'Cannot import module %s' % str(e)
 ImportError: Cannot import module 'matplotlib'

 This shell command works with web2py version 2.1. Also, import 
 matplotlib (without the pylab) works fine for 2.2.1.

 On Friday, November 2, 2012 1:22:03 PM UTC, Massimo Di Pierro wrote:

 Do you have anything in your app/modules/*  that may conflict? Did you 
 set track_changes(True) or not? If you do web2py.py -S yourapp can you 
 import form the web2py shell?

 On Friday, 2 November 2012 02:18:47 UTC-5, Neil wrote:

 A little more info:

 - On linux (works fine on Windows)
 - matplotlib is an egg in the lib directory
 - import matplotlib works, but import matplotlib.pylab doesn't
 - Has worked fine in every version up to 2.1

 Any ideas for a workaround or to debug further?

 On Thursday, November 1, 2012 9:52:57 PM UTC, Massimo Di Pierro wrote:

 Where is matplotlib installed?

 On Thursday, 1 November 2012 15:51:14 UTC-5, Neil wrote:

 I just upgraded from 2.1 to 2.2.1, and I can no longer import 
 matplotlib. I get the following error:

 ImportError: Cannot import module 'matplotlib'


 Is this related to the custom import? Perhaps it is the same as issue 
 1125?



-- 





[web2py] Re: Scheduler Demo App

2012-11-05 Thread apps in tables
Thanks...

On Tuesday, November 6, 2012 12:41:52 AM UTC+3, Niphlod wrote:

 going offtopic here, but just to reply to your question none (in fact, 
 there's no cherrypy lib in the app), just some of the ideas and the 
 internals found crawling the code I used in the very first iterations of 
 the deployment. 

 It's listed in the credits area (as xbmc and couchpotato are) but no code 
 was taken nor lib is used from those projects. Other libs that are included 
 (or code was taken/adapted from) are specifically indicated. 



-- 





[web2py] Re: How many error tickets does a typical newbie handle?

2012-11-05 Thread Bill Thayer
Niphold,

Really appreciate your taking the time to spell this procedure out. It will 
come in handy for me and others too I bet! 

Thanks,
Bill

-- 





[web2py] Re: How to add a column?

2012-11-05 Thread Bill Thayer
Very Interesting. Thank you!

-- 





[web2py] Re: Proposal: Explicit mapping of None values in Field object

2012-11-05 Thread Joe Barnhart

I can hear the thundering roar of one hand clapping...

-- Joe

-- 





Re: [web2py] Re: Problem in deploying ssl certificates to Rocket server.

2012-11-05 Thread Amit
Thanks for your response Ales, I used the openssl command to generate the
certificates which Niphold has suggested me but when i tried to deploy it
to Rocket sever using below command :

*web2py.py --ssl_certificate=D:\certificates\server.crt
--ssl_private_key=D:\certificates\server_key.key
--ca-cert=D:\certificates\server.crt


*It gives* * following warning on command prompt:

*WARNING:web2py:unable to open SSL certificate. SSL is OFF

*And below error on Mozilla Firefox browser:*
*
*SSL received a record that exceeded the maximum permissible length.

(Error code: ssl_error_rx_record_too_long)

*Hope this will help you to understand the problem.*

*Thanks,
Amit*
*
On Mon, Nov 5, 2012 at 5:17 PM, LightDot light...@gmail.com wrote:

 One way I know of is the same Niphlod told you in his previous post - use
 openssl to generate the certificate. He gave you the complete command
 example, I don't know how to be clearer than that...

 http://www.openssl.org/related/binaries.html

 Regards,
 Ales



 On Monday, November 5, 2012 12:40:28 PM UTC+1, Amit wrote:

 I run the command to generate certificates:

 *web2py.py --ssl_certificate=D:\certificates\server.crt
 --ssl_private_key=D:\certificates\server_key.key
 --ca-cert=D:\certificates\server.crt*

 And when I run this, It gives warning message on command prompt:

 *WARNING:web2py:unable to open SSL certificate. SSL is OFF*

 and on browser it display following error message:

 *SSL received a record that exceeded the maximum permissible length.

 (Error code: ssl_error_rx_record_too_long)*


 So no idea, how to resolve this?

 Thanks,
 Amit



 On Mon, Nov 5, 2012 at 4:10 PM, Niphlod nip...@gmail.com wrote:

 the usual

 openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mysitename.key
 -out mysitename.crt

 works ok.

 Il giorno lunedì 5 novembre 2012 03:48:43 UTC+1, Amit ha scritto:

 Thanks Niphold for replying. How can I create server cetificate, CA
 certificate and client certificate without password? I am using simpatica
 application to create all these certificates on windows XP machine and this
 application doesn't allow to create certificates without password so if you
 know any other way to create these certificates without password on windows
 then please do share me.

 waiting for your response.

 Thanks,
 Amit

 On Fri, Nov 2, 2012 at 6:23 PM, Niphlod nip...@gmail.com wrote:

 certs are supposed to be generated without passwords. Even in apache,
 etc, if you protect them with a password it will be asked every time the
 process is started, and web2py (rocket) doesn't support that.


 On Friday, November 2, 2012 6:21:00 AM UTC+1, Amit wrote:

 Hi ,

 I generated CA certificates, private key, server certificate and
 client certificate using “Simpatica” application developed in web2py.

 But when I tried to deploy the certificates to rocket server using
 below command on windows XP machine:



 D:\web2py2.1.1\web2pyweb2py.**py --ssl_certificate=D:\**
 certificates\server\cert.pe

 m --ssl_private_key=D:\**certificates\private_key\**cacert.key
 --ca-cert=D:\certific

 ates\CA_certificate\cacrt.pem



 It starts web2py server dialog asking about password and after giving
 password, it displays below information on the command prompt:



 No handlers could be found for logger web2py

 web2py Web Framework

 Created by Massimo Di Pierro, Copyright 2007-2012

 Version 2.1.1 (2012-10-15 12:44:40) stable

 Database drivers available: SQLite(sqlite3), MySQL(pymysql),
 PostgreSQL(pg8000),

  IMAP(imaplib)

 please visit:

 https://127.0.0.1:8000

 starting browser...

 Enter PEM pass phrase:

 Enter PEM pass phrase:

 Enter PEM pass phrase:



 As per the sequence of certificates on command line, I gave password
 for e.g. for cert.pem(server certificate file) , I have given Server@123,
 and for cacert.key(CA private key) and cacert.pem(CA certificate) , I 
 have
 given test123.

 NOTE: These passwords are used while generating the respective
 certificates means for generating cert.pem , I used Server@123 and
 so on.

 So on above scenario , I have given password Server@123,test123 and
 test123 on command prompt but it is giving following error on browser:



 *Secure Connection Failed

  An error occurred during a connection to 127.0.0.1:8000.

 Cannot communicate securely with peer: no common encryption
 algorithm(s).

 (Error code: ssl_error_no_cypher_overlap)

   The page you are trying to view cannot be shown because the
 authenticity of the received data could not be verified.
   Please contact the website owners to inform them of this problem.
 Alternatively, use the command found in the help menu to report this 
 broken
 site.*





 Could anyone please help me out to resolve this issue?



 Regards,

 Amit

  --





  --





  --





-- 





[web2py] Re: GAE and count and smartgrid

2012-11-05 Thread howesc
i made a patch for 
reviewhttp://code.google.com/p/web2py/issues/detail?id=1143

On Monday, October 15, 2012 7:26:00 PM UTC-7, howesc wrote:

 Hi all,

 I am trying to integrate smartgrid into my web2py GAE app..but i have 
 some tables with millions of rows, so when i want to load a table with no 
 query filters the count() fails to return on GAE in 60 seconds.

 I'm thinking about creating a patch to grid/smartgrid that does not use 
 row count on GAE, and uses cursors for pagination.  the drawback is that 
 you won't be able to see the total count of rows.

 i'm also considering enhancing the count() method for GAE connections to 
 be able to pass in extra attributes to pass through to the GAE count() 
 method: 
 https://developers.google.com/appengine/docs/python/datastore/queryclass#Query_count
  namely limit and/or deadline (depending on my use case).  i don't really 
 want count() to take my full 60 second processing time leaving me with no 
 time to recover

 does anyone have thoughts or opinions about grid/smartgrid and how 
 count/pagination works currently?  would there be objections to a DAL patch 
 that supports extra attributes in the GAE version of count()?

 thanks for the insights!

 christian


-- 





[web2py] Re: Import error with 2.2.1

2012-11-05 Thread Massimo Di Pierro
can you do

from matplotlib.projections.geo import AitoffAxes

I assume it is there.

On Monday, 5 November 2012 16:10:14 UTC-6, Neil wrote:

 No problem. Here is what I get:

  import matplotlib.pylab
 Traceback (most recent call last):
   File console, line 1, in module
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 87, in custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
   File 
 /home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/pylab.py,
  
 line 221, in module
 from matplotlib import mpl  # pulls in most modules
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 87, in custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
   File 
 /home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/mpl.py,
  
 line 10, in module
 from matplotlib import figure
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 87, in custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
   File 
 /home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/figure.py,
  
 line 29, in module
 from projections import projection_factory, get_projection_names, \
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 87, in custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
   File 
 /home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/projections/__init__.py,
  
 line 1, in module
 from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
 ImportError: cannot import name AitoffAxes

 On Friday, November 2, 2012 3:48:53 PM UTC, Massimo Di Pierro wrote:

 I need your help. In gluon/custom_import.py can you replace

 except ImportError, e1: # line 84
 import_tb = sys.exc_info()[2]
 try:
 return NATIVE_IMPORTER(name, globals, locals, fromlist, 
 level) # line 87
 except ImportError, e3:
 raise ImportError, e1, import_tb  # there an import error 
 in the module

 with

 except ImportError, e1: # line 84
 import_tb = sys.exc_info()[2]
 return NATIVE_IMPORTER(name, globals, locals, fromlist, 
 level) # line 87

 and see what changes?



 On Friday, 2 November 2012 09:09:03 UTC-5, Neil wrote:

 Can't see any potential conflicts. I have the problem for both 
 track_changes(True) and track_changes(False). When I import from shell:

 [aicbt@web331 web2py2.2.1]$ python web2py.py -S init
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2012
 Version 2.2.1 (2012-10-21 16:57:04) stable
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 MySQL(MySQLdb), PostgreSQL(psycopg2), PostgreSQL(pg8000), IMAP(imaplib)
 WARNING:web2py:import IPython error; use default python shell
 Python 2.7.3 (default, May 18 2012, 14:51:16)
 [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
 Type help, copyright, credits or license for more information.
 (InteractiveConsole)
  import matplotlib.pylab
 Traceback (most recent call last):
   File console, line 1, in module
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 77, in custom_importer
 raise ImportError, 'Cannot import module %s' % str(e)
 ImportError: Cannot import module 'matplotlib'

 This shell command works with web2py version 2.1. Also, import 
 matplotlib (without the pylab) works fine for 2.2.1.

 On Friday, November 2, 2012 1:22:03 PM UTC, Massimo Di Pierro wrote:

 Do you have anything in your app/modules/*  that may conflict? Did you 
 set track_changes(True) or not? If you do web2py.py -S yourapp can you 
 import form the web2py shell?

 On Friday, 2 November 2012 02:18:47 UTC-5, Neil wrote:

 A little more info:

 - On linux (works fine on Windows)
 - matplotlib is an egg in the lib directory
 - import matplotlib works, but import matplotlib.pylab doesn't
 - Has worked fine in every version up to 2.1

 Any ideas for a workaround or to debug further?

 On Thursday, November 1, 2012 9:52:57 PM UTC, Massimo Di Pierro wrote:

 Where is matplotlib installed?

 On Thursday, 1 November 2012 15:51:14 UTC-5, Neil wrote:

 I just upgraded from 2.1 to 2.2.1, and I can no longer import 
 matplotlib. I get the following error:

 ImportError: Cannot import module 'matplotlib'


 Is this related to the custom import? Perhaps it is the same as issue 
 1125?



-- 





[web2py] Re: Proposal: Explicit mapping of None values in Field object

2012-11-05 Thread Massimo Di Pierro
please open a ticket about this. I will take care of it asap.

On Thursday, 1 November 2012 15:54:53 UTC-5, Joe Barnhart wrote:

 This proposal solves a problem I have when formatting Field values.  I 
 created a custom Validator class which maps the value None into a string 
 (such as N/A or NT), but the mapping was ignored because the current 
 Field processing provides an early exit if the value of the Field is None, 
 i.e. it never reaches the Validator object for formatting.

 Proposal:

 I propose creating a new keyword variable for Field objects, called 
 map_none which is initialized to None for backwards compatibility:

  
map_none = None,

 . . .

self.map_none = map_none



 Next, we use the value of map_none as the return value for None from the 
 formatter function:


 def formatter(self, value):
 requires = self.requires
 if value is None or not self.requires:
 return value or self.map_none


 Last, for symmetry, we alter the validator to replace any occurrence of 
 map_none with None when processing items to go back into the database.  In 
 my case it will accept any entered value of NT and map it back into None 
 when storing row data in the database.  I would also use it to replace 
 empty strings with None (which I prefer over empty strings in the database 
 when values are not entered).

 
 def validate(self, value):
 if not self.requires:
 return ((value if value!=self.map_none else None), None)
 requires = self.requires
 if not isinstance(requires, (list, tuple)):
 requires = [requires]
 for validator in requires:
 (value, error) = validator(value)
 if error:
 return (value, error)
 return ((value if value!=self.map_none else None), None)

 This approach allows any mapping of None into an object of the user's 
 choosing, and provides the mapping in a consistent and bi-directional 
 manner.  It preserves all existing behavior of Validators.  The only cost 
 is an additional variable carried in Field objects and the time expended on 
 the trivial if tests to map the value.

 Any thoughts?

 -- Joe B.

-- 





[web2py] How to create a list from a select query

2012-11-05 Thread Amirshk
I am trying to figure out how to convert a Set or Rows into a list and not 
a table.
This is what I tried so far:

`list_tags` was supposed to convert the list, but I can't figure this one 
out. 

def list_tags(id):
tags = db(db.credit_transactions_tags.transaction_ref == 
id).select()
if tags:
html = 'ul'
for tag in tags:
html += 'li'+tag.name+'/li'
html += '/ul'
return html
else:
return ''

links =  [{'header':'Tags', 'body': lambda row: list_tags(row.id) 
}]
records = 
SQLFORM.grid(db.credit_transactions.account_ref==account_id, fields=fields, 
links=links, maxtextlength=50, args=[account_id])


Thanks in advance.

-- 





[web2py] maximum recursion depth exceeded

2012-11-05 Thread Thiago Abreu
I'm trying to generate a simple CRUD but I have this error
maximum recursion depth exceeded


my view

def crud():
return dict(form=crud())


i'm newbie in web2py
-- 
Um Abraço,
Thiago Abreu

-- 





[web2py] Re: maximum recursion depth exceeded

2012-11-05 Thread Massimo Di Pierro
You function is called itself.

On Monday, 5 November 2012 13:04:29 UTC-6, Thiago Abreu wrote:

 I'm trying to generate a simple CRUD but I have this error 
 maximum recursion depth exceeded


 my view

 def crud(): 

 return dict(form=crud())


 i'm newbie in web2py
 -- 
 Um Abraço, 
 Thiago Abreu


-- 





Re: [web2py] web2py for realtime asterisk

2012-11-05 Thread Emilius Omeen

in current realization web2py app connect only with mysql db, and Asterisk 
get sip peers configuration from DB, Asterisk get dialplan configuration 
from DB too. In next versions I think need to add possibility to change 
asterisk conf files using Asterisk AMI.
Asterisk qery sql db for check sip peers configuration, and save sip peers 
state in sql table.

more information about realtime technology 
http://www.voip-info.org/wiki/view/Asterisk+RealTime  
in Asterisk need to add supporting res_config_mysql.so (MySQL RealTime 
Configuration Driver) 
(MySQL RealTime Configuration Driver) 
 -/etc/asterisk/extconfig.conf
sipusers = mysql,realtimesip, sip_conf_db
sippeers = mysql,realtimesip, sip_conf_db
extensions= mysql,realtimesip, realtime_ext3
 add in file /etc/asterisk/extensions.conf
switch = Realtime/@extensions
 - in /etc/asterisk/res_config_mysql.conf
[realtimesip]
dbhost = 127.0.0.1
dbname = webtopy
dbuser = testuser
dbpass = topsecret
dbport = 3306
dbsock = /var/run/mysqld/mysqld.sock
requirements=warn

in web2py models/db.py
db = DAL('mysql://testuser:topsecret@localhost:3306/webtopy')
 ... definition of asterisk tables


понедельник, 5 ноября 2012 г., 1:37:54 UTC+4 пользователь Ramos написал:

 I like asterisk.
 How do you connect to asterisk from web2py?




-- 





Re: [web2py] Re: SQLFORM.smartgrid oncreate,ondelete not firing

2012-11-05 Thread vivek

Hi , 

  So in this case how do I make sure it fires only when a new record is 
created for the child table in this case quotelines . Suppose if I have 2 
different functions to be fired for the parent - oncreate and child - 
oncreate? 

Regards,
Vivek



On Monday, October 29, 2012 11:39:08 PM UTC+4, howesc wrote:

 something like:

 def myondelete(table, row_id):
  
  pass

 form = SQLFORM.smartgrid(..., ondelete=myondelete, ...)



 On Sunday, October 28, 2012 6:57:12 AM UTC-7, vivek wrote:

 So how would the new code be? I am a newbie a bit of direction needed!




 On Sun, Oct 28, 2012 at 5:39 PM, Niphlod nip...@gmail.com wrote:

 oncreate, ondelete, onupdate are callbacks to functions, not dicts


 On Sunday, October 28, 2012 12:26:39 PM UTC+1, vivek wrote:

 Hi,

 @auth.requires_login()
 def index():
 response.view = 'Final/pricelist.html'
 form = SQLFORM.smartgrid(db.sourcelis**t,linked_tables=['itemowner'
 ],**deletable=dict(sourcelist=Fals**e,itemowner=True), editable=dict(
 sourcelist=False**,itemowner=True), details=dict(sourcelist=False,**
 itemowner=False),links = dict(project=[lambda row: A(SPAN(_class=
 'icol-find'),_**href=URL(sourcelist,**itemowner,args=[row.id]))]),o
 **ncreate=dict(itemowner=[avgpri**ce]),ondelete=dict(itemowner=[**
 'avgprice'])) 
 return dict(form=form)

 @auth.requires_login()
 def avgprice():
 ...

 The above is my code . itemowner is my child table. I have manually 
 tried running avgprice() from appadmin to make sure it works. There wasnt 
 an issue. I just need to get the smartgrid to trigger avgprice.

 Thanks!

  -- 
  
  
  




-- 





[web2py] Re: Import error with 2.2.1

2012-11-05 Thread Neil
It seems to be there, as I can import it from a normal python shell. Here 
is what I get from the web2py shell:

 from matplotlib.projections.geo import AitoffAxes
Traceback (most recent call last):
  File console, line 1, in module
  File 
/home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File 
/home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/projections/__init__.py,
 
line 1, in module
from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
ImportError: cannot import name AitoffAxes

Email me if you would like me to arrange access to the server for a faster 
debug cycle (unfortunately I'm a little too busy to investigate this myself 
at the moment).

On Tuesday, November 6, 2012 4:43:39 AM UTC, Massimo Di Pierro wrote:

 can you do

 from matplotlib.projections.geo import AitoffAxes

 I assume it is there.

 On Monday, 5 November 2012 16:10:14 UTC-6, Neil wrote:

 No problem. Here is what I get:

  import matplotlib.pylab
 Traceback (most recent call last):
   File console, line 1, in module
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 87, in custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
   File 
 /home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/pylab.py,
  
 line 221, in module
 from matplotlib import mpl  # pulls in most modules
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 87, in custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
   File 
 /home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/mpl.py,
  
 line 10, in module
 from matplotlib import figure
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 87, in custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
   File 
 /home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/figure.py,
  
 line 29, in module
 from projections import projection_factory, get_projection_names, \
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 87, in custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
   File 
 /home/aicbt/lib/python2.7/matplotlib-1.1.0-py2.7-linux-x86_64.egg/matplotlib/projections/__init__.py,
  
 line 1, in module
 from geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
 ImportError: cannot import name AitoffAxes

 On Friday, November 2, 2012 3:48:53 PM UTC, Massimo Di Pierro wrote:

 I need your help. In gluon/custom_import.py can you replace

 except ImportError, e1: # line 84
 import_tb = sys.exc_info()[2]
 try:
 return NATIVE_IMPORTER(name, globals, locals, fromlist, 
 level) # line 87
 except ImportError, e3:
 raise ImportError, e1, import_tb  # there an import 
 error in the module

 with

 except ImportError, e1: # line 84
 import_tb = sys.exc_info()[2]
 return NATIVE_IMPORTER(name, globals, locals, fromlist, 
 level) # line 87

 and see what changes?



 On Friday, 2 November 2012 09:09:03 UTC-5, Neil wrote:

 Can't see any potential conflicts. I have the problem for both 
 track_changes(True) and track_changes(False). When I import from shell:

 [aicbt@web331 web2py2.2.1]$ python web2py.py -S init
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2012
 Version 2.2.1 (2012-10-21 16:57:04) stable
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 MySQL(MySQLdb), PostgreSQL(psycopg2), PostgreSQL(pg8000), IMAP(imaplib)
 WARNING:web2py:import IPython error; use default python shell
 Python 2.7.3 (default, May 18 2012, 14:51:16)
 [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
 Type help, copyright, credits or license for more information.
 (InteractiveConsole)
  import matplotlib.pylab
 Traceback (most recent call last):
   File console, line 1, in module
   File 
 /home/aicbt/webapps/alternate_config/web2py2.2.1/gluon/custom_import.py, 
 line 77, in custom_importer
 raise ImportError, 'Cannot import module %s' % str(e)
 ImportError: Cannot import module 'matplotlib'

 This shell command works with web2py version 2.1. Also, import 
 matplotlib (without the pylab) works fine for 2.2.1.

 On Friday, November 2, 2012 1:22:03 PM UTC, Massimo Di Pierro wrote:

 Do you have anything in your app/modules/*  that may conflict? Did you 
 set track_changes(True) or not? If you do web2py.py -S yourapp can you 
 import form the web2py shell?

 On Friday, 2 November 2012 02:18:47 UTC-5, Neil wrote:

 A little more info:

 - On linux (works fine on Windows)
 - matplotlib is an egg in the lib directory
 - import matplotlib works, but import matplotlib.pylab doesn't