[web2py] Conditional IS_NOT_EMPTY

2010-12-02 Thread António Ramos
hello,
in a model i define a table tab1 and a field f1 that if some condition is
met should be not empty, otherwise could be empty

How do i code this situation at model level?



Best regards
António


[web2py] Re: Table names: plural or singular?

2010-12-02 Thread Kostas M
Ok, I understand that, but I am trying to implement a generic
controller (e.g. 'mylist') which takes as argument a table name (e.g.
'units') and returns its records. This is fine done, but I would like
to have also a header of the returned table, which is kind of a
'label' of the table, and it is different (and due to i18n) from the
name of the table.

I think  it would be nice and coherent if it was possible to set an
additonal attribute to a table with its 'label'. Something like:
db.units.label

So I propose maybe something like:
db.define_table('unit',label=Τ('physics units'),
Field(..),..  )

On Dec 2, 9:11 am, mdipierro  wrote:
> There is no "label" for thetablebecause the name of thetabledoes
> not show up in any generated forms except, as you say, in appadmin.
> But appadmin is not quite the same of Django admin. It is designed for
> the administrator, not for the users.
>
> Massimo
>
> On Dec 2, 12:48 am, Kostas M  wrote:
>
>


[web2py] Re: Problems with mail.send()

2010-12-02 Thread Bernardo
Hi Massimo,

I finally found where the problem is. It is something to do with the
SASL CRAM-MD5 authentification at server side. Just to debug purposes,
is there any way to use the 'sasl_method=PLAIN' when using
mail.send()?

thanks a lot,
Bernardo

On 1 dic, 23:38, Bernardo  wrote:
> All right. It seems to load the certificate now. But... still not
> sending the mail. Now web2py prints the following line:
>
> WARNING:web2py:Mail.send failure:(535, '5.7.8 Error: authentication
> failed: authentication failure')
>
> The mail.log in the mail server shows the following lines:
>
> Dec  1 22:35:11 mail postfix/smtpd[3398]: connect from MyIp
> Dec  1 22:35:11 mail postfix/smtpd[3398]: setting up TLS connection
> from MyIp
> Dec  1 22:35:12 mail postfix/smtpd[3398]: Anonymous TLS connection
> established from MyIp: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256
> bits)
> Dec  1 22:35:12 mail postfix/smtpd[3398]: warning: SASL authentication
> failure: no secret in database
> Dec  1 22:35:12 mail postfix/smtpd[3398]: warning: MyIp: SASL CRAM-MD5
> authentication failed: authentication failure
> Dec  1 22:35:12 mail postfix/smtpd[3398]: lost connection after AUTH
> from MyIp
> Dec  1 22:35:12 mail postfix/smtpd[3398]: disconnect from MyIp
>
> So, I guess that there must be a problem with the certificates?
>
> On 1 dic, 23:27, mdipierro  wrote:
>
>
>
>
>
>
>
> > You are using x509 signed emails. You set your certificates with:
>
> > > mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
> > > mail.settings.x509_sign_certfile = 'url_to_postfix.cert'
> > > mail.settings.x509_crypt_certfiles = 'url_to_postfix.cert'
>
> > but they should not be urls, they should be full paths to localfiles.
>
> > On Dec 1, 4:07 pm, Bernardo  wrote:
>
> > > More news Massimo,
>
> > > After following the execution of send method from Mail class, I found
> > > where it throws the exception that makes it return False. Those are my
> > > new mail settings:
> > > mail.settings.server = 'mydomain:25'  # your SMTP server
> > > mail.settings.sender = 'berna...@mydomain.com'         # your email
> > > mail.settings.login = 'berna...@mydomain:mypass'      # your
> > > credentials or None
> > > mail.settings.cipher_type = 'x509'
> > > mail.settings.sign = False
> > > mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
> > > mail.settings.x509_sign_certfile = 'url_to_postfix.cert'
> > > mail.settings.x509_crypt_certfiles = 'url_to_postfix.cert'
>
> > > The exception is thrown in line 502 of gluon/tools.py
> > >  500                     # make an encryption cert's stack
> > >  501                     for x in x509_crypt_certfiles:
> > >  502                         sk.push(X509.load_cert(x))
> > >  503                     s.set_x509_stack(sk)
>
> > > My question, what is the difference between
> > > mail.settings.x509_sign_certfile and
> > > mail.settings.x509_crypt_certfiles
>
> > > Does this info makes things clearer?
>
> > > thanks a lot again and kind regards,
> > > Bernardo
>
> > > On 1 dic, 20:49, Bernardo  wrote:
>
> > > > Ok Massimo,
>
> > > > I'll post if I find something.
>
> > > > thanks a lot!!
> > > > Bernardo
>
> > > > On 1 dic, 19:30, mdipierro  wrote:
>
> > > > > web2py is failing to connect and send the email. Something is wrong in
> > > > > the settings. To debug, you can try add something some print
> > > > > statements inside the class Mail send function. Sorry I do not have a
> > > > > better advice.
>
> > > > > On Dec 1, 12:27 pm, Bernardo Botella Corbí  wrote:
>
> > > > > > It prints
>
> > > > > > False
>
> > > > > > Bernardo
>
> > > > > > 2010/12/1 mdipierro 
>
> > > > > > > try from the shell
>
> > > > > > > python web2py.py -A yourapp -N -M
>
> > > > > > > print mail.send(to="@...", message="", subject="...")
>
> > > > > > > Massimo
>
> > > > > > > On Dec 1, 11:55 am, Bernardo  wrote:
> > > > > > > > Hi Massimo,
>
> > > > > > > > thanks for your reply. I connected without problems using 
> > > > > > > > telnet on
> > > > > > > > port 25
>
> > > > > > > > >telnet mydomain.com 25
>
> > > > > > > > Connected to mydomain.com.
> > > > > > > > Escape character is '^]'.
> > > > > > > > 220 mydomain.com ESMTP Postfix (Ubuntu)
> > > > > > > > EHLO mydomain.com
> > > > > > > > 250-mydomain.com
> > > > > > > > 250-PIPELINING
> > > > > > > > 250-SIZE 1024
> > > > > > > > 250-ETRN
> > > > > > > > 250-STARTTLS
> > > > > > > > 250-AUTH CRAM-MD5 DIGEST-MD5 LOGIN PLAIN
> > > > > > > > 250-ENHANCEDSTATUSCODES
> > > > > > > > 250-8BITMIME
> > > > > > > > 250 DSN
>
> > > > > > > > on the other hand, the username is the same I use to send an 
> > > > > > > > email
> > > > > > > > from thunderbird.
>
> > > > > > > > kind regards,
> > > > > > > > Bernardo
>
> > > > > > > > On 1 dic, 16:49, mdipierro  wrote:
>
> > > > > > > > > try telnet mail.mydomain.com 25 and see if it is accepting 
> > > > > > > > > remote
> > > > > > > > > connections (by defau postfix does not).
>
> > > > > > > > > Also I think
>
> > > > > > > > > mail.settin

Re: [web2py] Re: Scalability of web2py?

2010-12-02 Thread Branko Vukelic
How about we do something similar to what Blender foundation is doing
for Blender? Build an interesting web app every year as a community
project, and deploy it somewhere, get some publicity, have people try
it... While doing that, we could focus our efforts on improving web2py
etc.

The project will focus on a subset of features. Like "Let's do an app
that focuses on session handling." or "Let's do an app that focuses on
real-time communication", or "Let's do an app that deals with nodes.",
or "Let's do an app that runs on a mobile platform."

We could ask for sponsorship, and develop an app that a sponsor will
have vested interest in, etc.

On Thu, Dec 2, 2010 at 7:17 AM, pbreit  wrote:
> This is a good discussion as it is apparent that web2py is an
> incredible framework for rapidly building well-designed applications
> but it's not totally clear what happens in a high volume situation.
> But let's not forget that pretty much every framework experiences this
> exactly. While Massimo is with us and we hope he will be for a long
> time, let's really push web2py. That's the best way to identify and
> resolve issues.
>
> Many projects like this begin with one visionary and it is
> understandable to be concerned about the future of the project. But
> with valuable projects such as web2py, they figure out a way to
> endure. That's the beauty of open source.
>
> One thing that would help (me, at least) is spec'ing out a solid
> server configuration. It's so easy and inexpensive now to pick an
> environment on Amazon or Rackspace ($0-8/month)(for US people, at
> least). There are already some great docs and scripts to get web2py
> running on Ubuntu and Apache. It would be great to see some
> information on Nginx and Cherokee (on Ubuntu 10.04).



-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


[web2py] Server slow

2010-12-02 Thread Kenneth Lundström

Hello list,

need some help finding out why my server is so slow.

The server is with a Intel Celeron 2.66 GHz CPU, 4 GB of memory
CentOS 5.5 64-bit, Apache 2.2.3, MySQL 5.0.77, mod_wsgi, Web2py 1.89.5
The server is dedicated to web2py, there is three instances of web2py 
running.


I have migrate=False, sessions on disc.

If I try the following code

def testing():
customers = db(db.customer.id > 0).select()
return customers

takes 39 seconds, 5 times in a row, to return 979 rows.

If I put db.customer < 100 it takes 4,5 seconds to return 87 rows.

Is it just me or are this a bit long times?


Kenneth



Re: [web2py] Re: Scalability of web2py?

2010-12-02 Thread Tom Atkins
I'm assuming John Heenan's criticisms of web2py would apply equally to
Django?

Please correct me if I'm wrong.

Django can scale pretty well - here's a presentation showing how Disqus have
scaled their Django app to 250 million visitors a month and a peak of 17,000
requests per second to Django with Apache and mod_wsgi:

http://nosql.mypopescu.com/post/1409154668/disqus-scaling-the-worlds-largest-django-application

Presumably web2py could do the same?


Re: [web2py] Re: Scalability of web2py?

2010-12-02 Thread Tom Atkins
I should have said "John Heenan's criticisms of web2py *relating to
scalability*..."

On 2 December 2010 11:46, Tom Atkins  wrote:

> I'm assuming John Heenan's criticisms of web2py would apply equally to
> Django?
>
> Please correct me if I'm wrong.
>
> Django can scale pretty well - here's a presentation showing how Disqus
> have scaled their Django app to 250 million visitors a month and a peak of
> 17,000 requests per second to Django with Apache and mod_wsgi:
>
>
> http://nosql.mypopescu.com/post/1409154668/disqus-scaling-the-worlds-largest-django-application
>
> Presumably web2py could do the same?
>


Re: [web2py] Re: Scalability of web2py?

2010-12-02 Thread Kuba Kucharski
> requests per second to Django with Apache and mod_wsgi:
> http://nosql.mypopescu.com/post/1409154668/disqus-scaling-the-worlds-largest-django-application

exactly and already mentioned in this thread

>Real WORLD scalable implementations are VERY CUSTOM thing.

>like for example:
>http://python.mirocommunity.org/video/1886/djangocon-2010-scaling-the-wor


Re: [web2py] Re: Scalability of web2py?

2010-12-02 Thread Tom Atkins
Very sorry - I missed the link you already posted - will make sure to read
full thread in the future!

On 2 December 2010 12:23, Kuba Kucharski  wrote:

> > requests per second to Django with Apache and mod_wsgi:
> >
> http://nosql.mypopescu.com/post/1409154668/disqus-scaling-the-worlds-largest-django-application
>
> exactly and already mentioned in this thread
>
> >Real WORLD scalable implementations are VERY CUSTOM thing.
>
> >like for example:
> >http://python.mirocommunity.org/video/1886/djangocon-2010-scaling-the-wor
>


[web2py] Invalid function for logged in users

2010-12-02 Thread Rohan
Hi All,

I have a page which can be viewed by both visitors (not logged in) and
logged in users. Page works fine for visitors but when I visit page
after logging in, "invalid function" is shown on page and no error is
thrown.

I put few debug logs in controller and logs are getting printed. What
could be possible causes for this issue?

Regards
Rohan


[web2py] Geraldo Reports 4.0

2010-12-02 Thread Bruno Rocha
Is there someone using Geraldo Reports 4.0 with web2py?

http://www.geraldoreports.org/blog/releasing-04/

sometime ago someone created a tutorial
http://www.geraldoreports.org/docs/tutorial-web2py.html
but I guess this is outdated for the new version.

I am giving a try today, if someone has a working code.

-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: Server slow

2010-12-02 Thread Kenneth Lundström

Of course I forgot something,

python 2.6.5


Kenneth


Hello list,

need some help finding out why my server is so slow.

The server is with a Intel Celeron 2.66 GHz CPU, 4 GB of memory
CentOS 5.5 64-bit, Apache 2.2.3, MySQL 5.0.77, mod_wsgi, Web2py 1.89.5
The server is dedicated to web2py, there is three instances of web2py 
running.


I have migrate=False, sessions on disc.

If I try the following code

def testing():
customers = db(db.customer.id > 0).select()
return customers

takes 39 seconds, 5 times in a row, to return 979 rows.

If I put db.customer < 100 it takes 4,5 seconds to return 87 rows.

Is it just me or are this a bit long times?


Kenneth





[web2py] Re: Table names: plural or singular?

2010-12-02 Thread mdipierro
You should be able to do

db.unit.label=Τ('physics units')



On Dec 2, 4:18 am, Kostas M  wrote:
> Ok, I understand that, but I am trying to implement a generic
> controller (e.g. 'mylist') which takes as argument a table name (e.g.
> 'units') and returns its records. This is fine done, but I would like
> to have also a header of the returned table, which is kind of a
> 'label' of the table, and it is different (and due to i18n) from the
> name of the table.
>
> I think  it would be nice and coherent if it was possible to set an
> additonal attribute to a table with its 'label'. Something like:
> db.units.label
>
> So I propose maybe something like:
> db.define_table('unit',label=Τ('physics units'),
>     Field(..),..  )
>
> On Dec 2, 9:11 am, mdipierro  wrote:
>
> > There is no "label" for thetablebecause the name of thetabledoes
> > not show up in any generated forms except, as you say, in appadmin.
> > But appadmin is not quite the same of Django admin. It is designed for
> > the administrator, not for the users.
>
> > Massimo
>
> > On Dec 2, 12:48 am, Kostas M  wrote:
>
>


[web2py] Conditional represent

2010-12-02 Thread Johann Spies
I want the id of a record show an 'edit' (eg. crud.update) link when certain
users are logged in and 'show' (crud.read) when others are logged in.

How can that be done using lambda?

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


[web2py] Re: Problems with mail.send()

2010-12-02 Thread mdipierro
No but I can add that. I will take a look.

On Dec 2, 4:35 am, Bernardo  wrote:
> Hi Massimo,
>
> I finally found where the problem is. It is something to do with the
> SASL CRAM-MD5 authentification at server side. Just to debug purposes,
> is there any way to use the 'sasl_method=PLAIN' when using
> mail.send()?
>
> thanks a lot,
> Bernardo
>
> On 1 dic, 23:38, Bernardo  wrote:
>
> > All right. It seems to load the certificate now. But... still not
> > sending the mail. Now web2py prints the following line:
>
> > WARNING:web2py:Mail.send failure:(535, '5.7.8 Error: authentication
> > failed: authentication failure')
>
> > The mail.log in the mail server shows the following lines:
>
> > Dec  1 22:35:11 mail postfix/smtpd[3398]: connect from MyIp
> > Dec  1 22:35:11 mail postfix/smtpd[3398]: setting up TLS connection
> > from MyIp
> > Dec  1 22:35:12 mail postfix/smtpd[3398]: Anonymous TLS connection
> > established from MyIp: TLSv1 with cipher DHE-RSA-AES256-SHA (256/256
> > bits)
> > Dec  1 22:35:12 mail postfix/smtpd[3398]: warning: SASL authentication
> > failure: no secret in database
> > Dec  1 22:35:12 mail postfix/smtpd[3398]: warning: MyIp: SASL CRAM-MD5
> > authentication failed: authentication failure
> > Dec  1 22:35:12 mail postfix/smtpd[3398]: lost connection after AUTH
> > from MyIp
> > Dec  1 22:35:12 mail postfix/smtpd[3398]: disconnect from MyIp
>
> > So, I guess that there must be a problem with the certificates?
>
> > On 1 dic, 23:27, mdipierro  wrote:
>
> > > You are using x509 signed emails. You set your certificates with:
>
> > > > mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
> > > > mail.settings.x509_sign_certfile = 'url_to_postfix.cert'
> > > > mail.settings.x509_crypt_certfiles = 'url_to_postfix.cert'
>
> > > but they should not be urls, they should be full paths to localfiles.
>
> > > On Dec 1, 4:07 pm, Bernardo  wrote:
>
> > > > More news Massimo,
>
> > > > After following the execution of send method from Mail class, I found
> > > > where it throws the exception that makes it return False. Those are my
> > > > new mail settings:
> > > > mail.settings.server = 'mydomain:25'  # your SMTP server
> > > > mail.settings.sender = 'berna...@mydomain.com'         # your email
> > > > mail.settings.login = 'berna...@mydomain:mypass'      # your
> > > > credentials or None
> > > > mail.settings.cipher_type = 'x509'
> > > > mail.settings.sign = False
> > > > mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
> > > > mail.settings.x509_sign_certfile = 'url_to_postfix.cert'
> > > > mail.settings.x509_crypt_certfiles = 'url_to_postfix.cert'
>
> > > > The exception is thrown in line 502 of gluon/tools.py
> > > >  500                     # make an encryption cert's stack
> > > >  501                     for x in x509_crypt_certfiles:
> > > >  502                         sk.push(X509.load_cert(x))
> > > >  503                     s.set_x509_stack(sk)
>
> > > > My question, what is the difference between
> > > > mail.settings.x509_sign_certfile and
> > > > mail.settings.x509_crypt_certfiles
>
> > > > Does this info makes things clearer?
>
> > > > thanks a lot again and kind regards,
> > > > Bernardo
>
> > > > On 1 dic, 20:49, Bernardo  wrote:
>
> > > > > Ok Massimo,
>
> > > > > I'll post if I find something.
>
> > > > > thanks a lot!!
> > > > > Bernardo
>
> > > > > On 1 dic, 19:30, mdipierro  wrote:
>
> > > > > > web2py is failing to connect and send the email. Something is wrong 
> > > > > > in
> > > > > > the settings. To debug, you can try add something some print
> > > > > > statements inside the class Mail send function. Sorry I do not have 
> > > > > > a
> > > > > > better advice.
>
> > > > > > On Dec 1, 12:27 pm, Bernardo Botella Corbí  
> > > > > > wrote:
>
> > > > > > > It prints
>
> > > > > > > False
>
> > > > > > > Bernardo
>
> > > > > > > 2010/12/1 mdipierro 
>
> > > > > > > > try from the shell
>
> > > > > > > > python web2py.py -A yourapp -N -M
>
> > > > > > > > print mail.send(to="@...", message="", subject="...")
>
> > > > > > > > Massimo
>
> > > > > > > > On Dec 1, 11:55 am, Bernardo  wrote:
> > > > > > > > > Hi Massimo,
>
> > > > > > > > > thanks for your reply. I connected without problems using 
> > > > > > > > > telnet on
> > > > > > > > > port 25
>
> > > > > > > > > >telnet mydomain.com 25
>
> > > > > > > > > Connected to mydomain.com.
> > > > > > > > > Escape character is '^]'.
> > > > > > > > > 220 mydomain.com ESMTP Postfix (Ubuntu)
> > > > > > > > > EHLO mydomain.com
> > > > > > > > > 250-mydomain.com
> > > > > > > > > 250-PIPELINING
> > > > > > > > > 250-SIZE 1024
> > > > > > > > > 250-ETRN
> > > > > > > > > 250-STARTTLS
> > > > > > > > > 250-AUTH CRAM-MD5 DIGEST-MD5 LOGIN PLAIN
> > > > > > > > > 250-ENHANCEDSTATUSCODES
> > > > > > > > > 250-8BITMIME
> > > > > > > > > 250 DSN
>
> > > > > > > > > on the other hand, the username is the same I use to send an 
> > > > > > > > > email
> > > > > > > > > from thunderbird.
>
> > > > > > > > > kind reg

[web2py] Re: Scalability of web2py?

2010-12-02 Thread mdipierro
I thought experts4solutions.com would help with that.

On Dec 2, 5:07 am, Branko Vukelic  wrote:
> How about we do something similar to what Blender foundation is doing
> for Blender? Build an interesting web app every year as a community
> project, and deploy it somewhere, get some publicity, have people try
> it... While doing that, we could focus our efforts on improving web2py
> etc.
>
> The project will focus on a subset of features. Like "Let's do an app
> that focuses on session handling." or "Let's do an app that focuses on
> real-time communication", or "Let's do an app that deals with nodes.",
> or "Let's do an app that runs on a mobile platform."
>
> We could ask for sponsorship, and develop an app that a sponsor will
> have vested interest in, etc.
>
>
>
> On Thu, Dec 2, 2010 at 7:17 AM, pbreit  wrote:
> > This is a good discussion as it is apparent that web2py is an
> > incredible framework for rapidly building well-designed applications
> > but it's not totally clear what happens in a high volume situation.
> > But let's not forget that pretty much every framework experiences this
> > exactly. While Massimo is with us and we hope he will be for a long
> > time, let's really push web2py. That's the best way to identify and
> > resolve issues.
>
> > Many projects like this begin with one visionary and it is
> > understandable to be concerned about the future of the project. But
> > with valuable projects such as web2py, they figure out a way to
> > endure. That's the beauty of open source.
>
> > One thing that would help (me, at least) is spec'ing out a solid
> > server configuration. It's so easy and inexpensive now to pick an
> > environment on Amazon or Rackspace ($0-8/month)(for US people, at
> > least). There are already some great docs and scripts to get web2py
> > running on Ubuntu and Apache. It would be great to see some
> > information on Nginx and Cherokee (on Ubuntu 10.04).
>
> --
> Branko Vukelić
>
> bg.bra...@gmail.com
> stu...@brankovukelic.com
>
> Check out my blog:http://www.brankovukelic.com/
> Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> Registered Linux user #438078 (http://counter.li.org/)
> I hang out on identi.ca:http://identi.ca/foxbunny
>
> Gimp Brushmakers Guildhttp://bit.ly/gbg-group


[web2py] Re: Conditional represent

2010-12-02 Thread David Marko
You can at least do in your model file:

if user=='edit': # or your condition
   db.table.field.represent=
else:
   db.table.field.represent=

David

On 2 pro, 15:14, Johann Spies  wrote:
> I want the id of a record show an 'edit' (eg. crud.update) link when certain
> users are logged in and 'show' (crud.read) when others are logged in.
>
> How can that be done using lambda?
>
> Regards
> Johann
> --
>  May grace and peace be yours in abundance through the full knowledge of God
> and of Jesus our Lord!  His divine power has given us everything we need for
> life and godliness through the full knowledge of the one who called us by
> his own glory and excellence.
>                                                     2 Pet. 1:2b,3a


[web2py] Re: Server slow

2010-12-02 Thread mdipierro
Please tell us more about the setup. Are the three instances behind
running on the same server? why three? What do they do?

This is not normal but I suspect the problem is with database.

Did you set DAL(...,pool_size=10)?


On Dec 2, 5:13 am, Kenneth Lundström 
wrote:
> Hello list,
>
> need some help finding out why my server is so slow.
>
> The server is with a Intel Celeron 2.66 GHz CPU, 4 GB of memory
> CentOS 5.5 64-bit, Apache 2.2.3, MySQL 5.0.77, mod_wsgi, Web2py 1.89.5
> The server is dedicated to web2py, there is three instances of web2py
> running.
>
> I have migrate=False, sessions on disc.
>
> If I try the following code
>
> def testing():
>      customers = db(db.customer.id > 0).select()
>      return customers
>
> takes 39 seconds, 5 times in a row, to return 979 rows.
>
> If I put db.customer < 100 it takes 4,5 seconds to return 87 rows.
>
> Is it just me or are this a bit long times?
>
> Kenneth


Re: [web2py] Re: Scalability of web2py?

2010-12-02 Thread Branko Vukelic
On Thu, Dec 2, 2010 at 3:18 PM, mdipierro  wrote:
> I thought experts4solutions.com would help with that.

Well, it hasn't proposed any projects yet, no? What I had in mind is
something along the lines of:

"Ok, so Company XXX has a product that does A, B, and C. The goal of
this project is to do A, B and C, and maybe do C a bit differently, by
July next year."

Then you could look for a sponsor that would possibly use the product
later on, and you allow them exclusive access to WIP code, you give
them access to bug tracker, pre-release code, etc, maybe a special
exclusive non-GPL license for the code (the finished product is
released under GPL, but company, say, keeps the right to close-source
its modifications, etc). That way, you get access to money, and people
who have an interest in keeping the project alive on longer term.

It's a bit different than the classic investment.


-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


Re: [web2py] Re: Server slow

2010-12-02 Thread Kenneth Lundström
> Please tell us more about the setup. Are the three instances behind 
running on the same server?


Yes.

> why three? What do they do?

One is production, one is testing and last one is development. I had two 
instances running on a virtual server before and it worked fine.


> This is not normal but I suspect the problem is with database.
> Did you set DAL(...,pool_size=10)?

No, but I tried but no change.

If I try to select more rows:
def testing():
orders = db(db.orders.id > 0).select()
return orders

It takes 80 seconds to return 1608 rows.

If I change the return to return len(troops) it only takes 1,5 seconds.

I have no view defined, just trying out the database.


Kenneth




On Dec 2, 5:13 am, Kenneth Lundström
wrote:

Hello list,

need some help finding out why my server is so slow.

The server is with a Intel Celeron 2.66 GHz CPU, 4 GB of memory
CentOS 5.5 64-bit, Apache 2.2.3, MySQL 5.0.77, mod_wsgi, Web2py 1.89.5
The server is dedicated to web2py, there is three instances of web2py
running.

I have migrate=False, sessions on disc.

If I try the following code

def testing():
  customers = db(db.customer.id>  0).select()
  return customers

takes 39 seconds, 5 times in a row, to return 979 rows.

If I put db.customer<  100 it takes 4,5 seconds to return 87 rows.

Is it just me or are this a bit long times?

Kenneth




[web2py] Re: how do get "me" to imporsonate a generic user?

2010-12-02 Thread mart
interesting... the risk for me is just about a non-issue so it didn't
occur to me... this is for a web app living inside a corporate network
where the same resources could be had by other means. the
"impersonate" feature would be very efficient and convenient in this
case, would there be another to achieve the same thing without posing
the security risk? perhaps something like "while on THIS page, your
login credentials are replaced with those of the "generic" user"? Like
perhaps a "masking" feature? In this case, the onus would be (like in
any other situation) up to the web site owner/admin to make sure users
could only wear a specific and defined user's "mask" and that level
permission met the required level?

thanks,
Mart :)



On Dec 1, 11:34 pm, guruyaya  wrote:
> Ummm... you know that it's an opening for xss... right?
>
> It's not a big deal if everything else is done right in the website,
> but I can force an admin to impersonate someone else, by creating an
> image in my website, with src that 
> goes:http://.../app/default/user/impersonate/{id}
> You should really move this to post.
>
> On Dec 1, 2:47 am, mdipierro  wrote:
>
> >http://.../app/default/user/impersonate/{id}
>
> > will do this for you but you need to have permission to "impersonate".
> > Look at the docstring.
>
> > Massimo
>
> > On Nov 30, 2:43 pm, mart  wrote:
>
> > > Hi,
>
> > > I would like to make use of the following snippet (something I have
> > > here often enough)
>
> > > * in controller
> > > db.someTable.user==me)).select()
>
> > > * in db.py
> > > if auth.is_logged_in():
> > >    me=auth.user.id
> > > else:
> > >    me=None
>
> > > How do I turn this into something like
>
> > > if auth.is_logged_in():
> > >     genericUser=auth.user.id
>
> > > while the user is visiting on THIS page, they can as an option, assume
> > > a generic user's ID to view his stuff (file system resources) but with
> > > stricter permission (like view and download, but not change or delete?
>
> > > Thanks,
>
> > > Mart :)
>
>


[web2py] Re: plugin_wiki problems

2010-12-02 Thread blackthorne
Sorry to rehash this topic. It's that important to me.

What I really want is the plugin_wiki functionality but without
compromising the MVC way of making things with web2py. I wanted to be
able to create some pages with the plugin_wiki in a way that allowed
me to plug a normal controller and a specific view into it.

Currently, the closest thing I found to it is to use the load_url
widget and I can only define generic views.

Thank you,
Best regards

On Nov 30, 11:50 pm, blackthorne  wrote:
> hi
>
> 1.
> with the table new like this:
> db.define_table('new',
>         SQLField('photo_id', 'string'),
>         SQLField('name', 'string', notnull=True, length=16,
> requires=IS_NOT_EMPTY()),
>         SQLField('created', 'datetime',
> notnull=True,default=datetime.datetime.now(),requires=IS_DATETIME()),
>         SQLField('created_by', 'string'),
>         SQLField('tag', 'string'),
>         SQLField('link', 'string', length=80, default=None,
> requires=IS_URL()),
>         SQLField('type', 'string', notnull=True, length=16, default=types[0],
> requires=IS_IN_SET(types)),
>         SQLField('slug', 'string', length=32, default=''),
>         SQLField('description', 'text', notnull=True,length=64,
> requires=IS_NOT_EMPTY())
> )
>
> Using plugin_wiki, I can't use the "read" widget. Other widgets like
> jqgrid work fine.
>
> 2. How can I access my app model from the plugin_wiki?
>
> 3. how should I map a controller to a plugin_wiki page?
>
> Thank you
> Best regards


[web2py] Help requested with form redirect

2010-12-02 Thread Johann Spies
Maybe I am just tired now.  I am struggling to find the mistake and will
appreciate some help please.

I want to select an ID from one table and use that ID to show the full
record from one table and related records from another table.

Two problems:

1.  If I use {{=form}} for the first form in ' show_fipil01' in the view I
get two identical fields/labels on the screen with one submit button.  I
could 'solve' this problem using a custom form in the view.

2. When I select an id, no redirect takes place and the debugging line
(response.flash=repr(form.errors))  flash 'Storage {}'
I have also tried the redirect with
 redirect(URL(r=request, f='show_fpipl01_data',vars=request_vars))  with
the same result.

My controllers:


def show_fpipl01_data():
   id = request.vars.id
   form = crud.read('fpipl01',id)
   data = SQLTABLE(db((db.fpipl01_data.form_id == id) &
  (db.teacher.id == db.fpipl01_data.teacher) &
  (db.school.id == db.fpipl01_data.school)).select(
db.fpipl01_data.form_id,

db.teacher.surname,

db.teacher.name, db.school.name,

db.fpipl01_data.grade_taught),
   headers = {'fpipl01_data.form_id' : 'Form ID',
'teacher.surname' : 'Teacher surname',
  'teacher.name' : 'Teacher name', '
school.name' : 'School',
  'fpipl01_data.grade_taught' : 'Grade
taught'},
   truncate = 25)


   message = 'FP/IP Literacy and English: Teacher training attendance
register (FPIPL01)'
   return dict(form=form,data = data, message = message)

def show_fpipl01():
   tabel = request.vars.tabel
   tb = tabel.lower()
   if auth.user_id in [21,22]: # Johann Spies (22) or ERA (21)
  rdata = db((db.service_provider.id == db[tb].service_provider)
 ).select(db[tb].id,
  db.service_provider.name,
  db[tb].date,db.fpipl01.trainer,
  db[tb].focus)


   else:
  rdata = db((db[tb].created_by==auth.user_id) &
 (db.service_provider.id == db[tb].service_provider)
 ).select(db[tb].id,
  db.service_provider.name,
  db[tb].date,db.fpipl01.trainer,
  db[tb].focus)

   ids = []
   for row in rdata:
  ids.append( row['fpipl01']['id'])

   data = SQLTABLE(rdata,
   headers = {'fpipl01.id' : 'ID', '
service_provider.name' : 'Service Provider',
  'fpipl01.date': 'Date', 'fpipl01.trainer':
'Trainer',
  'fpipl01.focus': 'Focus of training'},
   truncate = 50
   )
   form = SQLFORM.factory(Field('id', requires = IS_IN_SET(ids),
   label = "Which event (number)?")
 )
   if form.accepts(request.vars, session):
  redirect(URL(r=request, f='show_fpipl01_data',vars=form_vars))
   else:
  response.flash=repr(form.errors)

   return dict(data=data,tabel=tabel,form=form)

Regards
Johann

-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


Re: [web2py] Re: Conditional represent

2010-12-02 Thread Johann Spies
On 2 December 2010 16:23, David Marko  wrote:

> You can at least do in your model file:
>
> if user=='edit': # or your condition
>   db.table.field.represent=
> else:
>   db.table.field.represent=
>
>
Thanks.  It has clearly not been my best day :)

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


[web2py] Re: Table names: plural or singular?

2010-12-02 Thread Kostas M
Thanks!

Sometimes I still forget the flexibility offered by Python..

On 2 Δεκ, 16:12, mdipierro  wrote:
> You should be able to do
>
> db.unit.label=Τ('physics units')
>

>
> > I think  it would be nice and coherent if it was possible to set an
> > additonal attribute to atablewith its 'label'. Something like:
> > db.units.label
>
> > So I propose maybe something like:
> > db.define_table('unit',label=Τ('physics units'),
> >     Field(..),..  )
>
> > On Dec 2, 9:11 am, mdipierro  wrote:
>
> > > There is no "label" for thetablebecause the name of thetabledoes
> > > not show up in any generated forms except, as you say, in appadmin.
> > > But appadmin is not quite the same of Django admin. It is designed for
> > > the administrator, not for the users.
>
> > > Massimo
>
> > > On Dec 2, 12:48 am, Kostas M  wrote:
>
>


[web2py] NicEdit + upload + GAE

2010-12-02 Thread Emceha
Hi,

Does any of you have an experience with such combination? I was
wondering about how easy it would be to implement such option like
uploading using inline editor with GAE blob for image storage.

Thanks for any hint's links to blog's or ideas.

Marcin


Re: [web2py] Re: Scalability of web2py?

2010-12-02 Thread Michele Comitini
@John

I think the best argument to end this discussion, is that someone,
possibly you, write a simple
and sane example that brings down and locks web2py, so we will come
over it and there will be no excuse to fix.

mic


On Thu, Dec 2, 2010 at 3:18 PM, mdipierro  wrote:
> I thought experts4solutions.com would help with that.


Re: [web2py] Re: Server slow

2010-12-02 Thread Michele Comitini
Kenneth,

When you test is that the only active connection to the db?


2010/12/2 Kenneth Lundström :
>> Please tell us more about the setup. Are the three instances behind
>> running on the same server?
>
> Yes.
>
>> why three? What do they do?
>
> One is production, one is testing and last one is development. I had two
> instances running on a virtual server before and it worked fine.
>
>> This is not normal but I suspect the problem is with database.
>> Did you set DAL(...,pool_size=10)?
>
> No, but I tried but no change.
>
> If I try to select more rows:
> def testing():
>    orders = db(db.orders.id > 0).select()
>    return orders
>
> It takes 80 seconds to return 1608 rows.
>
> If I change the return to return len(troops) it only takes 1,5 seconds.
>
> I have no view defined, just trying out the database.
>
>
> Kenneth
>
>
>>
>> On Dec 2, 5:13 am, Kenneth Lundström
>> wrote:
>>>
>>> Hello list,
>>>
>>> need some help finding out why my server is so slow.
>>>
>>> The server is with a Intel Celeron 2.66 GHz CPU, 4 GB of memory
>>> CentOS 5.5 64-bit, Apache 2.2.3, MySQL 5.0.77, mod_wsgi, Web2py 1.89.5
>>> The server is dedicated to web2py, there is three instances of web2py
>>> running.
>>>
>>> I have migrate=False, sessions on disc.
>>>
>>> If I try the following code
>>>
>>> def testing():
>>>      customers = db(db.customer.id>  0).select()
>>>      return customers
>>>
>>> takes 39 seconds, 5 times in a row, to return 979 rows.
>>>
>>> If I put db.customer<  100 it takes 4,5 seconds to return 87 rows.
>>>
>>> Is it just me or are this a bit long times?
>>>
>>> Kenneth
>
>


[web2py] disable insertion for crud.create/update on DEMO_MODE

2010-12-02 Thread selecta
I want to create a demo mode for my application where everything
should look like it works nomally but the actual insertion of data
should be prevented. Is it possible to do that if I use crud.create/
update?? Or should I replace all forms with form_factory forms?


[web2py] Re: disable insertion for crud.create/update on DEMO_MODE

2010-12-02 Thread mdipierro
I could easily add this feature but should it be done only for crud?
Perhaps the demo mode should be done at the dal layer.

Massimo

On Dec 2, 12:37 pm, selecta  wrote:
> I want to create a demo mode for my application where everything
> should look like it works nomally but the actual insertion of data
> should be prevented. Is it possible to do that if I use crud.create/
> update?? Or should I replace all forms with form_factory forms?


[web2py] Re: how do get "me" to imporsonate a generic user?

2010-12-02 Thread mdipierro
The security risk is not the existance of the function but the way the
parameters are passed to the function.

I changed it in trunk, please give it a try and tell me what you think
before we make it into stable.

Massimo

On Dec 2, 9:19 am, mart  wrote:
> interesting... the risk for me is just about a non-issue so it didn't
> occur to me... this is for a web app living inside a corporate network
> where the same resources could be had by other means. the
> "impersonate" feature would be very efficient and convenient in this
> case, would there be another to achieve the same thing without posing
> the security risk? perhaps something like "while on THIS page, your
> login credentials are replaced with those of the "generic" user"? Like
> perhaps a "masking" feature? In this case, the onus would be (like in
> any other situation) up to the web site owner/admin to make sure users
> could only wear a specific and defined user's "mask" and that level
> permission met the required level?
>
> thanks,
> Mart :)
>
> On Dec 1, 11:34 pm, guruyaya  wrote:
>
> > Ummm... you know that it's an opening for xss... right?
>
> > It's not a big deal if everything else is done right in the website,
> > but I can force an admin to impersonate someone else, by creating an
> > image in my website, with src that 
> > goes:http://.../app/default/user/impersonate/{id}
> > You should really move this to post.
>
> > On Dec 1, 2:47 am, mdipierro  wrote:
>
> > >http://.../app/default/user/impersonate/{id}
>
> > > will do this for you but you need to have permission to "impersonate".
> > > Look at the docstring.
>
> > > Massimo
>
> > > On Nov 30, 2:43 pm, mart  wrote:
>
> > > > Hi,
>
> > > > I would like to make use of the following snippet (something I have
> > > > here often enough)
>
> > > > * in controller
> > > > db.someTable.user==me)).select()
>
> > > > * in db.py
> > > > if auth.is_logged_in():
> > > >    me=auth.user.id
> > > > else:
> > > >    me=None
>
> > > > How do I turn this into something like
>
> > > > if auth.is_logged_in():
> > > >     genericUser=auth.user.id
>
> > > > while the user is visiting on THIS page, they can as an option, assume
> > > > a generic user's ID to view his stuff (file system resources) but with
> > > > stricter permission (like view and download, but not change or delete?
>
> > > > Thanks,
>
> > > > Mart :)
>
>


[web2py] Re: plugin_wiki problems

2010-12-02 Thread mdipierro
But you can do

def index():
return dict(comments=plugin_wiki.widget('comments'))

{{extend 'layout.html'}}
{{='bla '*100}}
{{=comments}}

what is wrong with this?

On Dec 2, 9:27 am, blackthorne  wrote:
> Sorry to rehash this topic. It's that important to me.
>
> What I really want is the plugin_wiki functionality but without
> compromising the MVC way of making things with web2py. I wanted to be
> able to create some pages with the plugin_wiki in a way that allowed
> me to plug a normal controller and a specific view into it.
>
> Currently, the closest thing I found to it is to use the load_url
> widget and I can only define generic views.
>
> Thank you,
> Best regards
>
> On Nov 30, 11:50 pm, blackthorne  wrote:
>
> > hi
>
> > 1.
> > with the table new like this:
> > db.define_table('new',
> >         SQLField('photo_id', 'string'),
> >         SQLField('name', 'string', notnull=True, length=16,
> > requires=IS_NOT_EMPTY()),
> >         SQLField('created', 'datetime',
> > notnull=True,default=datetime.datetime.now(),requires=IS_DATETIME()),
> >         SQLField('created_by', 'string'),
> >         SQLField('tag', 'string'),
> >         SQLField('link', 'string', length=80, default=None,
> > requires=IS_URL()),
> >         SQLField('type', 'string', notnull=True, length=16, 
> > default=types[0],
> > requires=IS_IN_SET(types)),
> >         SQLField('slug', 'string', length=32, default=''),
> >         SQLField('description', 'text', notnull=True,length=64,
> > requires=IS_NOT_EMPTY())
> > )
>
> > Using plugin_wiki, I can't use the "read" widget. Other widgets like
> > jqgrid work fine.
>
> > 2. How can I access my app model from the plugin_wiki?
>
> > 3. how should I map a controller to a plugin_wiki page?
>
> > Thank you
> > Best regards
>
>


[web2py] Re: Help requested with form redirect

2010-12-02 Thread mdipierro
You have two forms both called form (the second overwrites the first
one) and you return only one of the

return dict(...,form=form)

You should call them form1 and form2 and return both.

On Dec 2, 9:52 am, Johann Spies  wrote:
> Maybe I am just tired now.  I am struggling to find the mistake and will
> appreciate some help please.
>
> I want to select an ID from one table and use that ID to show the full
> record from one table and related records from another table.
>
> Two problems:
>
> 1.  If I use {{=form}} for the first form in ' show_fipil01' in the view I
> get two identical fields/labels on the screen with one submit button.  I
> could 'solve' this problem using a custom form in the view.
>
> 2. When I select an id, no redirect takes place and the debugging line
> (response.flash=repr(form.errors))  flash 'Storage {}'
>     I have also tried the redirect with
>      redirect(URL(r=request, f='show_fpipl01_data',vars=request_vars))  with
> the same result.
>
> My controllers:
>
> def show_fpipl01_data():
>        id = request.vars.id
>        form = crud.read('fpipl01',id)
>        data = SQLTABLE(db((db.fpipl01_data.form_id == id) &
>                           (db.teacher.id == db.fpipl01_data.teacher) &
>                           (db.school.id == db.fpipl01_data.school)).select(
> db.fpipl01_data.form_id,
>
> db.teacher.surname,
>
> db.teacher.name, db.school.name,
>
> db.fpipl01_data.grade_taught),
>                        headers = {'fpipl01_data.form_id' : 'Form ID',
> 'teacher.surname' : 'Teacher surname',
>                                   'teacher.name' : 'Teacher name', '
> school.name' : 'School',
>                                   'fpipl01_data.grade_taught' : 'Grade
> taught'},
>                        truncate = 25)
>
>        message = 'FP/IP Literacy and English: Teacher training attendance
> register (FPIPL01)'
>        return dict(form=form,data = data, message = message)
>
> def show_fpipl01():
>        tabel = request.vars.tabel
>        tb = tabel.lower()
>        if auth.user_id in [21,22]: # Johann Spies (22) or ERA (21)
>               rdata = db((db.service_provider.id == db[tb].service_provider)
>                          ).select(db[tb].id,
>                                   db.service_provider.name,
>                                   db[tb].date,db.fpipl01.trainer,
>                                   db[tb].focus)
>
>        else:
>               rdata = db((db[tb].created_by==auth.user_id) &
>                          (db.service_provider.id == db[tb].service_provider)
>                          ).select(db[tb].id,
>                                   db.service_provider.name,
>                                   db[tb].date,db.fpipl01.trainer,
>                                   db[tb].focus)
>
>        ids = []
>        for row in rdata:
>               ids.append( row['fpipl01']['id'])
>
>        data = SQLTABLE(rdata,
>                        headers = {'fpipl01.id' : 'ID', '
> service_provider.name' : 'Service Provider',
>                                   'fpipl01.date': 'Date', 'fpipl01.trainer':
> 'Trainer',
>                                   'fpipl01.focus': 'Focus of training'},
>                        truncate = 50
>                        )
>        form = SQLFORM.factory(Field('id', requires = IS_IN_SET(ids),
>                                    label = "Which event (number)?")
>                              )
>        if form.accepts(request.vars, session):
>               redirect(URL(r=request, f='show_fpipl01_data',vars=form_vars))
>        else:
>               response.flash=repr(form.errors)
>
>        return dict(data=data,tabel=tabel,form=form)
>
> Regards
> Johann
>
> --
>  May grace and peace be yours in abundance through the full knowledge of God
> and of Jesus our Lord!  His divine power has given us everything we need for
> life and godliness through the full knowledge of the one who called us by
> his own glory and excellence.
>                                                     2 Pet. 1:2b,3a


[web2py] built-in functionality to show tree-like html tables (via sqltable)?

2010-12-02 Thread Carlos
Hi,

Taking the example of the auth_*  model (users, groups, memberships,
permissions), is there built-in functionality to show this kind of
inter-related data (including many-to-many) via SQLTABLE, or should I
just do it from scratch with the helpers?.

Something like the following per each user to show in each row:

- 1 user data
- N groups (internally via memberships) for each user
- N permissions for each group

All in a nice formatted table, kind of like in tree format (e.g.
without repeating the user data for every group the user belongs too).

The auth_* model is just the example, I really need it for other
similar cases.

Thanks,

   Carlos


[web2py] help with view of rows

2010-12-02 Thread mmartinez
Good afternoon, everyone.

My query is:

I query the database controllers/default.py, is specifically

left=db.clientes.on(db.accountcode.id_clientes==db.clientes.id)
   rows=db().select(db.accountcode.ani, db.clientes.rsocial,
left=left, orderby=db.clientes.rsocial)

If I

print rows

the result is the following:

accountcode.ani, clientes.rsocial
0,   Boomerangip S.A.
1002,  Boomerangip S.A.
1001,  Boomerangip S.A.
122073,  Centro de Telecomunicaciones Ricardo Gonzalez
EIRL
122074,  Centro de Telecomunicaciones Ricardo Gonzalez
EIRL


but my problem is when I do in view/default/lineas.html

{{=rows}}

record here shows me this way

accountcode.ani  clientes.rsocial
   0   Boomerangip S.A.
1002 Boomerangip S.A.
1001 Boomerangip S.A.
   122073  Centro de Tel...
   122074  Centro de Tel...


What I need is to show me full information of the column
clientes.rsocial

So my question would be how to solve this problem?

I hope I can help, of course thank you very much.


Re: [web2py] help with view of rows

2010-12-02 Thread Richard Vézina
truncate=BIGNUMBER

BIGNUMBER = the max string length of your longer string...

Richard

On Thu, Dec 2, 2010 at 3:20 PM, mmartinez  wrote:

> Good afternoon, everyone.
>
> My query is:
>
> I query the database controllers/default.py, is specifically
>
> left=db.clientes.on(db.accountcode.id_clientes==db.clientes.id)
>   rows=db().select(db.accountcode.ani, db.clientes.rsocial,
> left=left, orderby=db.clientes.rsocial)
>
> If I
>
> print rows
>
> the result is the following:
>
> accountcode.ani, clientes.rsocial
> 0,   Boomerangip S.A.
> 1002,  Boomerangip S.A.
> 1001,  Boomerangip S.A.
> 122073,  Centro de Telecomunicaciones Ricardo Gonzalez
> EIRL
> 122074,  Centro de Telecomunicaciones Ricardo Gonzalez
> EIRL
>
>
> but my problem is when I do in view/default/lineas.html
>
> {{=rows}}
>
> record here shows me this way
>
> accountcode.ani  clientes.rsocial
>   0   Boomerangip S.A.
>1002 Boomerangip S.A.
>1001 Boomerangip S.A.
>   122073  Centro de Tel...
>   122074  Centro de Tel...
>
>
> What I need is to show me full information of the column
> clientes.rsocial
>
> So my question would be how to solve this problem?
>
> I hope I can help, of course thank you very much.
>


Re: [web2py] help with view of rows

2010-12-02 Thread Richard Vézina
table=SQLTABLE(rows,truncate=...)
return (table=table)

in view

{{=table}}

On Thu, Dec 2, 2010 at 3:24 PM, Richard Vézina
wrote:

> truncate=BIGNUMBER
>
> BIGNUMBER = the max string length of your longer string...
>
> Richard
>
>
> On Thu, Dec 2, 2010 at 3:20 PM, mmartinez  wrote:
>
>> Good afternoon, everyone.
>>
>> My query is:
>>
>> I query the database controllers/default.py, is specifically
>>
>> left=db.clientes.on(db.accountcode.id_clientes==db.clientes.id)
>>   rows=db().select(db.accountcode.ani, db.clientes.rsocial,
>> left=left, orderby=db.clientes.rsocial)
>>
>> If I
>>
>> print rows
>>
>> the result is the following:
>>
>> accountcode.ani, clientes.rsocial
>> 0,   Boomerangip S.A.
>> 1002,  Boomerangip S.A.
>> 1001,  Boomerangip S.A.
>> 122073,  Centro de Telecomunicaciones Ricardo Gonzalez
>> EIRL
>> 122074,  Centro de Telecomunicaciones Ricardo Gonzalez
>> EIRL
>>
>>
>> but my problem is when I do in view/default/lineas.html
>>
>> {{=rows}}
>>
>> record here shows me this way
>>
>> accountcode.ani  clientes.rsocial
>>   0   Boomerangip S.A.
>>1002 Boomerangip S.A.
>>1001 Boomerangip S.A.
>>   122073  Centro de Tel...
>>   122074  Centro de Tel...
>>
>>
>> What I need is to show me full information of the column
>> clientes.rsocial
>>
>> So my question would be how to solve this problem?
>>
>> I hope I can help, of course thank you very much.
>>
>
>


Re: [web2py] help with view of rows

2010-12-02 Thread Marcelo Martinez
I have worked placing
table = SQLTABLE (rows, truncate = number)

Now a new query

I can take a SQLTables to display the plugin data_tables




2010/12/2 Richard Vézina 

> table=SQLTABLE(rows,truncate=...)
> return (table=table)
>
> in view
>
> {{=table}}
>
>
> On Thu, Dec 2, 2010 at 3:24 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> truncate=BIGNUMBER
>>
>> BIGNUMBER = the max string length of your longer string...
>>
>> Richard
>>
>>
>> On Thu, Dec 2, 2010 at 3:20 PM, mmartinez  wrote:
>>
>>> Good afternoon, everyone.
>>>
>>> My query is:
>>>
>>> I query the database controllers/default.py, is specifically
>>>
>>> left=db.clientes.on(db.accountcode.id_clientes==db.clientes.id)
>>>   rows=db().select(db.accountcode.ani, db.clientes.rsocial,
>>> left=left, orderby=db.clientes.rsocial)
>>>
>>> If I
>>>
>>> print rows
>>>
>>> the result is the following:
>>>
>>> accountcode.ani, clientes.rsocial
>>> 0,   Boomerangip S.A.
>>> 1002,  Boomerangip S.A.
>>> 1001,  Boomerangip S.A.
>>> 122073,  Centro de Telecomunicaciones Ricardo Gonzalez
>>> EIRL
>>> 122074,  Centro de Telecomunicaciones Ricardo Gonzalez
>>> EIRL
>>>
>>>
>>> but my problem is when I do in view/default/lineas.html
>>>
>>> {{=rows}}
>>>
>>> record here shows me this way
>>>
>>> accountcode.ani  clientes.rsocial
>>>   0   Boomerangip S.A.
>>>1002 Boomerangip S.A.
>>>1001 Boomerangip S.A.
>>>   122073  Centro de Tel...
>>>   122074  Centro de Tel...
>>>
>>>
>>> What I need is to show me full information of the column
>>> clientes.rsocial
>>>
>>> So my question would be how to solve this problem?
>>>
>>> I hope I can help, of course thank you very much.
>>>
>>
>>
>


Re: [web2py] help with view of rows

2010-12-02 Thread Richard Vézina
?

I don't follow you.

Richard

On Thu, Dec 2, 2010 at 4:00 PM, Marcelo Martinez wrote:

> I have worked placing
> table = SQLTABLE (rows, truncate = number)
>
> Now a new query
>
> I can take a SQLTables to display the plugin data_tables
>
>
>
>
> 2010/12/2 Richard Vézina 
>
> table=SQLTABLE(rows,truncate=...)
>> return (table=table)
>>
>> in view
>>
>> {{=table}}
>>
>>
>> On Thu, Dec 2, 2010 at 3:24 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> truncate=BIGNUMBER
>>>
>>> BIGNUMBER = the max string length of your longer string...
>>>
>>> Richard
>>>
>>>
>>> On Thu, Dec 2, 2010 at 3:20 PM, mmartinez  wrote:
>>>
 Good afternoon, everyone.

 My query is:

 I query the database controllers/default.py, is specifically

 left=db.clientes.on(db.accountcode.id_clientes==db.clientes.id)
   rows=db().select(db.accountcode.ani, db.clientes.rsocial,
 left=left, orderby=db.clientes.rsocial)

 If I

 print rows

 the result is the following:

 accountcode.ani, clientes.rsocial
 0,   Boomerangip S.A.
 1002,  Boomerangip S.A.
 1001,  Boomerangip S.A.
 122073,  Centro de Telecomunicaciones Ricardo Gonzalez
 EIRL
 122074,  Centro de Telecomunicaciones Ricardo Gonzalez
 EIRL


 but my problem is when I do in view/default/lineas.html

 {{=rows}}

 record here shows me this way

 accountcode.ani  clientes.rsocial
   0   Boomerangip S.A.
1002 Boomerangip S.A.
1001 Boomerangip S.A.
   122073  Centro de Tel...
   122074  Centro de Tel...


 What I need is to show me full information of the column
 clientes.rsocial

 So my question would be how to solve this problem?

 I hope I can help, of course thank you very much.

>>>
>>>
>>
>


[web2py] Re: plugin_wiki problems

2010-12-02 Thread blackthorne
Thank you for your answer.

Oh, but I do want the wiki behaviour, not just a widget. I just want
the wiki behavior without throwing away the common web2py development
flow with my model, my controllers and possible specific views.

Consider this,
Let's say I make a request to .../whatever/mypage with possible
request.args to load a wiki page.

1) Couldn't I trap this request into a common controller (i.e.
controllers/mypage ) that could retrieve things from the database and
return them (i.e. items list) to a wiki page by wrapping things into
plugin_wiki/mypage so that I could edit it in a wiki style?

Inside the page body I could do things like:
``
{{for item in items:}}
{{=item.title}}
{{=item.body}}
{{pass}}
``:template

if there was no controller to handle mypage, it would load plugin_wiki/
mypage normally just as it would to any wiki page, with no extra
processing.

2) The same idea could be applied to Views.
if there was no specific view, the generic view would be called (i.e.
views/plugin_wiki/page.html ). if there was a file views/mypage.html,
it could be processed as a specific view. Again, all the plugin_wiki
advantages with no loss of functionality.

Other option for this could be 1) + the possibility to make in the
controller: response.view = my_view.html

3) All remaining the plugin_wiki behavior would remain untouched

Thank you
Best regards

On Dec 2, 7:27 pm, mdipierro  wrote:
> But you can do
>
> def index():
>     return dict(comments=plugin_wiki.widget('comments'))
>
> {{extend 'layout.html'}}
> {{='bla '*100}}
> {{=comments}}
>
> what is wrong with this?
>
> On Dec 2, 9:27 am, blackthorne  wrote:
>
>
>
> > Sorry to rehash this topic. It's that important to me.
>
> > What I really want is the plugin_wiki functionality but without
> > compromising the MVC way of making things with web2py. I wanted to be
> > able to create some pages with the plugin_wiki in a way that allowed
> > me to plug a normal controller and a specific view into it.
>
> > Currently, the closest thing I found to it is to use the load_url
> > widget and I can only define generic views.
>
> > Thank you,
> > Best regards
>
> > On Nov 30, 11:50 pm, blackthorne  wrote:
>
> > > hi
>
> > > 1.
> > > with the table new like this:
> > > db.define_table('new',
> > >         SQLField('photo_id', 'string'),
> > >         SQLField('name', 'string', notnull=True, length=16,
> > > requires=IS_NOT_EMPTY()),
> > >         SQLField('created', 'datetime',
> > > notnull=True,default=datetime.datetime.now(),requires=IS_DATETIME()),
> > >         SQLField('created_by', 'string'),
> > >         SQLField('tag', 'string'),
> > >         SQLField('link', 'string', length=80, default=None,
> > > requires=IS_URL()),
> > >         SQLField('type', 'string', notnull=True, length=16, 
> > > default=types[0],
> > > requires=IS_IN_SET(types)),
> > >         SQLField('slug', 'string', length=32, default=''),
> > >         SQLField('description', 'text', notnull=True,length=64,
> > > requires=IS_NOT_EMPTY())
> > > )
>
> > > Using plugin_wiki, I can't use the "read" widget. Other widgets like
> > > jqgrid work fine.
>
> > > 2. How can I access my app model from the plugin_wiki?
>
> > > 3. how should I map a controller to a plugin_wiki page?
>
> > > Thank you
> > > Best regards


[web2py] convert python list to javascript array

2010-12-02 Thread 1904
Hello,

i m totally new to web2py and im trying to use it with google maps api
and javascript to build a map.
So I got some longtiudes and latidues from a MySQL database.
The problem is that I cant convert the Python list [with the lat and
lng values] from the database into a javascript array which is needed.
I build the list with the values in a controller file and return it to
the view file.

Python list: coordinates((1,2) , (3,4) , (5,6))

I tried it on this way:

while(j<=len()) //len = length of coordinates
{
var coor[{{=x}}][0] = {{=coordinates[y][0]}};
var coor[{{=x}}][1] = {{=coordinates[y][1]}};
j++;
}

but it is not possible because Y doesnt raise... So the question is
how can I use JS variables and/or Python variables together?


Thanks for help


[web2py] Re: Anyone willing to help out with Paypal

2010-12-02 Thread howesc
Hi all,

sorry for the delay.  my paypal integration code can be viewed here:
http://web2pyslices.com/main/slices/take_slice/106

please let me know if you have problems with it.

thanks,

christian

On Nov 26, 8:23 am, Andrew Evans  wrote:
> hello
>
> I am interested in your code :D
>
> Let me know when you are able to pull it out :D


Re: [web2py] Re: Server slow

2010-12-02 Thread Kenneth Lundström

> When you test is that the only active connection to the db?

I tested it on an application running on the test instance. There could 
have been lite activity one production site.
But when I tested loading the same function five times in about 10 
minutes I allways 39 seconds to load the data.



Kenneth



2010/12/2 Kenneth Lundström:

Please tell us more about the setup. Are the three instances behind
running on the same server?

Yes.


why three? What do they do?

One is production, one is testing and last one is development. I had two
instances running on a virtual server before and it worked fine.


This is not normal but I suspect the problem is with database.
Did you set DAL(...,pool_size=10)?

No, but I tried but no change.

If I try to select more rows:
def testing():
orders = db(db.orders.id>  0).select()
return orders

It takes 80 seconds to return 1608 rows.

If I change the return to return len(troops) it only takes 1,5 seconds.

I have no view defined, just trying out the database.


Kenneth



On Dec 2, 5:13 am, Kenneth Lundström
wrote:

Hello list,

need some help finding out why my server is so slow.

The server is with a Intel Celeron 2.66 GHz CPU, 4 GB of memory
CentOS 5.5 64-bit, Apache 2.2.3, MySQL 5.0.77, mod_wsgi, Web2py 1.89.5
The server is dedicated to web2py, there is three instances of web2py
running.

I have migrate=False, sessions on disc.

If I try the following code

def testing():
  customers = db(db.customer.id>0).select()
  return customers

takes 39 seconds, 5 times in a row, to return 979 rows.

If I put db.customer<100 it takes 4,5 seconds to return 87 rows.

Is it just me or are this a bit long times?

Kenneth






[web2py] Re: Conditional IS_NOT_EMPTY

2010-12-02 Thread DenesL

You can always change requires on the fly.

def action(): # over simplified
  if request.vars.condition:
db.tab1.f1.requires=another_validator(...)
  form=...


On Dec 2, 4:57 am, António Ramos  wrote:
> hello,
> in a model i define a table tab1 and a field f1 that if some condition is
> met should be not empty, otherwise could be empty
>
> How do i code this situation at model level?
>
> Best regards
> António


[web2py] Error running Web2py admin app & non-SSL apps together with mod_wsgi

2010-12-02 Thread azarkowsky
Hi,

I'm running Web2py version 1.89.1 and attempting to set up a
production enviornment (Windows Server 2008) on our Intranet running
behind Apache with mod_wsgi & mod_auth_sspi (for grabbing the current
Windows username).   Since this is an Intranet application only, I'd
like to have access to both the admin site & my web2py application.

My goal is to be able to have 2 entry points:
App 1) http:/// - For normal users to access the
web2py app we built
App 2) https:///admin (SSL) - For developers to access the
web2py admin interface at https:///admin/default/site

With my current apache confirguation, when I first start apache I can
access https:///admin just fine, however if I then switch to
http:///, web2py issues the following ticket:

Traceback (most recent call last):
  File "C:\aproj\web2py\gluon\main.py", line 453, in wsgibase
session._try_store_on_disk(request, response)
  File "C:\aproj\web2py\gluon\globals.py", line 382, in
_try_store_on_disk
cPickle.dump(dict(self), response.session_file)
  File "C:/python\lib\copy_reg.py", line 74, in _reduce_ex
getstate = self.__getstate__
  File "C:\aproj\web2py\gluon\sql.py", line 740, in __getattr__
return dict.__getitem__(self,key)
KeyError: '__getstate__'

At this point I can revisit https:///admin and it comes up
fine just as it did before.  If I restart Apache and revese the order
(access non-SSL first), our custom app comes up just fine, but then
the admin app will exhibit the same behavior and issue a ticket.
Basically, once I start Apache I seem to have to stay on either SSL or
Non-SSL, but can't switch between both -- the second app to be
accessed with always issue a ticket.  Is it possible to use Apache
VirtualHosts to access both the admin site and non-admin site using
mod_wsgi or would I also need something like mod_rewrite or to handle
this via routes.py?  I'd like to avoid installing Web2py as a Windows
service just for the ability to access the admin site if possible.

Here are the relevant portions of my httpd.conf:
WSGIPythonHome "C:/python"

NameVirtualHost *:80

DocumentRoot "C:/aproj/web2py/applications"
ServerName server1


Order allow,deny
Deny from all



Order allow,deny
Allow from all

AuthName "Stadion Lunch Application"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIDomain hq.ft
SSPIOmitDomain On
SSPIOfferBasic Off
SSPIBasicPreferred Off
SSPIUsernameCase lower
SSPIPerRequestAuth On

Require group "HQ\IT"
#require valid-user





Order Allow,Deny
Allow from all
  

WSGIScriptAlias / "C:/aproj/web2py/wsgihandler.py"


NameVirtualHost *:443

DocumentRoot "C:/aproj/web2py/applications/admin"
ServerName server1admin


Order allow,deny
Deny from all



Order allow,deny
Allow from all

AuthName "Stadion Lunch Application"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIDomain hq.ft
SSPIOfferBasic Off
SSPIOmitDomain On
SSPIBasicPreferred Off
SSPIUsernameCase lower
SSPIPerRequestAuth On

Require group "HQ\IT"
#require valid-user




WSGIScriptAlias / "C:/aproj/web2py/wsgihandler.py"

SSLEngine On
SSLCertificateFile conf/server.crt
SSLCertificateKeyFile conf/server.key


Any help would greatly be appreciated!

Thanks,
Adam


RE: [web2py] convert python list to javascript array

2010-12-02 Thread Josh Jaques
Sounds like you're looking for response.json

def test():
coords = ((1,2), (3,4), (5,6))
return response.json(coords=coords)

Returns a javascript array formatted like: [[1, 2], [3, 4], [5, 6]]

Or you can use response.json(dict(coords=coords)) to get a javascript object: 
{"coords": [[1, 2], [3, 4], [5, 6]]}

Note that you also don't have to immediately return the result of 
response.json, you can save it and output it in the view, inside a 

[web2py] Re: Scalability of web2py?

2010-12-02 Thread John Heenan
Let us be blunt about this. Web2py is out there megalomaniacally
presenting itself as all things to all people at a web framework
level. As it is now, Web2py is a very impressive achievement.

At a purely technical level Web2py is superior to Django in a large
number of important aspects. But that is not the point. Leaving aside
the irritating Django fan-boys, Django does not present itself as all
things to all people. At the top level Django presents itself as a
commercially backed niche product suitable for simple content
presentation of small organisations (such as regional newspapers).

If we take a straight comparison with a completely different web
framework that presents itself as all things to all people. such as
DotNet, then web2py must accept there are issues for comparison that
go way beyond pet issues found in the narrow confines of the academic
or fan-boy environments.

Here are some simple comparison points.

1) Corporate backing independent of lead developers
2) Proven scalability around simple metrics
3) The 'largest' projects

DotNet has been around for ten years now and has very wide
penetration. Where is Web2py going to be in ten years and what will
its penetration be?

Frankly I cannot imagine someone with Massimo's talents as remaining
interested in Web2py, despite his deep involvement now in Web2py.
Massimo in a prior life was a talented high energy physicist, why
shouldn't he change again? Who knows, maybe a vice chancellor of the
University of Chicago trying to keep a lid on embarrassing student/
staff scandals or fraudulent research, or lobbying for grants?

I am not being unfair to Web2py.

With regard to Django and Disqus, 30% of about 100 servers (about 30
servers) just appear to run Apache + mod_wsgi. This presumably is
where Django lives. The other 70% of servers are for databases,
caching, load balancing and for other Python scripts. This information
comes from http://www.slideshare.net/zeeg/djangocon-2010-scaling-disqus.
Since we can expect a lot of the requests are for the same
information, we can expect caching is very important.

Disqus claims to be able to reach 17,000 requests for seconds or about
570 requests per second per Apache server. Suppose each request lasts
no longer than a generous 200ms on average then Apache needs to be
able to maintain about 114 requests at once.  Since Apache spawns or
maintains a thread for each request, this means that each server needs
to be able to maintain nearly 114 threads per server at once. I am not
impressed by this.

Consider that Lighttpd can handle 10,000 requests per second ON A
SINGLE SERVER using year 2000 technology.

John Heenan

On Dec 2, 9:46 pm, Tom Atkins  wrote:
> I'm assuming John Heenan's criticisms of web2py would apply equally to
> Django?
>
> Please correct me if I'm wrong.
>
> Django can scale pretty well - here's a presentation showing how Disqus have
> scaled their Django app to 250 million visitors a month and a peak of 17,000
> requests per second to Django with Apache and mod_wsgi:
>
> http://nosql.mypopescu.com/post/1409154668/disqus-scaling-the-worlds-...
>
> Presumably web2py could do the same?


[web2py] "I Just Need a Programmer"

2010-12-02 Thread mdipierro
http://www.cs.uni.edu/~wallingf/blog/archives/monthly/2010-12.html#e2010-12-01T15_45_40.htm


[web2py] Supporting user translations on GAE

2010-12-02 Thread Richard
I want to allow users to add languages and translate strings for my
app. The app is hosted on GAE so overriding the translation files is
not allowed.

What do you recommend? - override T() with my own helper that reads
from the database?


[web2py] Re: Error running Web2py admin app & non-SSL apps together with mod_wsgi

2010-12-02 Thread mdipierro
The problem seems to be in serializing the sessions and I suspect the
two virtual hosts confuse mod_wsgi about the web2py location.
Perhaps this is because they have different DocumentRoot and none of
them is what it should be. Try use the examples listed here:

http://web2py.com/book/default/chapter/11#mod_wsgi
http://web2py.com/book/default/chapter/11#mod_wsgi-and-SSL

On Dec 2, 4:38 pm, azarkowsky  wrote:
> Hi,
>
> I'm running Web2py version 1.89.1 and attempting to set up a
> production enviornment (Windows Server 2008) on our Intranet running
> behind Apache with mod_wsgi & mod_auth_sspi (for grabbing the current
> Windows username).   Since this is an Intranet application only, I'd
> like to have access to both the admin site & my web2py application.
>
> My goal is to be able to have 2 entry points:
> App 1) http:/// - For normal users to access the
> web2py app we built
> App 2) https:///admin (SSL) - For developers to access the
> web2py admin interface at https:///admin/default/site
>
> With my current apache confirguation, when I first start apache I can
> access https:///admin just fine, however if I then switch to
> http:///, web2py issues the following ticket:
>
> Traceback (most recent call last):
>   File "C:\aproj\web2py\gluon\main.py", line 453, in wsgibase
>     session._try_store_on_disk(request, response)
>   File "C:\aproj\web2py\gluon\globals.py", line 382, in
> _try_store_on_disk
>     cPickle.dump(dict(self), response.session_file)
>   File "C:/python\lib\copy_reg.py", line 74, in _reduce_ex
>     getstate = self.__getstate__
>   File "C:\aproj\web2py\gluon\sql.py", line 740, in __getattr__
>     return dict.__getitem__(self,key)
> KeyError: '__getstate__'
>
> At this point I can revisit https:///admin and it comes up
> fine just as it did before.  If I restart Apache and revese the order
> (access non-SSL first), our custom app comes up just fine, but then
> the admin app will exhibit the same behavior and issue a ticket.
> Basically, once I start Apache I seem to have to stay on either SSL or
> Non-SSL, but can't switch between both -- the second app to be
> accessed with always issue a ticket.  Is it possible to use Apache
> VirtualHosts to access both the admin site and non-admin site using
> mod_wsgi or would I also need something like mod_rewrite or to handle
> this via routes.py?  I'd like to avoid installing Web2py as a Windows
> service just for the ability to access the admin site if possible.
>
> Here are the relevant portions of my httpd.conf:
> WSGIPythonHome "C:/python"
>
> NameVirtualHost *:80
> 
>         DocumentRoot "C:/aproj/web2py/applications"
>         ServerName server1
>
>         
>                 Order allow,deny
>                 Deny from all
>         
>
>         
>                 Order allow,deny
>                 Allow from all
>
>                 AuthName "Stadion Lunch Application"
>                 AuthType SSPI
>                 SSPIAuth On
>                 SSPIAuthoritative On
>                 SSPIDomain hq.ft
>                 SSPIOmitDomain On
>                 SSPIOfferBasic Off
>                 SSPIBasicPreferred Off
>                 SSPIUsernameCase lower
>                 SSPIPerRequestAuth On
>
>                 Require group "HQ\IT"
>                 #require valid-user
>
>         
>
>         
>             Order Allow,Deny
>             Allow from all
>           
>
>         WSGIScriptAlias / "C:/aproj/web2py/wsgihandler.py"
> 
>
> NameVirtualHost *:443
> 
>         DocumentRoot "C:/aproj/web2py/applications/admin"
>         ServerName server1admin
>
>         
>                 Order allow,deny
>                 Deny from all
>         
>
>         
>                 Order allow,deny
>                 Allow from all
>
>                 AuthName "Stadion Lunch Application"
>                 AuthType SSPI
>                 SSPIAuth On
>                 SSPIAuthoritative On
>                 SSPIDomain hq.ft
>                 SSPIOfferBasic Off
>                 SSPIOmitDomain On
>                 SSPIBasicPreferred Off
>                 SSPIUsernameCase lower
>                 SSPIPerRequestAuth On
>
>                 Require group "HQ\IT"
>                 #require valid-user
>
>         
>
>         WSGIScriptAlias / "C:/aproj/web2py/wsgihandler.py"
>
>         SSLEngine On
>         SSLCertificateFile conf/server.crt
>         SSLCertificateKeyFile conf/server.key
> 
>
> Any help would greatly be appreciated!
>
> Thanks,
> Adam


[web2py] Re: Server slow

2010-12-02 Thread mdipierro
try

import time, logging

def testing():
t0=time.time()
orders = db(db.orders.id > 0).select()
logging.info('time to fetch %s' % (time.time()-t0))
return orders

so you can isolate the problem and see if it is in fetching or
somewhere else (for example session locking).


On Dec 2, 4:21 pm, Kenneth Lundström 
wrote:
>  > When you test is that the only active connection to the db?
>
> I tested it on an application running on the test instance. There could
> have been lite activity one production site.
> But when I tested loading the same function five times in about 10
> minutes I allways 39 seconds to load the data.
>
> Kenneth
>
>
>
> > 2010/12/2 Kenneth Lundström:
> >>> Please tell us more about the setup. Are the three instances behind
> >>> running on the same server?
> >> Yes.
>
> >>> why three? What do they do?
> >> One is production, one is testing and last one is development. I had two
> >> instances running on a virtual server before and it worked fine.
>
> >>> This is not normal but I suspect the problem is with database.
> >>> Did you set DAL(...,pool_size=10)?
> >> No, but I tried but no change.
>
> >> If I try to select more rows:
> >> def testing():
> >>     orders = db(db.orders.id>  0).select()
> >>     return orders
>
> >> It takes 80 seconds to return 1608 rows.
>
> >> If I change the return to return len(troops) it only takes 1,5 seconds.
>
> >> I have no view defined, just trying out the database.
>
> >> Kenneth
>
> >>> On Dec 2, 5:13 am, Kenneth Lundström
> >>> wrote:
>  Hello list,
>
>  need some help finding out why my server is so slow.
>
>  The server is with a Intel Celeron 2.66 GHz CPU, 4 GB of memory
>  CentOS 5.5 64-bit, Apache 2.2.3, MySQL 5.0.77, mod_wsgi, Web2py 1.89.5
>  The server is dedicated to web2py, there is three instances of web2py
>  running.
>
>  I have migrate=False, sessions on disc.
>
>  If I try the following code
>
>  def testing():
>        customers = db(db.customer.id>    0).select()
>        return customers
>
>  takes 39 seconds, 5 times in a row, to return 979 rows.
>
>  If I put db.customer<    100 it takes 4,5 seconds to return 87 rows.
>
>  Is it just me or are this a bit long times?
>
>  Kenneth
>
>


[web2py] Re: "I Just Need a Programmer"

2010-12-02 Thread weheh
The vacuum is full of wonderful ideas. However, execution is
everything.


[web2py] GAE 1.4.0

2010-12-02 Thread Richard
Some nice improvements in the latest release:
http://googleappengine.blogspot.com/2010/12/happy-holidays-from-app-engine-team-140.html


[web2py] Re: Scalability of web2py?

2010-12-02 Thread Anthony
Hi John,

You make some good points, but...

> Let us be blunt about this. Web2py is out there megalomaniacally
> presenting itself as all things to all people at a web framework
> level.

I don't think this is quite fair. web2py is presented as a general
purpose framework for building web applications (which covers a lot of
ground), but I think Massimo and everyone else recognize it's not
necessarily the right tool in every conceivable circumstance.

> ...Django does not present itself as all
> things to all people. At the top level Django presents itself as a
> commercially backed niche product suitable for simple content
> presentation of small organisations (such as regional newspapers).

That's not at all the impression I've gotten. Read the Django FAQ:
http://docs.djangoproject.com/en/1.2/faq/general/#why-does-this-project-exist

> Since Apache spawns or
> maintains a thread for each request, this means that each server needs
> to be able to maintain nearly 114 threads per server at once. I am not
> impressed by this.
>
> Consider that Lighttpd can handle 10,000 requests per second ON A
> SINGLE SERVER using year 2000 technology.

I think the point being made about Disqus was that your criticism was
not unique to web2py, though it sounded as if it was.

Anthony


[web2py] Re: Anyone willing to help out with Paypal

2010-12-02 Thread Michael McGinnis
That's great. I will be running on GAE, so I guess it wouldn't work
for me.

I expect that all I would need is a notification that the payment has
been credited to my Paypal account, and how much, so the amount can be
credited to the user's account in my system. I would also like to
transfer amounts from my system to the the user's Paypal account (in
payment for services that users provide to other users).

Michael

On Dec 2, 4:21 pm, howesc  wrote:
> Hi all,
>
> sorry for the delay.  my paypal integration code can be viewed 
> here:http://web2pyslices.com/main/slices/take_slice/106
>
> please let me know if you have problems with it.
>
> thanks,
>
> christian
>
> On Nov 26, 8:23 am, Andrew Evans  wrote:
>
>
>
>
>
>
>
> > hello
>
> > I am interested in your code :D
>
> > Let me know when you are able to pull it out :D


[web2py] Re: Anyone willing to help out with Paypal

2010-12-02 Thread Anthony
Is tenthrow.com still actively maintained? Looks like no new concerts
or playlists since June. It's a cool site.

On Nov 26, 9:33 am, howesc  wrote:
> hi all,
>
> i integrated paypal website payments standard onwww.tenthrow.com,
> using encrypted payment buttons and IPN (instant payment
> notification).  my implementation is based off 
> of:http://web2pyslices.com/main/slices/take_slice/9
>
> i can take a look at my code and try and pull it out to share with
> others.
>
> questions i have:
>  - paypal has newer supposedly better APIs (though the new ones have
> no shopping cart).  you might prefer those
>  - the code does not run on the google app engine, and noone at paypal
> seems interested in keeping me as a customer as my clients are
> starting to use google app engine, so they won't help me get the
> encryption working with the limited libraries on google app engine.
>
> anyhow, if there is interest in seeing my code let me know.  it will
> be a few days before i can get to pulling it out and sharing it
> though.
>
> thanks,
>
> christian
>
> On Nov 25, 9:28 pm, Andrew Evans  wrote:
>
>
>
> > For me I need a payed subscription service and a simple payment button that
> > after payment lets the user download a file (the file they purchased)
>
> > The subscription would give users access to the site so people could sell
> > there digital goods (via) the simple payment button :D
>
> > Anyway *cheers
>
> > On Thu, Nov 25, 2010 at 8:04 PM, mdipierro  wrote:
> > > Which features do people need?
>
> > > simple payment button?
> > > submission of shopping chart?
> > > digital content?
> > > handling for tax computations and shipping costs?
> > > receive paypal notification (like the user has canceled a payment)?
>
> > > Some things are easier than others. Some things may require a tight
> > > integration with your app and depends on details.
>
> > > On Nov 25, 5:45 pm, mdmcginn  wrote:
> > > > I will pay another $200 US if someone develops a PayPal plugin/module
> > > > for web2py that doesn't have to be described by the words
> > > > "Experimental" or "Needs work."
>
> > > > On Nov 25, 1:03 pm, Bruno Rocha  wrote:
>
> > > > > I am implementing PayPal for a animal charity project (
> > > natalanimal.com.br),
> > > > > now this project is receiving donations by PagSeguro (the bigger pay
> > > gateway
> > > > > of Brazil), but we started to receive international donations, so I am
> > > > > working on PayPal integrations right now.
>
> > > > > If I got success on integration, I'll contact you latter.
>
> > > > > 2010/11/25 Andrew Evans 
>
> > > > > > Hello just wondering if there is anyone out there willing to help 
> > > > > > out
> > > with
> > > > > > Paypal integration in a new system I am building. Its a subscription
> > > based
> > > > > > service that allows (should allow) users to sell digital goods by
> > > paypal.
>
> > > > > > The subscription part will also be handled by paypal :D
>
> > > > > > If some one is willing to help out. I could pay them 140 GBP... I
> > > know its
> > > > > > not much but if some one wants to help that would be great
>
> > > > > > email me or reply to this post if interested
>
> > > > > > *cheers
>
> > > > > > Andrew
>
> > > > > --
>
> > > > > Bruno Rochahttp://about.me/rochacbruno/bio- Hide quoted text -
>
> - Show quoted text -


[web2py] Rocket 1.2

2010-12-02 Thread Jonathan Lundell
Rocket 1.2.0 (web2py's embedded web server) is now in the trunk.

It have various improvements, which perhaps Tim will describe. There is one 
user-visible interface change that might affect some of you. In the previous 
version, Rocket's min_threads and max_threads were 10 and 1024 respectively. 
The cli (and winservice options) --numthreads option allowed the user to 
override min_threads.

In the new version, the Rocket defaults are 10 and 0 (meaning no upper limit), 
and the cli options are --minthreads and --maxthreads (--numthreads is provided 
for compatibility, meaning the same as --minthreads, but is deprecated).

If you're running CPython, my impression is that you need to do nothing, and if 
you've been ignoring thread-count options, also do nothing. If you've been 
patching maxthreads, the new default of 0 may work fine for you, and if not you 
now have command-line access to it. Tim suggests increasing minthreads to 64 
for a production server.

If you're running JPython, Tim has some thread-count advice for you here: 
http://packages.python.org/rocket/usage.html (it's for 1.1.x, not 1.2, but I 
assume that it still applies).

If you're running winservice, numthreads is now ignored; you must use 
minthreads and maxthreads (assuming that you want something other than the 
defaults).

Again, this is in the trunk, and unless the wheels fall off will be in the next 
release *after* 1.89.5, which is current-stable.

[web2py] Re: "I Just Need a Programmer"

2010-12-02 Thread Anthony
I think web2py is really making it more and more feasible for the
"idea person" to become the programmer, as suggested in the
article. :)

On Dec 2, 10:14 pm, mdipierro  wrote:
> http://www.cs.uni.edu/~wallingf/blog/archives/monthly/2010-12.html#e2...


[web2py] Re: Scalability of web2py?

2010-12-02 Thread pbreit
I don't think anyone is comparing web2py to .net (thank goodness). A
better comparison is Ruby on Rails and Massimo is a bit like DHH. I
get the impression that he is pretty passionate about web2py and his
position at the university would enable him to continue working on it
for awhile. And if that doesn't happen, hey, it's open source and
anyone can pick it up.

What we're missing is something like the 37signals product suite to
push the framework in real world use. Is anyone here working on a
public web site that might scale up? I'm about to give it a shot. The
risk seems manageable. I've never really heard of anyone actually
being unable to scale a popular service. The problem is usually the
opposite: premature optimization.


[web2py] Re: "I Just Need a Programmer"

2010-12-02 Thread pbreit
This is a brilliant observation and Anthony, I think you are right on.
I am a fairly inexperienced programmer, having dabbled with PHP over
the years but never really creating anything, but web2py has got me
extremely excited that I can really implement some of my ideas.
Massimo has struck an incredible balance between ease of use and
power. The other thing that is great is how easy and inexpensive it is
to get an Ubuntu server running in the cloud (free at Amazon, $8/month
at Rackspace)(or GAE).