Re: [web2py] Re: Scalability of web2py?

2010-12-01 Thread Kuba Kucharski
 Can session files be turned of ?

you can turn off sessions by

session.forget()

and also store sessions in the database
that is how it works on GAE. In every default db.py you have:

if request.env.web2py_runtime_gae:
  db = DAL('gae')
  session.connect(request, response, db=db)


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

2010-12-01 Thread cjrh
On Nov 30, 11:48 pm, pbreit pbreitenb...@gmail.com wrote:
 Sorry for the newbie, religious question but what is the preference in
 web2py for table names, plural or singular?

+1 for singular.


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

2010-12-01 Thread Michele Comitini
+1 singular

And now... gender preferences: anyone would like to discuss on that?  ;-)

2010/12/1 cjrh caleb.hatti...@gmail.com:
 On Nov 30, 11:48 pm, pbreit pbreitenb...@gmail.com wrote:
 Sorry for the newbie, religious question but what is the preference in
 web2py for table names, plural or singular?

 +1 for singular.


[web2py] Re: How to call a function in an other controller?

2010-12-01 Thread cjrh
This link

http://web2py.com/book/default/chapter/04#Cooperation

suggests perhaps XML-RPC?


Re: [web2py] Re: How to call a function in an other controller?

2010-12-01 Thread Michele Comitini
if that is a single web2py application instance I would simply move
every common code to the model
if those are differente applications on a single web2py instance I
would simply move every common code  into a module in site-packages
if none of the above than a rest like, soap, xmlrpc, json whatever
will need to be implemented.


2010/12/1 cjrh caleb.hatti...@gmail.com:
 This link

 http://web2py.com/book/default/chapter/04#Cooperation

 suggests perhaps XML-RPC?



[web2py] jqgrid plugin display data from multiple tables

2010-12-01 Thread Neveen Adel
Hello,

 Is there a way to make jqgrid  plugin to display data from multiple
tables ?

plugin_jqgrid(db.shout,columns=['id','message'],height=300)


Thanks in Advance


Re: [web2py] How to call a function in an other controller?

2010-12-01 Thread rochacbruno
Depending on the function, you can call client side via ajax without the need 
to redirect the user. ( but it is not safe )

I prefer to put my commom code in /modules and import when it is needed. 

Enviado via iPhone

Em 01/12/2010, às 05:54, Dan kor...@ironshark.de escreveu:

 Hi,
 
 is there any way to execute a function in an other controller?
 
 controller1.py
func():
do something
 
 controller2.py
func():
do something else
call func() of controller1.py
do some more things
return
 
 I don't want to redirect the user.


[web2py] Problems with mail.send()

2010-12-01 Thread Bernardo
Dear all,

I don't know if it is exactly a web2py issue or not. The fact is that
I have a remote mail server, listening in port 25. It uses a self
created certificate to allow connections from the outside (i.e. for
thunderbird, you must accept that certificate in order to send mails).
The problem is that when I try to send an email:

mail.send(to='estem...@gmail.com',subject='Hello world
subject',message='Hello world text')

but nothing happens. Not a single messange printed on python console.
And nothing shown in postfix log


The lines in db.py are:
mail.settings.server = 'mail.mydomain.com:25'
mail.settings.sender = 'berna...@mydomain.com' # your email
mail.settings.login = 'berna...@mydomain.com:mypass'  # your
credentials or None
mail.settings.cipher_type = 'x509'
mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
mail.settings.x509_sign_certfile = 'url_to_postfix.cert'




Does anyone can figure out what is wrong with all of this?

thanks a lot for your time,
Bernardo


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

2010-12-01 Thread villas
 And now... gender preferences: anyone would like to discuss on that?  ;-)

OK
+1 single women  :)


[web2py] Re: Design advice for many to many

2010-12-01 Thread villas
Hi Jay,

If all the permissions are easy to specify and similar,  e.g. all
students can see information for their own enrolled courses,  then use
your own model.

If all the permissions might be different and set on an individual
basis with many exceptions and complications,  then auth is built for
that.  In which case you may as well leverage the auth model to get
your fine-grained control.

Just be wary that sometimes what starts out easy can soon become more
complicated than you'd imagined, so it's well worth giving it some
thought before you choose (as you are).

-D


[web2py] Posgresql's full text search capabilities and DAL

2010-12-01 Thread Johann Spies
How do I handle the following PostgreSQL function in Web2py?

ALTER TABLE pgweb ADD COLUMN textsearchable_index_col tsvector;
UPDATE pgweb SET textsearchable_index_col =
 to_tsvector('english', coalesce(title,'') || ' ' || coalesce(body,''));

I know I can use executesql for creating the indexes but in some cases
it is preferable to create a column with the type 'tsvector' as in the
example above or in the one below:

CREATE TABLE messages (
title   text,
bodytext,
tsv tsvector
);

And then how do I handle queries like this?

SELECT title, body FROM messages WHERE tsv @@ to_tsquery('title  body');


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] OFFTOPIC: FUNNY: SEO specialists

2010-12-01 Thread Branko Vukelic
There are many things you could do just modifying the default app w/o
the thesaurus. Just making the default app compliant with Google
webmasters guidelines would be a HUGE improvement over the current
default app.

http://www.google.com/support/webmasters/bin/answer.py?hl=enanswer=35769

The way it currently works is not very optimal.

On Wed, Dec 1, 2010 at 5:08 AM, Jason Brower encomp...@gmail.com wrote:

 You know.  I wonder if we could implement an SEO helper.  You give the 
 subject and it automatically grabs some thasaurus and gets you the similars.
 BR,
 Jason
 On Tue, 2010-11-30 at 22:58 +0100, Branko Vukelic wrote:

 How many SEO specialists are needed to change lightbulb bulb bulbs
 light cheap affordable?

 :)





--
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: Table names: plural or singular?

2010-12-01 Thread Branko Vukelic
On Wed, Dec 1, 2010 at 1:08 PM, villas villa...@gmail.com wrote:
 And now... gender preferences: anyone would like to discuss on that?  ;-)

 OK
 +1 single women  :)

+1


-- 
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: Table names: plural or singular?

2010-12-01 Thread Branko Vukelic
On Wed, Dec 1, 2010 at 1:08 PM, villas villa...@gmail.com wrote:
 And now... gender preferences: anyone would like to discuss on that?  ;-)

 OK
 +1 single women  :)

Btw, a table for single women should be single woman.


-- 
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] Re: very long wait for http://127.0.0.1:8000/ on IE and Firefox browsers

2010-12-01 Thread Timbo
Rocket 1.2.0 is out.  It addresses the issue above and has some speed
improvements (though that might not be noticeable to the user).  If
you look at the code, it's much cleaner than it was and reflects my
maturing skill as a developer.  I've tested it on cPython 2.4 (the
legacy branch support Py2.4), 2.5, 2.6, 3.1, Jython 2.5.1 and Pypy 1.4
on Windows 7 and cPython 2.6 on Ubuntu.

While building a patch for web2py is not that complicated, I'm time-
restricted until the weekend.  If you can't wait that long, bug
Jonathan Lundell.  He's familiar enough to do it.  ;-)

Cheers,
-tim

On Nov 24, 10:37 am, Timbo tfarr...@owassobible.org wrote:
 I didn't mean to imply that the enhancements I'm planning for 1.2
 (window speed) address this issue...just to be clear.

 @Jonathan: Yes we need to make numthreads map to max-threads and
 default it to 0 (unlimited) or a very high number.  The only time
 reasonable to change this is when running web2py (rocket) on Jython.
 See:

 http://packages.python.org/rocket/usage.html#architecture-considerations

 @Phyo: Thanks.  I'm not fully recovered, but enough to get back in the
 game.

 -tim

 On Nov 24, 9:56 am, Jonathan Lundell jlund...@pobox.com wrote:







  On Nov 24, 2010, at 5:59 AM, Phyo Arkar wrote:

   I haven't tried DEFAULT_MAX_THREADS it yet but to report that it is not 
   just windows problem it happens in Linux too.
   WHen i test my Homepage which dont do anything dynamic much , just login 
   box , with static js and css. That caused long load delays too.

  By all means give max-threads a try. If the problem is thread starvation, 
  it's not likely to be Windows-specific. The default limit is 10, which 
  isn't a lot for pages with a lot of resources.

   Tim , sorry to know that u got injury. Had you recovered well now?

   On Wed, Nov 24, 2010 at 12:01 PM, Jonathan Lundell jlund...@pobox.com 
   wrote:
   On Nov 23, 2010, at 8:48 PM, Anthony wrote:

On Nov 23, 9:26 pm, Jonathan Lundell jlund...@pobox.com wrote:
On Nov 23, 8:10 pm, Timbo tfarr...@owassobible.org wrote:
Set numthreads=0 in your options.py.  See if you still see this
behavior.

options.py is just for running web2py as a Windows service, no? I'm
not running web2py as a Windows service when I observe the problem.

If you're running from the command line, use --options 0.

Do you mean use the -n command line option to set numthreads to 0,
e.g.:

  python web2py.py -a password -i 127.0.0.1 -p 8000 -n 0

I tried this, but in that case, I can't get 127.0.0.1:8000 to load at
all (it just hangs indefinitely).

   Right, now that I look at it, there's no way to override max_threads. 
   Maybe there should be


Re: [web2py] jqgrid plugin display data from multiple tables

2010-12-01 Thread Richard Vézina
I would make a view at the database level and define a table for that view
in web2py model dans then pass the view to jqgrid...

On Wed, Dec 1, 2010 at 5:45 AM, Neveen Adel nevo.a...@gmail.com wrote:

 Hello,

  Is there a way to make jqgrid  plugin to display data from multiple
 tables ?

 plugin_jqgrid(db.shout,columns=['id','message'],height=300)


 Thanks in Advance


[web2py] read boolean unselectable checkbox

2010-12-01 Thread Richard Vézina
Hello,

How can I represent the boolean in crud.read form by an unselectable
checkbox instead of True or False?

Is it a job for the widget :
SQLFORMhttp://web2py.com/book/default/docstring/SQLFORM
.widgets.boolean.widget?


Richard


[web2py] Re: Using Jython with web2py

2010-12-01 Thread mdipierro
I do not know of other problems. Event his one problem has not
manifested itself.

On Dec 1, 1:48 am, pierreth pierre.thibau...@gmail.com wrote:
 On Nov 26, 6:41 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  It works (some of us have tested it) but there are some know problems
  and I would not recommend it in production. One problem is a known
  problem with Java regular expression parses that Sun marked as won't
  fix. It is not a web2py specific problem but can cause some web2py
  templates send enter into a loop.

 This is the bughttp://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5050507.
 Oracle seems to have a valid reason to not fix the bug. They are
 giving suggestions how to get around. It seems easy to refactor web2py
 apps having this problem unless regular are created dynamically but I
 guess this is rare.

 This seems to be the major problem with Jython and web2py. Do you have
 other reasons for not recommending web2py with Jython?


[web2py] Re: auth.change_password() not workign

2010-12-01 Thread mdipierro
I do not think so. What do you mean it does not work? Could it be a
problem with mail?

On Dec 1, 1:57 am, Aniket Arora aniket.ar...@gmail.com wrote:
 Hey,

 I'm using web2py (Version 1.83.2) on my local machine. I used
 auth.change_password() function and it works fine on my local machine.
 But when I tried the same on live site with Version 1.88.2 , it's not
 working.

 Is there any change specific to this in the newer version?


[web2py] Re: Posgresql's full text search capabilities and DAL

2010-12-01 Thread mdipierro
The query is easy:

db(@@ to_tsquery('%s'); % title_body.replace(','')).select()

to generate the table you need SQLCustomField and the compute
attribute.
Give it a try and please report back. I am very much interested in
this issue.




On Dec 1, 6:32 am, Johann Spies johann.sp...@gmail.com wrote:
 How do I handle the following PostgreSQL function in Web2py?

 ALTER TABLE pgweb ADD COLUMN textsearchable_index_col tsvector;
 UPDATE pgweb SET textsearchable_index_col =
      to_tsvector('english', coalesce(title,'') || ' ' || coalesce(body,''));

 I know I can use executesql for creating the indexes but in some cases
 it is preferable to create a column with the type 'tsvector' as in the
 example above or in the one below:

 CREATE TABLE messages (
     title       text,
     body        text,
     tsv         tsvector
 );

 And then how do I handle queries like this?

 SELECT title, body FROM messages WHERE tsv @@ to_tsquery('title  body');

 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-01 Thread mdipierro
try telnet mail.mydomain.com 25 and see if it is accepting remote
connections (by defau postfix does not).

Also I think

mail.settings.login = 'berna...@mydomain.com:mypass'

should be

mail.settings.login = 'berna...:mypass'


On Dec 1, 5:44 am, Bernardo estem...@gmail.com wrote:
 Dear all,

 I don't know if it is exactly a web2py issue or not. The fact is that
 I have a remote mail server, listening in port 25. It uses a self
 created certificate to allow connections from the outside (i.e. for
 thunderbird, you must accept that certificate in order to send mails).
 The problem is that when I try to send an email:

 mail.send(to='estem...@gmail.com',subject='Hello world
 subject',message='Hello world text')

 but nothing happens. Not a single messange printed on python console.
 And nothing shown in postfix log

 The lines in db.py are:
 mail.settings.server = 'mail.mydomain.com:25'
 mail.settings.sender = 'berna...@mydomain.com'         # your email
 mail.settings.login = 'berna...@mydomain.com:mypass'      # your
 credentials or None
 mail.settings.cipher_type = 'x509'
 mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
 mail.settings.x509_sign_certfile = 'url_to_postfix.cert'

 Does anyone can figure out what is wrong with all of this?

 thanks a lot for your time,
 Bernardo


[web2py] Re: read boolean unselectable checkbox

2010-12-01 Thread mdipierro
Please submit a bug report about this on http://code.google.com/p/web2py/
and I will take care of it asap.

massimo

On Dec 1, 9:17 am, Richard Vézina ml.richard.vez...@gmail.com wrote:
 Hello,

 How can I represent the boolean in crud.read form by an unselectable
 checkbox instead of True or False?

 Is it a job for the widget :
 SQLFORMhttp://web2py.com/book/default/docstring/SQLFORM
 .widgets.boolean.widget?

 Richard


[web2py] Re: very long wait for http://127.0.0.1:8000/ on IE and Firefox browsers

2010-12-01 Thread mdipierro
I will wait for the patch from you or Jonathan. I can wait the week-
end.

On Dec 1, 8:39 am, Timbo tfarr...@owassobible.org wrote:
 Rocket 1.2.0 is out.  It addresses the issue above and has some speed
 improvements (though that might not be noticeable to the user).  If
 you look at the code, it's much cleaner than it was and reflects my
 maturing skill as a developer.  I've tested it on cPython 2.4 (the
 legacy branch support Py2.4), 2.5, 2.6, 3.1, Jython 2.5.1 and Pypy 1.4
 on Windows 7 and cPython 2.6 on Ubuntu.

 While building a patch for web2py is not that complicated, I'm time-
 restricted until the weekend.  If you can't wait that long, bug
 Jonathan Lundell.  He's familiar enough to do it.  ;-)

 Cheers,
 -tim

 On Nov 24, 10:37 am, Timbo tfarr...@owassobible.org wrote:

  I didn't mean to imply that the enhancements I'm planning for 1.2
  (window speed) address this issue...just to be clear.

  @Jonathan: Yes we need to make numthreads map to max-threads and
  default it to 0 (unlimited) or a very high number.  The only time
  reasonable to change this is when running web2py (rocket) on Jython.
  See:

 http://packages.python.org/rocket/usage.html#architecture-considerations

  @Phyo: Thanks.  I'm not fully recovered, but enough to get back in the
  game.

  -tim

  On Nov 24, 9:56 am, Jonathan Lundell jlund...@pobox.com wrote:

   On Nov 24, 2010, at 5:59 AM, Phyo Arkar wrote:

I haven't tried DEFAULT_MAX_THREADS it yet but to report that it is not 
just windows problem it happens in Linux too.
WHen i test my Homepage which dont do anything dynamic much , just 
login box , with static js and css. That caused long load delays too.

   By all means give max-threads a try. If the problem is thread starvation, 
   it's not likely to be Windows-specific. The default limit is 10, which 
   isn't a lot for pages with a lot of resources.

Tim , sorry to know that u got injury. Had you recovered well now?

On Wed, Nov 24, 2010 at 12:01 PM, Jonathan Lundell jlund...@pobox.com 
wrote:
On Nov 23, 2010, at 8:48 PM, Anthony wrote:

 On Nov 23, 9:26 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Nov 23, 8:10 pm, Timbo tfarr...@owassobible.org wrote:
 Set numthreads=0 in your options.py.  See if you still see this
 behavior.

 options.py is just for running web2py as a Windows service, no? I'm
 not running web2py as a Windows service when I observe the problem.

 If you're running from the command line, use --options 0.

 Do you mean use the -n command line option to set numthreads to 0,
 e.g.:

   python web2py.py -a password -i 127.0.0.1 -p 8000 -n 0

 I tried this, but in that case, I can't get 127.0.0.1:8000 to load at
 all (it just hangs indefinitely).

Right, now that I look at it, there's no way to override max_threads. 
Maybe there should be




[web2py] Re: Scalability of web2py?

2010-12-01 Thread VP
This is an example -- I think -- where web2py still needs to be proven
in terms of scalability.

Yes, sessions can be stored in database, turned off in specific
functions, and regularly deleted.   But I still think that there
should be a better systematic way of handling sessions in heavy
applications.  I think the current set up is not effective when you
have large volume of users, which suddenly builds up many sessions.

Small things like this don't matter much until things get large
scaled.

===

To take web2py to the next level, I think Massimo might need to lay
out milestones or visions to be achieved in future releases of
web2py.



On Nov 30, 6:07 pm, Stef Mientki stef.mien...@gmail.com wrote:
 On 30-11-2010 21:08, VP wrote: I think .NET and web2py are not competitors.  
 They are different ball
  games.   When things scale large, everything is important.  A small
  design issue might be magnified.   I don't think web2py is proven yet,
  in terms of scalability.  What web2py needs is at least one real
  example to show that it is scalable and what are the limits at the
  extreme.

 I'm not sure were session files are used for,
 but isn't file access much slower than database access ?

 Can session files be turned of ?

 cheers,
 Stef


[web2py] Re: Best way to edit SQLFORM input before passing to accepts?

2010-12-01 Thread hswolff
I'll try the model implementation.  I need to be able to parse the
submit content and count the frequency a word appears and set the type
accordingly.

I'm using response.moment_form because when I had it in the index()
function and I would go to the user page it wouldn't render because
the dict wouldn't return the form that was displayed on views/
layout.html.

Correct me if I'm wrong:  if I were to make a submit_moment():
function and a views/default/submit_moment.html view I would be able
to include the view on every page and have it be functionally
accurate, right?

I'm still getting the hang of web2py's MVC.

On Nov 30, 5:20 pm, DenesL denes1...@yahoo.ca wrote:
 Your model should have type as readable=False, writable=False
 and in the accepts part or via an onvalidation function
 you can set it to what you want.

 You code seems strange though:
 - you are using the whole controller, not an action and view for it
 - returning the form inside response
 Any reason to do that?.

 On Nov 30, 11:59 am, hswolff hswo...@gmail.com wrote:







  I'm developing an application with web2py that asks a user to submit
  text in a textarea, and after the user hits submit I want to parse the
  input and assign a 'type' to the submission depending on the frequency
  of a word used from the submitted text.

  Following is the associated code that I'm using.

  This is at the top of my controller/default.py:
  try:
      db.moment.user_id.default = auth.user.id
  except:
      pass
  response.moment_form = SQLFORM(db.moment)
  if response.moment_form.accepts(request.vars,
  formname='moment_submit_form'):
      response.flash = 'form accepted'
  elif response.moment_form.errors:
      response.flash = 'form has errors %s' %
  response.moment_form.vars.type

  and the associated views/layout.html:

                          {{if auth.is_logged_in():}}
                          form method=post
                          textarea class=text cols=40 
  id=moment_content name=content
  rows=10/textarea
                          input type=submit value=Submit
                          input type=hidden name=type value=worst /
                          input type=hidden name=_formname 
  value=moment_submit_form /
                          /form
                          {{else:}}
                          Sign in to play!
                          {{pass}}

  I've tried adding, just for debugging purposes:
      db.moment.type.default = 'worst'

  To assign a static type after the form is submitted however that only
  returns errors.

  I'm thinking using a component as described in chapter 13 of the book
  would be the way to go but I was worried it wouldn't solve this issue,
  so I posted this here.


[web2py] Re: Scalability of web2py?

2010-12-01 Thread mdipierro
We should have a mechanism for storing sessions clientside but this is
a speed issue not a scalability issues. Storing sessions in encrypted
cookies makes a each request 1-2ms faster by trading bandhwidth
(required to communicate the session in cookie) with file IO (required
to locate and access the session in a file).

Scalability-wise sessions in files do not present a problem as long as
one uses a load balancer with support with sticky sessions.

On common problem arises when there are too many session files in the
same folder (the os becomes slow accessing the folder). This problem
has been solved in trunk last week by creating a sub-folder tree
structure for the session folder.

Session in files some advantages of sessions in cookies: they can
contain more data. They can be controller server-side (checked,
deleted, modified). They can be locked to force per-user serialization
of form processing(default in web2py).

Bottom line: current sessions are not a scalability issue but it would
be nice to have the option of sessions in signed cookies. It is not
difficult to do and we have it by the end of the year.

This will be a major speed up for system that do not have a filesystem
and currently require storing sessions on datastore, like on GAE.

Massimo

On Dec 1, 10:31 am, VP vtp2...@gmail.com wrote:
 This is an example -- I think -- where web2py still needs to be proven
 in terms of scalability.

 Yes, sessions can be stored in database, turned off in specific
 functions, and regularly deleted.   But I still think that there
 should be a better systematic way of handling sessions in heavy
 applications.  I think the current set up is not effective when you
 have large volume of users, which suddenly builds up many sessions.

 Small things like this don't matter much until things get large
 scaled.

 ===

 To take web2py to the next level, I think Massimo might need to lay
 out milestones or visions to be achieved in future releases of
 web2py.

 On Nov 30, 6:07 pm, Stef Mientki stef.mien...@gmail.com wrote:

  On 30-11-2010 21:08, VP wrote: I think .NET and web2py are not 
  competitors.  They are different ball
   games.   When things scale large, everything is important.  A small
   design issue might be magnified.   I don't think web2py is proven yet,
   in terms of scalability.  What web2py needs is at least one real
   example to show that it is scalable and what are the limits at the
   extreme.

  I'm not sure were session files are used for,
  but isn't file access much slower than database access ?

  Can session files be turned of ?

  cheers,
  Stef




[web2py] Anyone using memCache ? Two issues

2010-12-01 Thread JC11
Hello,
I have used the local web2py cache such as:
  msg = cache.ram(cacheKey, lambda: getResponse(reqBody),
time_expire=10), and sometimes
 cache.ram.clear(cacheKey)
which works fine.  (easy and fast !)

I am now trying to use memcached and getting two errors.  The first
is :
  cache.ram.clear(cacheKey)
AttributeError: '_MemcacheClient' object has no attribute 'clear'

And the second is that is seems I am not connecting to the memcached
server.  The hints of this are that the responses are now very slow
and not getting a value from the cache, also the admin. chap can not
see any entries being put in the cache by me.

Any solutions to the first problem and hints about where to look for
the second (some sort of debug mode or something).

Thanks,

JC


[web2py] Re: jqgrid plugin display data from multiple tables

2010-12-01 Thread John Heenan
If you mean a 'master-slave' multiple table arrangement then you can
include include code for the client (javascript) to respond to a
relevant master table event that does not replace the entire page (by
using ajax and json) that:
1) sends data to web2py,
2) asynchronously receive data back from web2py and then
3) updates the slave jqgrid table.

If this is what you want to do, then working through jqgrid
documentation and examples will help.


John Heenan


On Dec 1, 8:45 pm, Neveen Adel nevo.a...@gmail.com wrote:
 Hello,

  Is there a way to make jqgrid  plugin to display data from multiple
 tables ?

 plugin_jqgrid(db.shout,columns=['id','message'],height=300)

 Thanks in Advance


Re: [web2py] Re: Scalability of web2py?

2010-12-01 Thread Thadeus Burgess
All of the problems I had with web2py were because of the sessions. Even
storing the sessions in db caused web2py to crash.

Never really found a solution, there is something to the fact of having to
pickle/unpickle the session that can't handle major loads.

--
Thadeus




On Wed, Dec 1, 2010 at 10:57 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 We should have a mechanism for storing sessions clientside but this is
 a speed issue not a scalability issues. Storing sessions in encrypted
 cookies makes a each request 1-2ms faster by trading bandhwidth
 (required to communicate the session in cookie) with file IO (required
 to locate and access the session in a file).

 Scalability-wise sessions in files do not present a problem as long as
 one uses a load balancer with support with sticky sessions.

 On common problem arises when there are too many session files in the
 same folder (the os becomes slow accessing the folder). This problem
 has been solved in trunk last week by creating a sub-folder tree
 structure for the session folder.

 Session in files some advantages of sessions in cookies: they can
 contain more data. They can be controller server-side (checked,
 deleted, modified). They can be locked to force per-user serialization
 of form processing(default in web2py).

 Bottom line: current sessions are not a scalability issue but it would
 be nice to have the option of sessions in signed cookies. It is not
 difficult to do and we have it by the end of the year.

 This will be a major speed up for system that do not have a filesystem
 and currently require storing sessions on datastore, like on GAE.

 Massimo

 On Dec 1, 10:31 am, VP vtp2...@gmail.com wrote:
  This is an example -- I think -- where web2py still needs to be proven
  in terms of scalability.
 
  Yes, sessions can be stored in database, turned off in specific
  functions, and regularly deleted.   But I still think that there
  should be a better systematic way of handling sessions in heavy
  applications.  I think the current set up is not effective when you
  have large volume of users, which suddenly builds up many sessions.
 
  Small things like this don't matter much until things get large
  scaled.
 
  ===
 
  To take web2py to the next level, I think Massimo might need to lay
  out milestones or visions to be achieved in future releases of
  web2py.
 
  On Nov 30, 6:07 pm, Stef Mientki stef.mien...@gmail.com wrote:
 
   On 30-11-2010 21:08, VP wrote: I think .NET and web2py are not
 competitors.  They are different ball
games.   When things scale large, everything is important.  A small
design issue might be magnified.   I don't think web2py is proven
 yet,
in terms of scalability.  What web2py needs is at least one real
example to show that it is scalable and what are the limits at the
extreme.
 
   I'm not sure were session files are used for,
   but isn't file access much slower than database access ?
 
   Can session files be turned of ?
 
   cheers,
   Stef
 
 



[web2py] Re: Scalability of web2py?

2010-12-01 Thread John Heenan
The elephant in the room has not gone away Massimo.

Web2py is great for small projects.

DotNet is great for small and large projects.

The elephant in the room is not only the untested scalibility of
web2py but also the amount of resources that neeeds to be thrown at
web2py compared to DotNet and other frameworks as scale increases.

One of the glaring defciences in web frameworks that use Python is the
glaring engineering weakness of using thread per request web serving
instead of using event per request web serving. I think I have pointed
this out a number of times on this fourm, but it just does not sink
in. I even pointed out how Linux loast a PR war over this issue.

There is no need for Python based web frameworks to use thread per
request web serving.

John Heenan

On Nov 30, 4:05 am, mdipierro mdipie...@cs.depaul.edu wrote:
 You achieve scalability by replicating the web server behind a load
 balancer. This is documented in the book, chapter 11, using HAProxy.
 All frameworks work the same way in this respect. web2py has no
 intrinsic limitations. The bottle neck is the database connection. All
 frameworks have the same problem. You can replicate the database too
 and web2py supports multiple database clients with Round-Robin.

 On a small VPS, web2py in average, should execute one page in 20ms.
 Depending on how many requests/second you need you can determine how
 many servers you need.

 web2py apps run on Google App Engine and that means arbitrary
 scalability as long as you can live with the constraints imposed by
 the Google datastore (these limitations will go away as soon as Google
 releases MySQL in the cloud, which they announced some time ago).

 Please ask the consultant: which .NET feature makes it scale any
 better than web2py or Rails? If he explains we can address it more
 specifically.

 Massimo

 On Nov 29, 11:56 am, Lorin Rivers lriv...@mosasaur.com wrote:

  The project I'm working on has hired a consultant who is now recommending 
  .Net in place of web2py or even rails.

  What's the 'largest' scale web2py is known to perform well on?

  --
  Lorin Rivers
  Mosasaur: Killer Technical Marketing http://www.mosasaur.com
  mailto:lriv...@mosasaur.com
  512/203.3198 (m)




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

2010-12-01 Thread Bernardo
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 mdipie...@cs.depaul.edu wrote:
 try telnet mail.mydomain.com 25 and see if it is accepting remote
 connections (by defau postfix does not).

 Also I think

 mail.settings.login = 'berna...@mydomain.com:mypass'

 should be

 mail.settings.login = 'berna...:mypass'

 On Dec 1, 5:44 am, Bernardo estem...@gmail.com wrote:







  Dear all,

  I don't know if it is exactly a web2py issue or not. The fact is that
  I have a remote mail server, listening in port 25. It uses a self
  created certificate to allow connections from the outside (i.e. for
  thunderbird, you must accept that certificate in order to send mails).
  The problem is that when I try to send an email:

  mail.send(to='estem...@gmail.com',subject='Hello world
  subject',message='Hello world text')

  but nothing happens. Not a single messange printed on python console.
  And nothing shown in postfix log

  The lines in db.py are:
  mail.settings.server = 'mail.mydomain.com:25'
  mail.settings.sender = 'berna...@mydomain.com'         # your email
  mail.settings.login = 'berna...@mydomain.com:mypass'      # your
  credentials or None
  mail.settings.cipher_type = 'x509'
  mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
  mail.settings.x509_sign_certfile = 'url_to_postfix.cert'

  Does anyone can figure out what is wrong with all of this?

  thanks a lot for your time,
  Bernardo


[web2py] Re: Please help: Are these errors?

2010-12-01 Thread mattynoce
i get this error when i have mismatched data, but only on certain
fields. i haven't done the example that you're talking about exactly,
but maybe this can help.

i have a normal auth_user table, a period table and an element table
that look like this:

auth_user

period: userid, ...

element: periodid, ...

if i have test user, let's say with id 10, and i create a period, it
works fine. but if i delete user 10, i get the Using a recursive
select but encountered a broken reference error when looking on
appadmin. the fact that user #10 isn't there breaks it.

the weird part is that if element refers to a missing period, it's not
a problem. so let's say there's an element that uses period 50. if i
delete period 50 and then look at the element table on appadmin, it
works fine. it simply leaves the period dropdown blank since there's
no associated value.

i'm not sure why a missing auth_user record causes an error but a
missing period record doesn't. but hopefully this can be of some help.

db.define_table('period',
Field('userid', db.auth_user, requires=IS_IN_DB(db,
db.auth_user.id, '%(last_name)s, %(first_name)s (%(id)s)')),
...
)

db.define_table('element',
Field('periodid', 'integer', requires=IS_IN_DB(db, db.period.id, '%
(startDate)s, %(endDate)s (%(id)s)')),
...
)

matt

On Nov 25, 3:29 am, Seeker tmurn...@gmail.com wrote:
 Hi,
 Can anyone else replicate this issue (error 1 described at the top of
 this post)?
 It seems to be an error introduced when creating an app with the
 wizard and specifying related (referenced) tables in an incorrect
 order.

 Thanks.


[web2py] Re: Anyone using memCache ? Two issues

2010-12-01 Thread mdipierro
True that memcache does not support clear.

Not sure about the other problem. How do you connect to memcache from
web2py?

On Dec 1, 11:06 am, JC11 john.c...@gmail.com wrote:
 Hello,
 I have used the local web2py cache such as:
       msg = cache.ram(cacheKey, lambda: getResponse(reqBody),
 time_expire=10), and sometimes
      cache.ram.clear(cacheKey)
 which works fine.  (easy and fast !)

 I am now trying to use memcached and getting two errors.  The first
 is :
       cache.ram.clear(cacheKey)
 AttributeError: '_MemcacheClient' object has no attribute 'clear'

 And the second is that is seems I am not connecting to the memcached
 server.  The hints of this are that the responses are now very slow
 and not getting a value from the cache, also the admin. chap can not
 see any entries being put in the cache by me.

 Any solutions to the first problem and hints about where to look for
 the second (some sort of debug mode or something).

 Thanks,

 JC


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

2010-12-01 Thread 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 estem...@gmail.com 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 mdipie...@cs.depaul.edu wrote:

  try telnet mail.mydomain.com 25 and see if it is accepting remote
  connections (by defau postfix does not).

  Also I think

  mail.settings.login = 'berna...@mydomain.com:mypass'

  should be

  mail.settings.login = 'berna...:mypass'

  On Dec 1, 5:44 am, Bernardo estem...@gmail.com wrote:

   Dear all,

   I don't know if it is exactly a web2py issue or not. The fact is that
   I have a remote mail server, listening in port 25. It uses a self
   created certificate to allow connections from the outside (i.e. for
   thunderbird, you must accept that certificate in order to send mails).
   The problem is that when I try to send an email:

   mail.send(to='estem...@gmail.com',subject='Hello world
   subject',message='Hello world text')

   but nothing happens. Not a single messange printed on python console.
   And nothing shown in postfix log

   The lines in db.py are:
   mail.settings.server = 'mail.mydomain.com:25'
   mail.settings.sender = 'berna...@mydomain.com'         # your email
   mail.settings.login = 'berna...@mydomain.com:mypass'      # your
   credentials or None
   mail.settings.cipher_type = 'x509'
   mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
   mail.settings.x509_sign_certfile = 'url_to_postfix.cert'

   Does anyone can figure out what is wrong with all of this?

   thanks a lot for your time,
   Bernardo




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

2010-12-01 Thread Bernardo Botella Corbí
It prints

False

Bernardo

2010/12/1 mdipierro mdipie...@cs.depaul.edu

 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 estem...@gmail.com 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 mdipie...@cs.depaul.edu wrote:
 
   try telnet mail.mydomain.com 25 and see if it is accepting remote
   connections (by defau postfix does not).
 
   Also I think
 
   mail.settings.login = 'berna...@mydomain.com:mypass'
 
   should be
 
   mail.settings.login = 'berna...:mypass'
 
   On Dec 1, 5:44 am, Bernardo estem...@gmail.com wrote:
 
Dear all,
 
I don't know if it is exactly a web2py issue or not. The fact is that
I have a remote mail server, listening in port 25. It uses a self
created certificate to allow connections from the outside (i.e. for
thunderbird, you must accept that certificate in order to send
 mails).
The problem is that when I try to send an email:
 
mail.send(to='estem...@gmail.com',subject='Hello world
subject',message='Hello world text')
 
but nothing happens. Not a single messange printed on python console.
And nothing shown in postfix log
 
The lines in db.py are:
mail.settings.server = 'mail.mydomain.com:25'
mail.settings.sender = 'berna...@mydomain.com' # your email
mail.settings.login = 'berna...@mydomain.com:mypass'  # your
credentials or None
mail.settings.cipher_type = 'x509'
mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
mail.settings.x509_sign_certfile = 'url_to_postfix.cert'
 
Does anyone can figure out what is wrong with all of this?
 
thanks a lot for your time,
Bernardo
 
 



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

2010-12-01 Thread mdipierro
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í estem...@gmail.com wrote:
 It prints

 False

 Bernardo

 2010/12/1 mdipierro mdipie...@cs.depaul.edu

  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 estem...@gmail.com 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 mdipie...@cs.depaul.edu wrote:

try telnet mail.mydomain.com 25 and see if it is accepting remote
connections (by defau postfix does not).

Also I think

mail.settings.login = 'berna...@mydomain.com:mypass'

should be

mail.settings.login = 'berna...:mypass'

On Dec 1, 5:44 am, Bernardo estem...@gmail.com wrote:

 Dear all,

 I don't know if it is exactly a web2py issue or not. The fact is that
 I have a remote mail server, listening in port 25. It uses a self
 created certificate to allow connections from the outside (i.e. for
 thunderbird, you must accept that certificate in order to send
  mails).
 The problem is that when I try to send an email:

 mail.send(to='estem...@gmail.com',subject='Hello world
 subject',message='Hello world text')

 but nothing happens. Not a single messange printed on python console.
 And nothing shown in postfix log

 The lines in db.py are:
 mail.settings.server = 'mail.mydomain.com:25'
 mail.settings.sender = 'berna...@mydomain.com'         # your email
 mail.settings.login = 'berna...@mydomain.com:mypass'      # your
 credentials or None
 mail.settings.cipher_type = 'x509'
 mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
 mail.settings.x509_sign_certfile = 'url_to_postfix.cert'

 Does anyone can figure out what is wrong with all of this?

 thanks a lot for your time,
 Bernardo




Re: [web2py] Re: read boolean unselectable checkbox

2010-12-01 Thread Richard Vézina
Not sure it a issue.

I can do this :

db.table1.approved.represent=\
lambda value: value==True and 'Approved' or 'Not approved'

Richard

On Wed, Dec 1, 2010 at 10:59 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 Please submit a bug report about this on http://code.google.com/p/web2py/
 and I will take care of it asap.

 massimo

 On Dec 1, 9:17 am, Richard Vézina ml.richard.vez...@gmail.com wrote:
  Hello,
 
  How can I represent the boolean in crud.read form by an unselectable
  checkbox instead of True or False?
 
  Is it a job for the widget :
  SQLFORMhttp://web2py.com/book/default/docstring/SQLFORM
  .widgets.boolean.widget?
 
  Richard


Re: [web2py] Re: Scalability of web2py?

2010-12-01 Thread Branko Vukelic
Erlang is for humongous, real-time, distributed, and highly-available apps.

Here's an example (maybe quoted one time too often):

http://www.sics.se/~joe/apachevsyaws.html

On Wed, Dec 1, 2010 at 6:45 PM, John Heenan johnmhee...@gmail.com wrote:
 The elephant in the room has not gone away Massimo.

 Web2py is great for small projects.

 DotNet is great for small and large projects.

 The elephant in the room is not only the untested scalibility of
 web2py but also the amount of resources that neeeds to be thrown at
 web2py compared to DotNet and other frameworks as scale increases.

 One of the glaring defciences in web frameworks that use Python is the
 glaring engineering weakness of using thread per request web serving
 instead of using event per request web serving. I think I have pointed
 this out a number of times on this fourm, but it just does not sink
 in. I even pointed out how Linux loast a PR war over this issue.

 There is no need for Python based web frameworks to use thread per
 request web serving.

 John Heenan

 On Nov 30, 4:05 am, mdipierro mdipie...@cs.depaul.edu wrote:
 You achieve scalability by replicating the web server behind a load
 balancer. This is documented in the book, chapter 11, using HAProxy.
 All frameworks work the same way in this respect. web2py has no
 intrinsic limitations. The bottle neck is the database connection. All
 frameworks have the same problem. You can replicate the database too
 and web2py supports multiple database clients with Round-Robin.

 On a small VPS, web2py in average, should execute one page in 20ms.
 Depending on how many requests/second you need you can determine how
 many servers you need.

 web2py apps run on Google App Engine and that means arbitrary
 scalability as long as you can live with the constraints imposed by
 the Google datastore (these limitations will go away as soon as Google
 releases MySQL in the cloud, which they announced some time ago).

 Please ask the consultant: which .NET feature makes it scale any
 better than web2py or Rails? If he explains we can address it more
 specifically.

 Massimo

 On Nov 29, 11:56 am, Lorin Rivers lriv...@mosasaur.com wrote:

  The project I'm working on has hired a consultant who is now recommending 
  .Net in place of web2py or even rails.

  What's the 'largest' scale web2py is known to perform well on?

  --
  Lorin Rivers
  Mosasaur: Killer Technical Marketing http://www.mosasaur.com
  mailto:lriv...@mosasaur.com
  512/203.3198 (m)





-- 
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: Scalability of web2py?

2010-12-01 Thread Thadeus Burgess
Would that be the decision of the webserver? gevent uses a event-per-request
and it is written completely in python.

--
Thadeus




On Wed, Dec 1, 2010 at 11:45 AM, John Heenan johnmhee...@gmail.com wrote:

 The elephant in the room has not gone away Massimo.

 Web2py is great for small projects.

 DotNet is great for small and large projects.

 The elephant in the room is not only the untested scalibility of
 web2py but also the amount of resources that neeeds to be thrown at
 web2py compared to DotNet and other frameworks as scale increases.

 One of the glaring defciences in web frameworks that use Python is the
 glaring engineering weakness of using thread per request web serving
 instead of using event per request web serving. I think I have pointed
 this out a number of times on this fourm, but it just does not sink
 in. I even pointed out how Linux loast a PR war over this issue.

 There is no need for Python based web frameworks to use thread per
 request web serving.

 John Heenan

 On Nov 30, 4:05 am, mdipierro mdipie...@cs.depaul.edu wrote:
  You achieve scalability by replicating the web server behind a load
  balancer. This is documented in the book, chapter 11, using HAProxy.
  All frameworks work the same way in this respect. web2py has no
  intrinsic limitations. The bottle neck is the database connection. All
  frameworks have the same problem. You can replicate the database too
  and web2py supports multiple database clients with Round-Robin.
 
  On a small VPS, web2py in average, should execute one page in 20ms.
  Depending on how many requests/second you need you can determine how
  many servers you need.
 
  web2py apps run on Google App Engine and that means arbitrary
  scalability as long as you can live with the constraints imposed by
  the Google datastore (these limitations will go away as soon as Google
  releases MySQL in the cloud, which they announced some time ago).
 
  Please ask the consultant: which .NET feature makes it scale any
  better than web2py or Rails? If he explains we can address it more
  specifically.
 
  Massimo
 
  On Nov 29, 11:56 am, Lorin Rivers lriv...@mosasaur.com wrote:
 
   The project I'm working on has hired a consultant who is now
 recommending .Net in place of web2py or even rails.
 
   What's the 'largest' scale web2py is known to perform well on?
 
   --
   Lorin Rivers
   Mosasaur: Killer Technical Marketing http://www.mosasaur.com
   mailto:lriv...@mosasaur.com
   512/203.3198 (m)
 
 



Re: [web2py] Re: Scalability of web2py?

2010-12-01 Thread Branko Vukelic
On Wed, Dec 1, 2010 at 8:10 PM, Thadeus Burgess thade...@thadeusb.com wrote:
 Would that be the decision of the webserver? gevent uses a event-per-request
 and it is written completely in python.

Anyway, they didn't say ASP.NET. They just said .NET.

http://ironpython.net/

Run web2py on that, and wahoo!

-- 
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] Re: Scalability of web2py?

2010-12-01 Thread mr.freeze
I actually have run web2py on ironpython. It runs surprisingly well.
You have to remove references to signal, csv and logging modules but
Rocket actually runs. No GIL either! I'm experimenting with running
web2py on IIS with nwsgi (http://nwsgi.codeplex.com/). I would gladly
ditch ASP.NET for web2py.NET but the former is currently paying the
bills.


On Dec 1, 1:16 pm, Branko Vukelic bg.bra...@gmail.com wrote:
 On Wed, Dec 1, 2010 at 8:10 PM, Thadeus Burgess thade...@thadeusb.com wrote:
  Would that be the decision of the webserver? gevent uses a event-per-request
  and it is written completely in python.

 Anyway, they didn't say ASP.NET. They just said .NET.

 http://ironpython.net/

 Run web2py on that, and wahoo!

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


Re: [web2py] Re: Scalability of web2py?

2010-12-01 Thread Kuba Kucharski
Web2py is waiting for the first brave ONE to (be able to) GO and try
to SCALE. I believe this person will get a lot of attention and
resources from community and Massimo himself.

Real WORLD scalable implementations are VERY CUSTOM thing.

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

btw, they use apache.

My point is: let's focus on our killer products that will create good
enough tracking and attention to.. scale.


Re: [web2py] Re: Scalability of web2py?

2010-12-01 Thread Jorge Restrepo
Yes.
I second you on that, Kuba.


I also want to procede with a large scale app, but I am waiting...

On Wed, Dec 1, 2010 at 2:28 PM, Kuba Kucharski kuba.kuchar...@gmail.comwrote:

 Web2py is waiting for the first brave ONE to (be able to) GO and try
 to SCALE. I believe this person will get a lot of attention and
 resources from community and Massimo himself.

 Real WORLD scalable implementations are VERY CUSTOM thing.

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

 btw, they use apache.

 My point is: let's focus on our killer products that will create good
 enough tracking and attention to.. scale.



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

2010-12-01 Thread Bernardo
Ok Massimo,

I'll post if I find something.

thanks a lot!!
Bernardo

On 1 dic, 19:30, mdipierro mdipie...@cs.depaul.edu 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í estem...@gmail.com wrote:







  It prints

  False

  Bernardo

  2010/12/1 mdipierro mdipie...@cs.depaul.edu

   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 estem...@gmail.com 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 mdipie...@cs.depaul.edu wrote:

 try telnet mail.mydomain.com 25 and see if it is accepting remote
 connections (by defau postfix does not).

 Also I think

 mail.settings.login = 'berna...@mydomain.com:mypass'

 should be

 mail.settings.login = 'berna...:mypass'

 On Dec 1, 5:44 am, Bernardo estem...@gmail.com wrote:

  Dear all,

  I don't know if it is exactly a web2py issue or not. The fact is 
  that
  I have a remote mail server, listening in port 25. It uses a self
  created certificate to allow connections from the outside (i.e. for
  thunderbird, you must accept that certificate in order to send
   mails).
  The problem is that when I try to send an email:

  mail.send(to='estem...@gmail.com',subject='Hello world
  subject',message='Hello world text')

  but nothing happens. Not a single messange printed on python 
  console.
  And nothing shown in postfix log

  The lines in db.py are:
  mail.settings.server = 'mail.mydomain.com:25'
  mail.settings.sender = 'berna...@mydomain.com'         # your email
  mail.settings.login = 'berna...@mydomain.com:mypass'      # your
  credentials or None
  mail.settings.cipher_type = 'x509'
  mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
  mail.settings.x509_sign_certfile = 'url_to_postfix.cert'

  Does anyone can figure out what is wrong with all of this?

  thanks a lot for your time,
  Bernardo


[web2py] gae, lists and scaling

2010-12-01 Thread mattynoce
i'm using web2py on gae and creating a system that will incorporate
friending and a friend feed of sorts. earlier this year, i made
friends a list in the auth_user table, but upon watching brett
slatkin's talk on list properties (http://www.youtube.com/watch?
v=AgaL6NGpkB8), i got nervous because gae dereferences all lists every
time you access a record. i left the list as it was for now, but i
figure it's time to revisit.

there's a thread here:
http://groups.google.com/group/web2py/browse_thread/thread/58d0d754d354c90f/ed79a35ab1559862?hl=enlnk=gstq=gae+inherit#ed79a35ab1559862
that discusses child properties. but as it's stated, it seems that the
child property is pulled with the parent property, which means to me
that the dereferencing happens there too.

does anyone have enough experience with gae to know how this will work
at scale? if i have an auth_user record that has 500 friends, will i
be killing performance? if i have a feed table where each row has a
list of friends that row belongs to (enabling me to call
db(db.feed.friends.contains(userid)).select()), will that be
effective or absolutely kill it?

if anyone has done this other ways, i'd love to talk about it. i know
issues of gae many-to-manys have come up often, but i still don't feel
that there's a simple answer yet.

matt


[web2py] Re: Wizard + Plugin Wiki

2010-12-01 Thread JayShaffstall
 Look at this line  'editor' : auth.user and
 auth.has_membership(role='editor') or auth.user_id==1, # if current
 user a editor?

That was it...creating a simple application does not pre-populate
anything in the database, so the first user to register is
automatically an editor by virtue of having id==1.  Using the wizard
and populating the database generates a hundred sample users, so the
first real user to register is id 101, which fails the above check.

When I regenerated the app with the wizard but unchecked populate
tables, my first user was able to edit pages with the plugin wiki.

The right solution, of course, was to add the editor role to my user,
and not rely on the magic numbering of the id, but for just playing
around with it, not populating the data with the wizard was quicker.


Re: [web2py] Re: Scalability of web2py?

2010-12-01 Thread Marcello Parra
What is the largest application running web2py today?




On Wed, Dec 1, 2010 at 5:28 PM, Kuba Kucharski kuba.kuchar...@gmail.comwrote:

 Web2py is waiting for the first brave ONE to (be able to) GO and try
 to SCALE. I believe this person will get a lot of attention and
 resources from community and Massimo himself.

 Real WORLD scalable implementations are VERY CUSTOM thing.

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

 btw, they use apache.

 My point is: let's focus on our killer products that will create good
 enough tracking and attention to.. scale.



[web2py] Re: Scalability of web2py?

2010-12-01 Thread mdipierro
These are the apps we have knowledge of:

http://web2py.com/poweredby

I have no idea how popular they are.

Massimo

On Dec 1, 1:34 pm, Marcello Parra parro...@gmail.com wrote:
 What is the largest application running web2py today?

 On Wed, Dec 1, 2010 at 5:28 PM, Kuba Kucharski 
 kuba.kuchar...@gmail.comwrote:

  Web2py is waiting for the first brave ONE to (be able to) GO and try
  to SCALE. I believe this person will get a lot of attention and
  resources from community and Massimo himself.

  Real WORLD scalable implementations are VERY CUSTOM thing.

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

  btw, they use apache.

  My point is: let's focus on our killer products that will create good
  enough tracking and attention to.. scale.




Re: [web2py] Re: Scalability of web2py?

2010-12-01 Thread Michele Comitini
did anyone try to run web2py on this?

http://pypi.python.org/pypi/pastegevent/0.1


2010/12/1 Jorge Restrepo jorgeh...@gmail.com:
 Yes.
 I second you on that, Kuba.


 I also want to procede with a large scale app, but I am waiting...

 On Wed, Dec 1, 2010 at 2:28 PM, Kuba Kucharski kuba.kuchar...@gmail.com
 wrote:

 Web2py is waiting for the first brave ONE to (be able to) GO and try
 to SCALE. I believe this person will get a lot of attention and
 resources from community and Massimo himself.

 Real WORLD scalable implementations are VERY CUSTOM thing.

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

 btw, they use apache.

 My point is: let's focus on our killer products that will create good
 enough tracking and attention to.. scale.




[web2py] Re: Syntax for placeholders in executesql

2010-12-01 Thread Richard G
As I understand Web2py passes this off to the database adapter that is
in use (likely psycopg2 in this case).

Psycopg2 accepts arguments in a couple different forms, using the '%s'
as you identify below, as well as named references with '%(name)s'.

There are a few caveats when using query parameters that are specific
to psycopg2. More information (with better explanation then I can
provide) is available at:
http://initd.org/psycopg/docs/usage.html

Hope this helps

On Dec 1, 1:29 am, Chris partyonais...@gmail.com wrote:
 Hey all,

 I was trying to use executesql with placeholders, based on the
 documentation in source and the mailing list [1]. The syntax on the
 site seems to suggest using question marks, for example:

 db.executesql(select * from auth_user where id = ?, [4])

 I was banging my head against this for a while until I realized that
 the syntax that works is actually:

 db.executesql(select * from auth_user where id = %s, [4])

 (not sure if this is in postgres or everywhere in general.) Is this
 correct, and if so can it be added to the documentation?

 Thanks!

 [1]http://groups.google.com/group/web2py/browse_thread/thread/dd01da67ca...


Re: [web2py] Re: Scalability of web2py?

2010-12-01 Thread Michele Comitini
better yet: http://pypi.python.org/pypi/Spawning/

2010/12/1 Michele Comitini michele.comit...@gmail.com:
 did anyone try to run web2py on this?

 http://pypi.python.org/pypi/pastegevent/0.1


 2010/12/1 Jorge Restrepo jorgeh...@gmail.com:
 Yes.
 I second you on that, Kuba.


 I also want to procede with a large scale app, but I am waiting...

 On Wed, Dec 1, 2010 at 2:28 PM, Kuba Kucharski kuba.kuchar...@gmail.com
 wrote:

 Web2py is waiting for the first brave ONE to (be able to) GO and try
 to SCALE. I believe this person will get a lot of attention and
 resources from community and Massimo himself.

 Real WORLD scalable implementations are VERY CUSTOM thing.

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

 btw, they use apache.

 My point is: let's focus on our killer products that will create good
 enough tracking and attention to.. scale.





[web2py] PostgreSQL notifications with Psycopg2 and Eventlet

2010-12-01 Thread mdipierro
http://initd.org/psycopg/articles/2010/12/01/postgresql-notifications-psycopg2-eventlet/


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

2010-12-01 Thread Bernardo
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 estem...@gmail.com wrote:
 Ok Massimo,

 I'll post if I find something.

 thanks a lot!!
 Bernardo

 On 1 dic, 19:30, mdipierro mdipie...@cs.depaul.edu 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í estem...@gmail.com wrote:

   It prints

   False

   Bernardo

   2010/12/1 mdipierro mdipie...@cs.depaul.edu

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 estem...@gmail.com 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 mdipie...@cs.depaul.edu wrote:

  try telnet mail.mydomain.com 25 and see if it is accepting remote
  connections (by defau postfix does not).

  Also I think

  mail.settings.login = 'berna...@mydomain.com:mypass'

  should be

  mail.settings.login = 'berna...:mypass'

  On Dec 1, 5:44 am, Bernardo estem...@gmail.com wrote:

   Dear all,

   I don't know if it is exactly a web2py issue or not. The fact is 
   that
   I have a remote mail server, listening in port 25. It uses a self
   created certificate to allow connections from the outside (i.e. 
   for
   thunderbird, you must accept that certificate in order to send
mails).
   The problem is that when I try to send an email:

   mail.send(to='estem...@gmail.com',subject='Hello world
   subject',message='Hello world text')

   but nothing happens. Not a single messange printed on python 
   console.
   And nothing shown in postfix log

   The lines in db.py are:
   mail.settings.server = 'mail.mydomain.com:25'
   mail.settings.sender = 'berna...@mydomain.com'         # your 
   email
   mail.settings.login = 'berna...@mydomain.com:mypass'      # your
   credentials or None
   mail.settings.cipher_type = 'x509'
   mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
   mail.settings.x509_sign_certfile = 'url_to_postfix.cert'

   Does anyone can figure out what is wrong with all of this?

   thanks a lot for your time,
   Bernardo


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

2010-12-01 Thread mdipierro
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 estem...@gmail.com 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 estem...@gmail.com wrote:

  Ok Massimo,

  I'll post if I find something.

  thanks a lot!!
  Bernardo

  On 1 dic, 19:30, mdipierro mdipie...@cs.depaul.edu 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í estem...@gmail.com wrote:

It prints

False

Bernardo

2010/12/1 mdipierro mdipie...@cs.depaul.edu

 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 estem...@gmail.com 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 mdipie...@cs.depaul.edu wrote:

   try telnet mail.mydomain.com 25 and see if it is accepting remote
   connections (by defau postfix does not).

   Also I think

   mail.settings.login = 'berna...@mydomain.com:mypass'

   should be

   mail.settings.login = 'berna...:mypass'

   On Dec 1, 5:44 am, Bernardo estem...@gmail.com wrote:

Dear all,

I don't know if it is exactly a web2py issue or not. The fact 
is that
I have a remote mail server, listening in port 25. It uses a 
self
created certificate to allow connections from the outside (i.e. 
for
thunderbird, you must accept that certificate in order to send
 mails).
The problem is that when I try to send an email:

mail.send(to='estem...@gmail.com',subject='Hello world
subject',message='Hello world text')

but nothing happens. Not a single messange printed on python 
console.
And nothing shown in postfix log

The lines in db.py are:
mail.settings.server = 'mail.mydomain.com:25'
mail.settings.sender = 'berna...@mydomain.com'         # your 
email
mail.settings.login = 'berna...@mydomain.com:mypass'      # your
credentials or None
mail.settings.cipher_type = 'x509'
mail.settings.x509_sign_keyfile = 'url_to_postfix.key'
mail.settings.x509_sign_certfile = 'url_to_postfix.cert'

Does anyone can figure out what is wrong with all of this?

thanks a lot for your time,
Bernardo




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

2010-12-01 Thread Bernardo
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 mdipie...@cs.depaul.edu 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 estem...@gmail.com 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 estem...@gmail.com wrote:

   Ok Massimo,

   I'll post if I find something.

   thanks a lot!!
   Bernardo

   On 1 dic, 19:30, mdipierro mdipie...@cs.depaul.edu 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í estem...@gmail.com wrote:

 It prints

 False

 Bernardo

 2010/12/1 mdipierro mdipie...@cs.depaul.edu

  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 estem...@gmail.com 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 mdipie...@cs.depaul.edu wrote:

try telnet mail.mydomain.com 25 and see if it is accepting 
remote
connections (by defau postfix does not).

Also I think

mail.settings.login = 'berna...@mydomain.com:mypass'

should be

mail.settings.login = 'berna...:mypass'

On Dec 1, 5:44 am, Bernardo estem...@gmail.com wrote:

 Dear all,

 I don't know if it is exactly a web2py issue or not. The fact 
 is that
 I have a remote mail server, listening in port 25. It uses a 
 self
 created certificate to allow connections from the outside 
 (i.e. for
 thunderbird, you must accept that certificate in order to send
  mails).
 The problem is that when I try to send an email:

 mail.send(to='estem...@gmail.com',subject='Hello world
 subject',message='Hello world text')

 but 

[web2py] amfrpc problem

2010-12-01 Thread dustin.b
hi,
im stuck in getting flash to work with (web2py) amfrpc. i must confess
that i am very limited in my flash knowledge so far.

i tryed the sample from the book and getting into import problems. i
think this is related to the flash version. im using flash cs5 and
flashdevelop .. with as3.

i installed pyamf so there is no missing lib warning if i invoke the
call/amfrpc (3) ; and running w2p from source. im a little confused
with the libs an the flash/flex side ... the only version i found
which is not causing import errors is the following


public class Main extends MovieClip
{

public function Main() {

var gateway:NetConnection = new NetConnection();
gateway.addEventListener(NetStatusEvent.NET_STATUS  ,
gateway_status);

gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/
call/amfrpc/);
var resp:Responder = new Responder(show_results, 
on_fault);
gateway.call(service1, resp);

trace(main started);
stage.stageWidth = 100;
stage.stageHeight = 100;

var textlabel:TextField = new TextField();
textlabel.x = (stage.stageWidth - textlabel.width) / 2;
textlabel.y = (stage.stageHeight - textlabel.height) / 
2;

textlabel.text = flex hello wold!;

addChild(textlabel);
}

private function gateway_status(event:NetStatusEvent):void {

trace(Level 0: +event.info.level+ Code: 
+event.info.code);
   if (event.info.code == NetConnection.Connect.Success) {
  trace(--- connected to:  + hier);
   }
}

private function show_results(event:ResultEvent):void
{
trace(event.result.toString());
}

private function on_fault(event:FaultEvent):void
{
trace(event.fault.message);
}


}

}


on w2p side there is

@service.amfrpc
def service1():
return test

in the default controller.

every time i try to connect i get a Level 0: error Code:
NetConnection.Call.Failed
 from my gateway_status handler

what am i doing wrong?


[web2py] Re: Scalability of web2py?

2010-12-01 Thread ctalley
Nowhere in this thread is the word risk used.  Bottom line, there's
probably a reluctance to bet on web2py when it's not a known quantity
in an application with the stated demands.  Most people are risk
adverse because they don't want to get beat about the head and
shoulders if something turns out not to work.  At least with .Net one
can always claim that it's used successfully in large scale systems.
Massimo's suggestion to quickly and cheaply build and test a prototype
is the best idea.  Then if it works, it works.  You're dealing with
facts and not theory.


On Nov 29, 12:56 pm, Lorin Rivers lriv...@mosasaur.com wrote:
 The project I'm working on has hired a consultant who is now recommending 
 .Net in place of web2py or even rails.

 What's the 'largest' scale web2py is known to perform well on?

 --
 Lorin Rivers
 Mosasaur: Killer Technical Marketing http://www.mosasaur.com
 mailto:lriv...@mosasaur.com512/203.3198(m)


[web2py] Re: amfrpc problem

2010-12-01 Thread mdipierro
Try use amf3

@service.amfrpc3('domain')
def service1():
return test

and

gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/call/
amfrpc3/);

gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/
call/amfrpc/);
On Dec 1, 4:55 pm, dustin.b dustin.bens...@googlemail.com wrote:
 hi,
 im stuck in getting flash to work with (web2py) amfrpc. i must confess
 that i am very limited in my flash knowledge so far.

 i tryed the sample from the book and getting into import problems. i
 think this is related to the flash version. im using flash cs5 and
 flashdevelop .. with as3.

 i installed pyamf so there is no missing lib warning if i invoke the
 call/amfrpc (3) ; and running w2p from source. im a little confused
 with the libs an the flash/flex side ... the only version i found
 which is not causing import errors is the following

 public class Main extends MovieClip
         {

                 public function Main() {

                         var gateway:NetConnection = new NetConnection();
                         gateway.addEventListener(NetStatusEvent.NET_STATUS  ,
 gateway_status);
                         
 gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/
 call/amfrpc/);
                         var resp:Responder = new Responder(show_results, 
 on_fault);
                         gateway.call(service1, resp);

                         trace(main started);
                         stage.stageWidth = 100;
                         stage.stageHeight = 100;

                         var textlabel:TextField = new TextField();
                         textlabel.x = (stage.stageWidth - textlabel.width) / 
 2;
                         textlabel.y = (stage.stageHeight - textlabel.height) 
 / 2;

                         textlabel.text = flex hello wold!;

                         addChild(textlabel);
                 }

                 private function gateway_status(event:NetStatusEvent):void {

                         trace(Level 0: +event.info.level+ Code: 
 +event.info.code);
                    if (event.info.code == NetConnection.Connect.Success) {
                           trace(--- connected to:  + hier);
                    }
                 }

                 private function show_results(event:ResultEvent):void
                 {
                         trace(event.result.toString());
                 }

                 private function on_fault(event:FaultEvent):void
                 {
                         trace(event.fault.message);
                 }

         }

 }

 on w2p side there is

 @service.amfrpc
 def service1():
     return test

 in the default controller.

 every time i try to connect i get a Level 0: error Code:
 NetConnection.Call.Failed
  from my gateway_status handler

 what am i doing wrong?


[web2py] Re: amfrpc problem

2010-12-01 Thread dustin.b
thx for the quick answer!

on the clintside i have the same error message. i forgot to mention
the w2p ticket

with amfrpc:
Traceback (most recent call last):
  File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
\restricted.py, line 188, in restricted
exec ccode in environment
  File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
FlashSoldat_Server/controllers/default.py, line 63, in module
  File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
\globals.py, line 96, in lambda
self._caller = lambda f: f()
  File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
FlashSoldat_Server/controllers/default.py, line 61, in call
return service()
  File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py,
line 3647, in __call__
return self.serve_amfrpc()
  File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py,
line 3520, in serve_amfrpc
context = pyamf.get_context(pyamf.AMF0)
AttributeError: 'module' object has no attribute 'get_context'

amfrpc3:
Traceback (most recent call last):
  File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
\restricted.py, line 188, in restricted
exec ccode in environment
  File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
FlashSoldat_Server/controllers/default.py, line 63, in module
  File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
\globals.py, line 96, in lambda
self._caller = lambda f: f()
  File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
FlashSoldat_Server/controllers/default.py, line 61, in call
return service()
  File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py,
line 3649, in __call__
return self.serve_amfrpc(3)
  File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py,
line 3523, in serve_amfrpc
pyamf_request.clientType)
AttributeError: 'Envelope' object has no attribute 'clientType'


last but not least, what is the meaning of 'domain' in
@service.amfrpc3('domain') in contrast to the one with amfrpc, i
thought its some kind of renaming the function.

On 2 Dez., 00:15, mdipierro mdipie...@cs.depaul.edu wrote:
 Try use amf3

 @service.amfrpc3('domain')
 def service1():
     return test

 and

 gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/call/
 amfrpc3/);

 gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/
 call/amfrpc/);
 On Dec 1, 4:55 pm, dustin.b dustin.bens...@googlemail.com wrote:







  hi,
  im stuck in getting flash to work with (web2py) amfrpc. i must confess
  that i am very limited in my flash knowledge so far.

  i tryed the sample from the book and getting into import problems. i
  think this is related to the flash version. im using flash cs5 and
  flashdevelop .. with as3.

  i installed pyamf so there is no missing lib warning if i invoke the
  call/amfrpc (3) ; and running w2p from source. im a little confused
  with the libs an the flash/flex side ... the only version i found
  which is not causing import errors is the following

  public class Main extends MovieClip
          {

                  public function Main() {

                          var gateway:NetConnection = new NetConnection();
                          gateway.addEventListener(NetStatusEvent.NET_STATUS  
  ,
  gateway_status);
                          
  gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/
  call/amfrpc/);
                          var resp:Responder = new Responder(show_results, 
  on_fault);
                          gateway.call(service1, resp);

                          trace(main started);
                          stage.stageWidth = 100;
                          stage.stageHeight = 100;

                          var textlabel:TextField = new TextField();
                          textlabel.x = (stage.stageWidth - textlabel.width) 
  / 2;
                          textlabel.y = (stage.stageHeight - 
  textlabel.height) / 2;

                          textlabel.text = flex hello wold!;

                          addChild(textlabel);
                  }

                  private function gateway_status(event:NetStatusEvent):void {

                          trace(Level 0: +event.info.level+ Code: 
  +event.info.code);
                     if (event.info.code == NetConnection.Connect.Success) {
                            trace(--- connected to:  + hier);
                     }
                  }

                  private function show_results(event:ResultEvent):void
                  {
                          trace(event.result.toString());
                  }

                  private function on_fault(event:FaultEvent):void
                  {
                          trace(event.fault.message);
                  }

          }

  }

  on w2p side there is

  @service.amfrpc
  def service1():
      return test

  in the default controller.

  every time i try to connect i get a Level 0: error Code:
  NetConnection.Call.Failed
   from my 

[web2py] Re: amfrpc problem

2010-12-01 Thread mdipierro
The domain must be specified in the flash app.

http://www.web2pyslices.com/main/slices/take_slice/72

I am not a flash expert myself anyway. Perhaps other people here can
help more.

Massimo

On Dec 1, 5:25 pm, dustin.b dustin.bens...@googlemail.com wrote:
 thx for the quick answer!

 on the clintside i have the same error message. i forgot to mention
 the w2p ticket

 with amfrpc:
 Traceback (most recent call last):
   File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
 \restricted.py, line 188, in restricted
     exec ccode in environment
   File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
 FlashSoldat_Server/controllers/default.py, line 63, in module
   File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
 \globals.py, line 96, in lambda
     self._caller = lambda f: f()
   File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
 FlashSoldat_Server/controllers/default.py, line 61, in call
     return service()
   File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py,
 line 3647, in __call__
     return self.serve_amfrpc()
   File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py,
 line 3520, in serve_amfrpc
     context = pyamf.get_context(pyamf.AMF0)
 AttributeError: 'module' object has no attribute 'get_context'

 amfrpc3:
 Traceback (most recent call last):
   File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
 \restricted.py, line 188, in restricted
     exec ccode in environment
   File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
 FlashSoldat_Server/controllers/default.py, line 63, in module
   File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon
 \globals.py, line 96, in lambda
     self._caller = lambda f: f()
   File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/
 FlashSoldat_Server/controllers/default.py, line 61, in call
     return service()
   File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py,
 line 3649, in __call__
     return self.serve_amfrpc(3)
   File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py,
 line 3523, in serve_amfrpc
     pyamf_request.clientType)
 AttributeError: 'Envelope' object has no attribute 'clientType'

 last but not least, what is the meaning of 'domain' in
 @service.amfrpc3('domain') in contrast to the one with amfrpc, i
 thought its some kind of renaming the function.

 On 2 Dez., 00:15, mdipierro mdipie...@cs.depaul.edu wrote:

  Try use amf3

  @service.amfrpc3('domain')
  def service1():
      return test

  and

  gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/call/
  amfrpc3/);

  gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/
  call/amfrpc/);
  On Dec 1, 4:55 pm, dustin.b dustin.bens...@googlemail.com wrote:

   hi,
   im stuck in getting flash to work with (web2py) amfrpc. i must confess
   that i am very limited in my flash knowledge so far.

   i tryed the sample from the book and getting into import problems. i
   think this is related to the flash version. im using flash cs5 and
   flashdevelop .. with as3.

   i installed pyamf so there is no missing lib warning if i invoke the
   call/amfrpc (3) ; and running w2p from source. im a little confused
   with the libs an the flash/flex side ... the only version i found
   which is not causing import errors is the following

   public class Main extends MovieClip
           {

                   public function Main() {

                           var gateway:NetConnection = new NetConnection();
                           
   gateway.addEventListener(NetStatusEvent.NET_STATUS  ,
   gateway_status);
                           
   gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/
   call/amfrpc/);
                           var resp:Responder = new Responder(show_results, 
   on_fault);
                           gateway.call(service1, resp);

                           trace(main started);
                           stage.stageWidth = 100;
                           stage.stageHeight = 100;

                           var textlabel:TextField = new TextField();
                           textlabel.x = (stage.stageWidth - 
   textlabel.width) / 2;
                           textlabel.y = (stage.stageHeight - 
   textlabel.height) / 2;

                           textlabel.text = flex hello wold!;

                           addChild(textlabel);
                   }

                   private function 
   gateway_status(event:NetStatusEvent):void {

                           trace(Level 0: +event.info.level+ Code: 
   +event.info.code);
                      if (event.info.code == 
   NetConnection.Connect.Success) {
                             trace(--- connected to:  + hier);
                      }
                   }

                   private function show_results(event:ResultEvent):void
                   {
                           trace(event.result.toString());
                   }

                   private function 

[web2py] convert a string to a table or field?

2010-12-01 Thread Lorin Rivers
I tried making a generic function that created a table variable by 
concatenating strings.

myTable = tableBuilder('inverter',period=5)

def tableBuilder(element,period=0):
  if element == 'inverter':
if period = 0:
  return 'db4.' + 'arraydata_table'
elif period = 1:
  return 'db4.array_mins'
else:
  return 'db4.array_' + period + 'mins'

That results in a syntax error. Can I do this or do I have to consider every 
elif? Like this:
  elif element == 'arrays':
if period = 0:
  return db4.arraydata_table
elif period = 1:
  return db4.array_mins
elif period = 5:
  return db4.array_5mins



-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing http://www.mosasaur.com
mailto:lriv...@mosasaur.com
512/203.3198 (m)




Re: [web2py] convert a string to a table or field?

2010-12-01 Thread Branko Vukelic
On Thu, Dec 2, 2010 at 1:11 AM, Lorin Rivers lriv...@mosasaur.com wrote:
 I tried making a generic function that created a table variable by 
 concatenating strings.

 myTable = tableBuilder('inverter',period=5)

 def tableBuilder(element,period=0):
  if element == 'inverter':
    if period = 0:

if period == 0:

with a double equals char.

-- 
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] convert a string to a table or field?

2010-12-01 Thread Branko Vukelic
On Thu, Dec 2, 2010 at 1:11 AM, Lorin Rivers lriv...@mosasaur.com wrote:
 I tried making a generic function that created a table variable by 
 concatenating strings.

 myTable = tableBuilder('inverter',period=5)

 def tableBuilder(element,period=0):
  if element == 'inverter':
    if period = 0:
      return 'db4.' + 'arraydata_table'
    elif period = 1:
      return 'db4.array_mins'
    else:
      return 'db4.array_' + period + 'mins'

def table_builder(e, p):
if e == 'inverter':
t = 'db4.'
if p == 0:
t += 'arraydata_table'
elif p == 1:
t += 'array_mins'
else:
t += '%smins' % period
return t

It's not a big improvement, but it's a bit nicer, I think. Plus you
don't repeat 'db4.' three times inviting typos.

-- 
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] convert a string to a table or field?

2010-12-01 Thread Stef Mientki
On 02-12-2010 01:11, Lorin Rivers wrote:
 I tried making a generic function that created a table variable by 
 concatenating strings.

 myTable = tableBuilder('inverter',period=5)

 def tableBuilder(element,period=0):
   if element == 'inverter':
 if period = 0:
   return 'db4.' + 'arraydata_table'
that doesn't return a table variable, but a string,
so maybe you want
  return eval ( 'db4' + 'arraydata_table')

cheers,
Stef
 elif period = 1:
   return 'db4.array_mins'
 else:
   return 'db4.array_' + period + 'mins'

 That results in a syntax error. Can I do this or do I have to consider every 
 elif? Like this:
   elif element == 'arrays':
 if period = 0:
   return db4.arraydata_table
 elif period = 1:
   return db4.array_mins
 elif period = 5:
   return db4.array_5mins






Re: [web2py] convert a string to a table or field?

2010-12-01 Thread Branko Vukelic
On Thu, Dec 2, 2010 at 1:23 AM, Stef Mientki stef.mien...@gmail.com wrote:
 that doesn't return a table variable, but a string,
 so maybe you want
  return eval ( 'db4' + 'arraydata_table')

Don't use eval. It's evil! :)

'db4' doesn't have to be a string. I think you can access the tables
using subscript notation:

db4['tablename']

Here's the code I posted earlier with modifications:

def table_builder(e, p):
   if e == 'inverter':
   if p == 0:
   t = 'arraydata_table'
   elif p == 1:
   t = 'array_mins'
   else:
   t = '%smins' % period
   return db4[t]

-- 
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] Re: Scalability of web2py?

2010-12-01 Thread John Heenan
The OP asked What's the 'largest' scale web2py is known to perform
well on? 

Massimo evaded the question and no one else has provided an answer.

The core of Erlang is very simple. Erland does no

On Dec 2, 5:09 am, Branko Vukelic bg.bra...@gmail.com wrote:
 Erlang is for humongous, real-time, distributed, and highly-available apps.

 Here's an example (maybe quoted one time too often):

 http://www.sics.se/~joe/apachevsyaws.html



 On Wed, Dec 1, 2010 at 6:45 PM, John Heenan johnmhee...@gmail.com wrote:
  The elephant in the room has not gone away Massimo.

  Web2py is great for small projects.

  DotNet is great for small and large projects.

  The elephant in the room is not only the untested scalibility of
  web2py but also the amount of resources that neeeds to be thrown at
  web2py compared to DotNet and other frameworks as scale increases.

  One of the glaring defciences in web frameworks that use Python is the
  glaring engineering weakness of using thread per request web serving
  instead of using event per request web serving. I think I have pointed
  this out a number of times on this fourm, but it just does not sink
  in. I even pointed out how Linux loast a PR war over this issue.

  There is no need for Python based web frameworks to use thread per
  request web serving.

  John Heenan

  On Nov 30, 4:05 am, mdipierro mdipie...@cs.depaul.edu wrote:
  You achieve scalability by replicating the web server behind a load
  balancer. This is documented in the book, chapter 11, using HAProxy.
  All frameworks work the same way in this respect. web2py has no
  intrinsic limitations. The bottle neck is the database connection. All
  frameworks have the same problem. You can replicate the database too
  and web2py supports multiple database clients with Round-Robin.

  On a small VPS, web2py in average, should execute one page in 20ms.
  Depending on how many requests/second you need you can determine how
  many servers you need.

  web2py apps run on Google App Engine and that means arbitrary
  scalability as long as you can live with the constraints imposed by
  the Google datastore (these limitations will go away as soon as Google
  releases MySQL in the cloud, which they announced some time ago).

  Please ask the consultant: which .NET feature makes it scale any
  better than web2py or Rails? If he explains we can address it more
  specifically.

  Massimo

  On Nov 29, 11:56 am, Lorin Rivers lriv...@mosasaur.com wrote:

   The project I'm working on has hired a consultant who is now 
   recommending .Net in place of web2py or even rails.

   What's the 'largest' scale web2py is known to perform well on?

   --
   Lorin Rivers
   Mosasaur: Killer Technical Marketing http://www.mosasaur.com
   mailto:lriv...@mosasaur.com
   512/203.3198 (m)

 --
 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: convert a string to a table or field?

2010-12-01 Thread mart
table is a table object and not a string... here's an example.
creating the table is easy enough, but referencing is different...


# VARS
tlist = ['martP4Sync',
 'coreP4Sync',
 'testP4Sync']


# MAKE TABLES
for t in tlist:
db.define_table('{0}'.format(t),
Field('name'),
Field('value'))
db.commit()


# DO STUFF (insert, update, select,)
for pTable in db.tables:
if 'P4Sync' in pTable:
if pTable.startswith('martP4'):
db(db[pTable].insert(name='myname1',value='myvalue1'))
 
db(db[pTable].insert(name='myname2',value='myvalue2'))
db.commit()


Hope it helps,
Mart :)


On Dec 1, 7:30 pm, Branko Vukelic bg.bra...@gmail.com wrote:
 On Thu, Dec 2, 2010 at 1:23 AM, Stef Mientki stef.mien...@gmail.com wrote:
  that doesn't return a table variable, but a string,
  so maybe you want
   return eval ( 'db4' + 'arraydata_table')

 Don't use eval. It's evil! :)

 'db4' doesn't have to be a string. I think you can access the tables
 using subscript notation:

 db4['tablename']

 Here's the code I posted earlier with modifications:

 def table_builder(e, p):
    if e == 'inverter':
        if p == 0:
            t = 'arraydata_table'
        elif p == 1:
            t = 'array_mins'
        else:
            t = '%smins' % period
    return db4[t]

 --
 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: Scalability of web2py?

2010-12-01 Thread mdipierro
The fact is that there is not one number to measure scalability.
There are many parameters like:
number of requests/second (average)
number of requests/second (peak)
complexity of those requests/second (static pages, dynamic pages,
types of db queries, do they use caching).
number of servers used.
type of database used.
Is the database replicated? (how many clients? how many servers?).

I stand by my comment that it does not matter which framework you use.
It matters how the database is accessed and designed. If the db
scales, but the app is slow, you can replicate web2py (and the web
server) as much as you want.

I know there are users here who have web2py behind a load balancer (if
you do please let us know so the information is public).

There are frameworks (microframeworks) that are more lightweight than
web2py because they do less. That means on a single machine (without
replicating the db not the web serve) for simple apps that do not need
the extra web2py stuff, they will be faster and therefore hey will be
able to serve more pages/second before they start to fail. I am not
sure this is the case for apps that need session, authentication, etc.

web2py introduces a penalty when you have lots of tables and there are
some optimizations that need to be done in that case.

There are some tricks to speed-up web2py which are important to scale
it:

- Even if your app does not run on GAE, create an empty APP on GAE and
use it to server ALL the static files. Use your server only for
dynamic HTML pages.
- set migrate=False
- do not use {{import ...}} too much, use {{block}} if necessary.
- remove un-necessary {{...}} from the layout
- move as much code from models to modules and/or controllers
- make many small controllers as opposed to one large one
- bytecode compile the app
- cache as many selects as possible in ram.
- use sticky session in the load balancer
- use Field(...,'upload',uploadseparate=True)
- use session.connect(request,response,separate=True)
- try separate a complex app into smaller modular apps that share a
central authentication service.
- run a background process that clears expires sessions
- run a background process for time consuming tasks such as sending
emails



Massimo




On Dec 1, 6:54 pm, John Heenan johnmhee...@gmail.com wrote:
 The OP asked What's the 'largest' scale web2py is known to perform
 well on? 

 Massimo evaded the question and no one else has provided an answer.

 The core of Erlang is very simple. Erland does no

 On Dec 2, 5:09 am, Branko Vukelic bg.bra...@gmail.com wrote:

  Erlang is for humongous, real-time, distributed, and highly-available apps.

  Here's an example (maybe quoted one time too often):

 http://www.sics.se/~joe/apachevsyaws.html

  On Wed, Dec 1, 2010 at 6:45 PM, John Heenan johnmhee...@gmail.com wrote:
   The elephant in the room has not gone away Massimo.

   Web2py is great for small projects.

   DotNet is great for small and large projects.

   The elephant in the room is not only the untested scalibility of
   web2py but also the amount of resources that neeeds to be thrown at
   web2py compared to DotNet and other frameworks as scale increases.

   One of the glaring defciences in web frameworks that use Python is the
   glaring engineering weakness of using thread per request web serving
   instead of using event per request web serving. I think I have pointed
   this out a number of times on this fourm, but it just does not sink
   in. I even pointed out how Linux loast a PR war over this issue.

   There is no need for Python based web frameworks to use thread per
   request web serving.

   John Heenan

   On Nov 30, 4:05 am, mdipierro mdipie...@cs.depaul.edu wrote:
   You achieve scalability by replicating the web server behind a load
   balancer. This is documented in the book, chapter 11, using HAProxy.
   All frameworks work the same way in this respect. web2py has no
   intrinsic limitations. The bottle neck is the database connection. All
   frameworks have the same problem. You can replicate the database too
   and web2py supports multiple database clients with Round-Robin.

   On a small VPS, web2py in average, should execute one page in 20ms.
   Depending on how many requests/second you need you can determine how
   many servers you need.

   web2py apps run on Google App Engine and that means arbitrary
   scalability as long as you can live with the constraints imposed by
   the Google datastore (these limitations will go away as soon as Google
   releases MySQL in the cloud, which they announced some time ago).

   Please ask the consultant: which .NET feature makes it scale any
   better than web2py or Rails? If he explains we can address it more
   specifically.

   Massimo

   On Nov 29, 11:56 am, Lorin Rivers lriv...@mosasaur.com wrote:

The project I'm working on has hired a consultant who is now 
recommending .Net in place of web2py or even rails.

What's the 'largest' scale web2py is known to perform 

Re: [web2py] Re: Scalability of web2py?

2010-12-01 Thread Marcello Parra
Massimo,

Any doc/reference about this?

Thanks

On Wed, Dec 1, 2010 at 11:20 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 web2py introduces a penalty when you have lots of tables and there are
 some optimizations that need to be done in that case.




[web2py] Re: Scalability of web2py?

2010-12-01 Thread John Heenan
The OP, Lorin, asked What's the 'largest' scale web2py is known to
perform well on? 

Massimo evaded the question and no one else has provided an answer.
Hence the elephant  in the room has been ignored.

Web2py is designed to use an  OS 'thread per web' request as Web2py is
built on a WGSI infrastructure. 'Thread per request' web serving is an
approach that has been conclusively proven to scale very badly
compared to using events or message queues (such as Erlang). Even when
Web2py does not get its request through a thread, Web2py forces
requests into a thread in order to use the WGSI infrastructure, such
as requests passed through a single UNIX socket from Lightttpd.

As an aside, the core of Erlang is very simple. Erlang uses message
queues to simulate multiple processing. That is it. This is different
from using events because each so called 'process' in Erlang pumps or
'processes' its own message queue in its own time. In fact Ericsson,
the original sponsor of Erlang, at one stage dropped using Erlang in
favour of porting the Erlang approach to other languages.

There are other web2py 'elephants in the room', such as the dependence
and direction of web2py on the enormous talents of a single
individual: Massimo. As an example of just how big an issue this is,
The Linux Foundation compiles surveys that points out just how minor
the role of Linus Torvaldis is in both writing kernel code and and in
committing code and also just how much code comes from corporations as
opposed to what might be called lone geeks (called consultants in
surveys). I think Linus has even dropped out of the top 30 individual
contributors for writing kernel code. The message is very clear. If
Linus suddenly decides he has had enough or wants to wind down,
'offcial' Linux continues on.

A professional approach requires hard fact and a serious approach to
legitimate issues that at the very least acknowledges legitimate
issues and avoids propaganda. Hard facts requires real world tests,
not evasion, defensive speculation and evangelism.

John Heenan



On Dec 2, 5:09 am, Branko Vukelic bg.bra...@gmail.com wrote:

 Erlang is for humongous, real-time, distributed, and highly-available apps.

 Here's an example (maybe quoted one time too often):

 http://www.sics.se/~joe/apachevsyaws.html

 On Wed, Dec 1, 2010 at 6:45 PM, John Heenan johnmhee...@gmail.com wrote:
  The elephant in the room has not gone away Massimo.

  Web2py is great for small projects.

  DotNet is great for small and large projects.

  The elephant in the room is not only the untested scalibility of
  web2py but also the amount of resources that neeeds to be thrown at
  web2py compared to DotNet and other frameworks as scale increases.

  One of the glaring defciences in web frameworks that use Python is the
  glaring engineering weakness of using thread per request web serving
  instead of using event per request web serving. I think I have pointed
  this out a number of times on this fourm, but it just does not sink
  in. I even pointed out how Linux loast a PR war over this issue.

  There is no need for Python based web frameworks to use thread per
  request web serving.

  John Heenan

  On Nov 30, 4:05 am, mdipierro mdipie...@cs.depaul.edu wrote:
  You achieve scalability by replicating the web server behind a load
  balancer. This is documented in the book, chapter 11, using HAProxy.
  All frameworks work the same way in this respect. web2py has no
  intrinsic limitations. The bottle neck is the database connection. All
  frameworks have the same problem. You can replicate the database too
  and web2py supports multiple database clients with Round-Robin.

  On a small VPS, web2py in average, should execute one page in 20ms.
  Depending on how many requests/second you need you can determine how
  many servers you need.

  web2py apps run on Google App Engine and that means arbitrary
  scalability as long as you can live with the constraints imposed by
  the Google datastore (these limitations will go away as soon as Google
  releases MySQL in the cloud, which they announced some time ago).

  Please ask the consultant: which .NET feature makes it scale any
  better than web2py or Rails? If he explains we can address it more
  specifically.

  Massimo

  On Nov 29, 11:56 am, Lorin Rivers lriv...@mosasaur.com wrote:

   The project I'm working on has hired a consultant who is now 
   recommending .Net in place of web2py or even rails.

   What's the 'largest' scale web2py is known to perform well on?

   --
   Lorin Rivers
   Mosasaur: Killer Technical Marketing http://www.mosasaur.com
   mailto:lriv...@mosasaur.com
   512/203.3198 (m)




[web2py] Re: Scalability of web2py?

2010-12-01 Thread mdipierro
Some of them are discussed here:

http://web2py.com/book/default/chapter/11#Efficiency-and-Scalability

Some are new features like:
session.connect(request,response,separate=True)

This was proposed by author of http://www.zhjtjyw.com/ which is made
with web2py and seems to have lots of users. So many that too many
session files/hour in one folder would slow down the file system.
Unfortunately I do not have statistics.




On Dec 1, 7:28 pm, Marcello Parra parro...@gmail.com wrote:
 Massimo,

 Any doc/reference about this?

 Thanks

 On Wed, Dec 1, 2010 at 11:20 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  web2py introduces a penalty when you have lots of tables and there are
  some optimizations that need to be done in that case.




[web2py] Re: Syntax for placeholders in executesql

2010-12-01 Thread Brian M
Yes, web2py's executesql when used with placeholders will simply pass
the provided query  placeholders on to execute() method of whichever
database driver is being used, thus you must use a syntax supported by
your driver. In the case of SQLite  MS SQL that syntax is question
marks (?) for Postgres it is apparently %s or %(name)s and I think
MySQL is the same (I haven't tried yet).

~Brian

On Dec 1, 2:29 pm, Richard G richard.ga...@gmail.com wrote:
 As I understand Web2py passes this off to the database adapter that is
 in use (likely psycopg2 in this case).

 Psycopg2 accepts arguments in a couple different forms, using the '%s'
 as you identify below, as well as named references with '%(name)s'.

 There are a few caveats when using query parameters that are specific
 to psycopg2. More information (with better explanation then I can
 provide) is available at:http://initd.org/psycopg/docs/usage.html

 Hope this helps

 On Dec 1, 1:29 am, Chris partyonais...@gmail.com wrote:







  Hey all,

  I was trying to use executesql with placeholders, based on the
  documentation in source and the mailing list [1]. The syntax on the
  site seems to suggest using question marks, for example:

  db.executesql(select * from auth_user where id = ?, [4])

  I was banging my head against this for a while until I realized that
  the syntax that works is actually:

  db.executesql(select * from auth_user where id = %s, [4])

  (not sure if this is in postgres or everywhere in general.) Is this
  correct, and if so can it be added to the documentation?

  Thanks!

  [1]http://groups.google.com/group/web2py/browse_thread/thread/dd01da67ca...


[web2py] Re: Best way to edit SQLFORM input before passing to accepts?

2010-12-01 Thread DenesL
your_model.py:

db.define_table('moment',
  Field('textarea','text'),
  Field('txttype', readable=False, writable=False),
  ...
)

default.py:

def moment_type(form):
  form.vars.txttype=...

def submit_moment():
  form=SQLFORM(db.moment)
  if form accepts(request.vars, session, onvalidation=moment_type):
response.flash = 'form accepted'
  elif form.errors:
...
  return dict(form=form, ...)

views/default/submit_moment.html:

{{extend 'layout.html'}}
{{=form}}


On Dec 1, 11:47 am, hswolff hswo...@gmail.com wrote:
 I'll try the model implementation.  I need to be able to parse the
 submit content and count the frequency a word appears and set the type
 accordingly.

 I'm using response.moment_form because when I had it in the index()
 function and I would go to the user page it wouldn't render because
 the dict wouldn't return the form that was displayed on views/
 layout.html.

 Correct me if I'm wrong:  if I were to make a submit_moment():
 function and a views/default/submit_moment.html view I would be able
 to include the view on every page and have it be functionally
 accurate, right?

 I'm still getting the hang of web2py's MVC.



[web2py] Re: Scalability of web2py?

2010-12-01 Thread John Heenan
With regard to comments below about elephants in the Web2py room, such
as vulnerability to individuals with comment Linus is being downplayed
by the LF (Linux foundation), following is a quote from
http://www.desktoplinux.com/news/NS7450801259.html in section 'Top
Linux Contributors' with regard to a 2008 study.

Linus Torvalds, meanwhile, has fallen off the top 30 list, says the
LF. However, the study notes that the original Linux developer is
still a major contributor. It also notes that the list does not
include merge commits, when one set of changes is merged into
another, where Torvalds is said to play a key role. In addition, the
growing acceleration of kernel development has increased the time
Torvalds spends reviewing other kernel changes.

John Heenan

On Dec 2, 11:39 am, John Heenan johnmhee...@gmail.com wrote:
 The OP, Lorin, asked What's the 'largest' scale web2py is known to
 perform well on? 

 Massimo evaded the question and no one else has provided an answer.
 Hence the elephant  in the room has been ignored.

 Web2py is designed to use an  OS 'thread per web' request as Web2py is
 built on a WGSI infrastructure. 'Thread per request' web serving is an
 approach that has been conclusively proven to scale very badly
 compared to using events or message queues (such as Erlang). Even when
 Web2py does not get its request through a thread, Web2py forces
 requests into a thread in order to use the WGSI infrastructure, such
 as requests passed through a single UNIX socket from Lightttpd.

 As an aside, the core of Erlang is very simple. Erlang uses message
 queues to simulate multiple processing. That is it. This is different
 from using events because each so called 'process' in Erlang pumps or
 'processes' its own message queue in its own time. In fact Ericsson,
 the original sponsor of Erlang, at one stage dropped using Erlang in
 favour of porting the Erlang approach to other languages.

 There are other web2py 'elephants in the room', such as the dependence
 and direction of web2py on the enormous talents of a single
 individual: Massimo. As an example of just how big an issue this is,
 The Linux Foundation compiles surveys that points out just how minor
 the role of Linus Torvaldis is in both writing kernel code and and in
 committing code and also just how much code comes from corporations as
 opposed to what might be called lone geeks (called consultants in
 surveys). I think Linus has even dropped out of the top 30 individual
 contributors for writing kernel code. The message is very clear. If
 Linus suddenly decides he has had enough or wants to wind down,
 'offcial' Linux continues on.

 A professional approach requires hard fact and a serious approach to
 legitimate issues that at the very least acknowledges legitimate
 issues and avoids propaganda. Hard facts requires real world tests,
 not evasion, defensive speculation and evangelism.

 John Heenan

 On Dec 2, 5:09 am, Branko Vukelic bg.bra...@gmail.com wrote:

  Erlang is for humongous, real-time, distributed, and highly-available apps.
  Here's an example (maybe quoted one time too often):
 http://www.sics.se/~joe/apachevsyaws.html
  On Wed, Dec 1, 2010 at 6:45 PM, John Heenan johnmhee...@gmail.com wrote:
   The elephant in the room has not gone away Massimo.
   Web2py is great for small projects.
   DotNet is great for small and large projects.
   The elephant in the room is not only the untested scalibility of
   web2py but also the amount of resources that neeeds to be thrown at
   web2py compared to DotNet and other frameworks as scale increases.
   One of the glaring defciences in web frameworks that use Python is the
   glaring engineering weakness of using thread per request web serving
   instead of using event per request web serving. I think I have pointed
   this out a number of times on this fourm, but it just does not sink
   in. I even pointed out how Linux loast a PR war over this issue.
   There is no need for Python based web frameworks to use thread per
   request web serving.
   John Heenan
   On Nov 30, 4:05 am, mdipierro mdipie...@cs.depaul.edu wrote:
   You achieve scalability by replicating the web server behind a load
   balancer. This is documented in the book, chapter 11, using HAProxy.
   All frameworks work the same way in this respect. web2py has no
   intrinsic limitations. The bottle neck is the database connection. All
   frameworks have the same problem. You can replicate the database too
   and web2py supports multiple database clients with Round-Robin.
   On a small VPS, web2py in average, should execute one page in 20ms.
   Depending on how many requests/second you need you can determine how
   many servers you need.
   web2py apps run on Google App Engine and that means arbitrary
   scalability as long as you can live with the constraints imposed by
   the Google datastore (these limitations will go away as soon as Google
   releases MySQL in the cloud, which they announced some time ago).
   

[web2py] Re: Best way to edit SQLFORM input before passing to accepts?

2010-12-01 Thread mr.freeze
I would personally use a computed field for this:

Model:
def count_words(txt):
...
return count

def get_type(txt):
count = count_words(txt)
if count  10: return 'small'
if count  20: return 'medium'
if count  30: return 'large'
return 'huge'

db.define_table('moment',
  Field('textarea','text'),
  Field('txttype', readable=False, writable=False,
   compute=lambda r: get_type(r['textarea'])),
  ...
)

Controller:
def submit_moment():
form = crud.create(db.moment)
return dict(form=form)


On Dec 1, 8:09 pm, DenesL denes1...@yahoo.ca wrote:
 your_model.py:

 db.define_table('moment',
   Field('textarea','text'),
   Field('txttype', readable=False, writable=False),
   ...
 )

 default.py:

 def moment_type(form):
   form.vars.txttype=...

 def submit_moment():
   form=SQLFORM(db.moment)
   if form accepts(request.vars, session, onvalidation=moment_type):
     response.flash = 'form accepted'
   elif form.errors:
     ...
   return dict(form=form, ...)

 views/default/submit_moment.html:

 {{extend 'layout.html'}}
 {{=form}}

 On Dec 1, 11:47 am, hswolff hswo...@gmail.com wrote:

  I'll try the model implementation.  I need to be able to parse the
  submit content and count the frequency a word appears and set the type
  accordingly.

  I'm using response.moment_form because when I had it in the index()
  function and I would go to the user page it wouldn't render because
  the dict wouldn't return the form that was displayed on views/
  layout.html.

  Correct me if I'm wrong:  if I were to make a submit_moment():
  function and a views/default/submit_moment.html view I would be able
  to include the view on every page and have it be functionally
  accurate, right?

  I'm still getting the hang of web2py's MVC.




[web2py] Re: Best way to edit SQLFORM input before passing to accepts?

2010-12-01 Thread DenesL

True, but you gotta learn to walk before you run ;)


On Dec 1, 9:48 pm, mr.freeze nat...@freezable.com wrote:
 I would personally use a computed field for this:

 Model:
 def count_words(txt):
     ...
     return count

 def get_type(txt):
     count = count_words(txt)
     if count  10: return 'small'
     if count  20: return 'medium'
     if count  30: return 'large'
     return 'huge'

 db.define_table('moment',
   Field('textarea','text'),
   Field('txttype', readable=False, writable=False,
            compute=lambda r: get_type(r['textarea'])),
   ...
 )

 Controller:
 def submit_moment():
     form = crud.create(db.moment)
     return dict(form=form)

 On Dec 1, 8:09 pm, DenesL denes1...@yahoo.ca wrote:

  your_model.py:

  db.define_table('moment',
    Field('textarea','text'),
    Field('txttype', readable=False, writable=False),
    ...
  )

  default.py:

  def moment_type(form):
    form.vars.txttype=...

  def submit_moment():
    form=SQLFORM(db.moment)
    if form accepts(request.vars, session, onvalidation=moment_type):
      response.flash = 'form accepted'
    elif form.errors:
      ...
    return dict(form=form, ...)

  views/default/submit_moment.html:

  {{extend 'layout.html'}}
  {{=form}}

  On Dec 1, 11:47 am, hswolff hswo...@gmail.com wrote:

   I'll try the model implementation.  I need to be able to parse the
   submit content and count the frequency a word appears and set the type
   accordingly.

   I'm using response.moment_form because when I had it in the index()
   function and I would go to the user page it wouldn't render because
   the dict wouldn't return the form that was displayed on views/
   layout.html.

   Correct me if I'm wrong:  if I were to make a submit_moment():
   function and a views/default/submit_moment.html view I would be able
   to include the view on every page and have it be functionally
   accurate, right?

   I'm still getting the hang of web2py's MVC.




Re: [web2py] Re: Best way to edit SQLFORM input before passing to accepts?

2010-12-01 Thread Harry Wolff
You guys all rock hah.

I got the form working as I want it to.  I'm gonna try putting in the
compute argument in my model tomorrow but for now I have the form working
with the following code:

new controller:
moment.py:

import re

def form():
## TODO: Get db.moment.type set to best or worst depending
## on frequency of word used.  (this is best in controller or view?)
form = SQLFORM(db.moment)

try:
db.moment.user_id.default = auth.user.id
except:
pass

if 'type' in request.vars:
bestCount = re.findall('best', request.vars.content.lower())
bestCount = bestCount.count('best')

worstCount = re.findall('worst', request.vars.content.lower())
worstCount = worstCount.count('worst')

if bestCount  worstCount:
request.vars.type = 'best'
elif worstCount  bestCount:
request.vars.type = 'worst'

if form.accepts(request.vars, formname='moment_submit_form'):
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'

return dict(form=form)


new view,
views/moment/form.html

{{if auth.is_logged_in():}}
form method=post id=submitMoment
textarea class=text cols=40 id=moment_content name=content
rows=10/textarea
input type=submit value=Submit
input type=hidden id=submitMomentType name=type value= /
input type=hidden name=_formname value=moment_submit_form /
/form
{{else:}}
Sign in to play!
{{pass}}


and then put in my
views/layout.html to show the form:
{{=LOAD('moment', 'form.html')}}


One thing that's no longer working is flashing the error or accept messages,
but at least functionally it's working.  I don't think it's the prettiest
code but let me know if you have any suggestions please!



On Wed, Dec 1, 2010 at 10:27 PM, DenesL denes1...@yahoo.ca wrote:


 True, but you gotta learn to walk before you run ;)


 On Dec 1, 9:48 pm, mr.freeze nat...@freezable.com wrote:
  I would personally use a computed field for this:
 
  Model:
  def count_words(txt):
  ...
  return count
 
  def get_type(txt):
  count = count_words(txt)
  if count  10: return 'small'
  if count  20: return 'medium'
  if count  30: return 'large'
  return 'huge'
 
  db.define_table('moment',
Field('textarea','text'),
Field('txttype', readable=False, writable=False,
 compute=lambda r: get_type(r['textarea'])),
...
  )
 
  Controller:
  def submit_moment():
  form = crud.create(db.moment)
  return dict(form=form)
 
  On Dec 1, 8:09 pm, DenesL denes1...@yahoo.ca wrote:
 
   your_model.py:
 
   db.define_table('moment',
 Field('textarea','text'),
 Field('txttype', readable=False, writable=False),
 ...
   )
 
   default.py:
 
   def moment_type(form):
 form.vars.txttype=...
 
   def submit_moment():
 form=SQLFORM(db.moment)
 if form accepts(request.vars, session, onvalidation=moment_type):
   response.flash = 'form accepted'
 elif form.errors:
   ...
 return dict(form=form, ...)
 
   views/default/submit_moment.html:
 
   {{extend 'layout.html'}}
   {{=form}}
 
   On Dec 1, 11:47 am, hswolff hswo...@gmail.com wrote:
 
I'll try the model implementation.  I need to be able to parse the
submit content and count the frequency a word appears and set the
 type
accordingly.
 
I'm using response.moment_form because when I had it in the index()
function and I would go to the user page it wouldn't render because
the dict wouldn't return the form that was displayed on views/
layout.html.
 
Correct me if I'm wrong:  if I were to make a submit_moment():
function and a views/default/submit_moment.html view I would be able
to include the view on every page and have it be functionally
accurate, right?
 
I'm still getting the hang of web2py's MVC.
 
 



[web2py] Re: Scalability of web2py?

2010-12-01 Thread VP
While he's very knowledgeable with web2py, I think John Heenan's
criticisms are unfair.  From what I understand, it seems most other
recognizable Python frameworks employ WGSI.  So this problem (if
there's a problem), is not unique to web2py.  Comparing web2py to
Erlang is curious.

I am a newbie, but from what I see around here I don't think Massimo's
effort or zeal is a setback as John seems to suggest.  I think any
project needs at least one person who puts his heart and soul into
it.  If the issue is Massimo doesn't like or prevents other
contributors from taking a leadership role in the development of
web2py or its entities (books, slices, etc.?), that's a different
story.  Is this what John is suggesting?  If not, I don't see why
Massimo or anyone being a dependable leader of the project is a bad
thing.

I think it is clear that web2py is not at the level of Linux.  It's
not at the level of Drupal.  It's not even at the level of Django.
Probably there's currently no killer app developed with web2py yet.
I think it's acceptable, at this stage.  It would be better to put
forward constructive solutions to get more developers/users into
web2py.



[web2py] Bug: if theres is two forms normal of request.vars. become LISTS!

2010-12-01 Thread Phyo Arkar
   I use html forms, that code was since 1.7x and today i get
complains from customer (a month after updated to 1.88)

Now i found out why:
If there is two html forms (non web2py-generated) with different ID,
different action but if they have same post vars (or get var i am not
tested..) , it recieved at controller as LISTS..

I have not tested in lastest version , because i dont dare to update
as i dont know what will happen.

Thats why i had called for a stable release once in a while few months ago..

 form action=/{{=request.application}}/extraction/index
method=post id = frmCaselst
  input type=submit id=extSel  value=Begin Exctraction for
Selected Case /input
  input type=hidden id = db_id name=db_id value= /
  input type=hidden id = db_name name=db_name
value={{=request.vars.dbName}} /
  input type=hidden id = source_path  name=source_path
value={{=source_path}} /
  input type=hidden id = extracted_path name=extracted_path
value={{=extracted_path}} /
  form/

form action=/{{=request.application}}/extraction/atonce
method=post id = frmAtOnce
  input type=submit id=extSel  value=Begin Exctraction for
Selected Case /input
  input type=hidden id = db_id name=db_id value= /
  input type=hidden id = db_name name=db_name
value={{=request.vars.dbName}} /
  input type=hidden id = source_path  name=source_path
value={{=source_path}} /
  input type=hidden id = extracted_path name=extracted_path
value={{=extracted_path}} /
  form/

Traceback (most recent call last):
  File /home/v3ss/workspace-bbb/web2py-clone/gluon/restricted.py,
line 188, in restricted
exec ccode in environment
  File 
/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/controllers/extraction.py,
line 117, in module
  File /home/v3ss/workspace-bbb/web2py-clone/gluon/globals.py, line
96, in lambda
self._caller = lambda f: f()
  File /home/v3ss/workspace-bbb/web2py-clone/gluon/tools.py, line 2270, in f
return action(*a, **b)
  File 
/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/controllers/extraction.py,
line 44, in index
extracted_path=os.path.join(REQUEST.vars.extracted_path,now)
  File /usr/lib/python2.6/posixpath.py, line 67, in join
elif path == '' or path.endswith('/'):
AttributeError: 'list' object has no attribute 'endswith'


Traceback (most recent call last):
  File /home/v3ss/workspace-bbb/web2py-clone/gluon/restricted.py,
line 188, in restricted
exec ccode in environment
  File 
/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/controllers/extraction.py,
line 117, in module
  File /home/v3ss/workspace-bbb/web2py-clone/gluon/globals.py, line
96, in lambda
self._caller = lambda f: f()
  File /home/v3ss/workspace-bbb/web2py-clone/gluon/tools.py, line 2270, in f
return action(*a, **b)
  File 
/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/controllers/extraction.py,
line 44, in index
extracted_path=os.path.join(REQUEST.vars.extracted_path,now)
  File /usr/lib/python2.6/posixpath.py, line 67, in join
elif path == '' or path.endswith('/'):
AttributeError: 'list' object has no attribute 'endswith'


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

2010-12-01 Thread guruyaya
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 mdipie...@cs.depaul.edu 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 msenecal...@gmail.com 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] onvalidation problem

2010-12-01 Thread VP
somehow onvalidation seems to work on create but not on update/edit.

I have something like this:

def edit_entry():
form = SQLFORM(db.entry, request.args(0))
if form.accepts(request.vars, session, onvalidation=func):
   ## blah blah


The function func apparently is not called at all.


[web2py] Re: onvalidation problem

2010-12-01 Thread mr.freeze
Can you verify that there are no form errors? Currently if there are
any form errors, onvalidation will not run. Also, what version are you
running?

On Dec 1, 10:53 pm, VP vtp2...@gmail.com wrote:
 somehow onvalidation seems to work on create but not on update/edit.

 I have something like this:

 def edit_entry():
     form = SQLFORM(db.entry, request.args(0))
     if form.accepts(request.vars, session, onvalidation=func):
        ## blah blah

 The function func apparently is not called at all.


[web2py] Re: Bug: if theres is two forms normal of request.vars. become LISTS!

2010-12-01 Thread mdipierro
Not sure what the problem is. Can you try replace?

form.accepts(request.vars,...) with
form.accepts(request.post_vars,...)



On Dec 1, 10:23 pm, Phyo Arkar phyo.arkarl...@gmail.com wrote:
    I use html forms, that code was since 1.7x and today i get
 complains from customer (a month after updated to 1.88)

 Now i found out why:
 If there is two html forms (non web2py-generated) with different ID,
 different action but if they have same post vars (or get var i am not
 tested..) , it recieved at controller as LISTS..

 I have not tested in lastest version , because i dont dare to update
 as i dont know what will happen.

 Thats why i had called for a stable release once in a while few months ago..

  form action=/{{=request.application}}/extraction/index
 method=post id = frmCaselst
   input type=submit id=extSel  value=Begin Exctraction for
 Selected Case /input
   input type=hidden id = db_id name=db_id value= /
   input type=hidden id = db_name name=db_name
 value={{=request.vars.dbName}} /
   input type=hidden id = source_path  name=source_path
 value={{=source_path}} /
   input type=hidden id = extracted_path name=extracted_path
 value={{=extracted_path}} /
   form/

     form action=/{{=request.application}}/extraction/atonce
 method=post id = frmAtOnce
   input type=submit id=extSel  value=Begin Exctraction for
 Selected Case /input
   input type=hidden id = db_id name=db_id value= /
   input type=hidden id = db_name name=db_name
 value={{=request.vars.dbName}} /
   input type=hidden id = source_path  name=source_path
 value={{=source_path}} /
   input type=hidden id = extracted_path name=extracted_path
 value={{=extracted_path}} /
   form/

 Traceback (most recent call last):
   File /home/v3ss/workspace-bbb/web2py-clone/gluon/restricted.py,
 line 188, in restricted
     exec ccode in environment
   File 
 /home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/controllers/extraction.py,
 line 117, in module
   File /home/v3ss/workspace-bbb/web2py-clone/gluon/globals.py, line
 96, in lambda
     self._caller = lambda f: f()
   File /home/v3ss/workspace-bbb/web2py-clone/gluon/tools.py, line 2270, in f
     return action(*a, **b)
   File 
 /home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/controllers/extraction.py,
 line 44, in index
     extracted_path=os.path.join(REQUEST.vars.extracted_path,now)
   File /usr/lib/python2.6/posixpath.py, line 67, in join
     elif path == '' or path.endswith('/'):
 AttributeError: 'list' object has no attribute 'endswith'

 Traceback (most recent call last):
   File /home/v3ss/workspace-bbb/web2py-clone/gluon/restricted.py,
 line 188, in restricted
     exec ccode in environment
   File 
 /home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/controllers/extraction.py,
 line 117, in module
   File /home/v3ss/workspace-bbb/web2py-clone/gluon/globals.py, line
 96, in lambda
     self._caller = lambda f: f()
   File /home/v3ss/workspace-bbb/web2py-clone/gluon/tools.py, line 2270, in f
     return action(*a, **b)
   File 
 /home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/controllers/extraction.py,
 line 44, in index
     extracted_path=os.path.join(REQUEST.vars.extracted_path,now)
   File /usr/lib/python2.6/posixpath.py, line 67, in join
     elif path == '' or path.endswith('/'):
 AttributeError: 'list' object has no attribute 'endswith'


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

2010-12-01 Thread mdipierro
True. This will break backward compatibility but it is a security
issue.
I will sleep on it. All in favor? Against?

On Dec 1, 10:34 pm, guruyaya guruy...@gmail.com 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 mdipie...@cs.depaul.edu 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 msenecal...@gmail.com 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: Scalability of web2py?

2010-12-01 Thread weheh
To the original post in this thread, I think the idea for distributing
session files across the file system is sensible. I use what I believe
is a similar web2py capability for distributing files and I know it
works and is scalable.

As for the rest of the thread, scalability is a moving target. Bottom
line -- somebody has to be smart or lucky enough to build a killer
web2py app and then the web2py community has to support efforts to
make sure it scales.

I'm encouraged to see this discussion.


On Dec 1, 11:57 am, mdipierro mdipie...@cs.depaul.edu wrote:
 We should have a mechanism for storing sessions clientside but this is
 a speed issue not a scalability issues. Storing sessions in encrypted
 cookies makes a each request 1-2ms faster by trading bandhwidth
 (required to communicate the session in cookie) with file IO (required
 to locate and access the session in a file).

 Scalability-wise sessions in files do not present a problem as long as
 one uses a load balancer with support with sticky sessions.

 On common problem arises when there are too many session files in the
 same folder (the os becomes slow accessing the folder). This problem
 has been solved in trunk last week by creating a sub-folder tree
 structure for the session folder.

 Session in files some advantages of sessions in cookies: they can
 contain more data. They can be controller server-side (checked,
 deleted, modified). They can be locked to force per-user serialization
 of form processing(default in web2py).

 Bottom line: current sessions are not a scalability issue but it would
 be nice to have the option of sessions in signed cookies. It is not
 difficult to do and we have it by the end of the year.

 This will be a major speed up for system that do not have a filesystem
 and currently require storing sessions on datastore, like on GAE.

 Massimo

 On Dec 1, 10:31 am, VP vtp2...@gmail.com wrote:

  This is an example -- I think -- where web2py still needs to be proven
  in terms of scalability.

  Yes, sessions can be stored in database, turned off in specific
  functions, and regularly deleted.   But I still think that there
  should be a better systematic way of handling sessions in heavy
  applications.  I think the current set up is not effective when you
  have large volume of users, which suddenly builds up many sessions.

  Small things like this don't matter much until things get large
  scaled.

  ===

  To take web2py to the next level, I think Massimo might need to lay
  out milestones or visions to be achieved in future releases of
  web2py.

  On Nov 30, 6:07 pm, Stef Mientki stef.mien...@gmail.com wrote:

   On 30-11-2010 21:08, VP wrote: I think .NET and web2py are not 
   competitors.  They are different ball
games.   When things scale large, everything is important.  A small
design issue might be magnified.   I don't think web2py is proven yet,
in terms of scalability.  What web2py needs is at least one real
example to show that it is scalable and what are the limits at the
extreme.

   I'm not sure were session files are used for,
   but isn't file access much slower than database access ?

   Can session files be turned of ?

   cheers,
   Stef




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

2010-12-01 Thread Kostas M
Speaking of table names, I have a question:

In Django models, when defining a table e.g. Unit, there is the
ability to adjust the name of the table when it is shown in the admin
app, using the Meta class as 'verbose_name' for single, and
'verbose_name_plural' for plural:

class Unit(models.Model):
code=models.CharField(max_length=2, verbose_name=u'κωδικός')
title=models.CharField(max_length=100,verbose_name=u'τίτλος')
class Meta:
verbose_name = uμονάδα
verbose_name_plural = uμονάδες

In Web2py, I would do:

db.define_table('unit',
Field('code','string',length=2,required=True,label=u'κωδικός'),
Field('title','string',length=100, required=True,label=u'τίτλος'),
)

but what about the 'label' of the table?


On Dec 1, 2:54 am, mdipierro mdipie...@cs.depaul.edu wrote:
 when the dal was designed I has singular in mind.



[web2py] Re: auth.change_password() not workign

2010-12-01 Thread Aniket Arora
Actually I'm using two forms in a page. One of them is using SQLFORM
and second form is using auth.change_password(). The first one works
fine but change password form is not being submitted and also doesn't
show any error when filled wrongly. This problem occurs where I'm
using Version 1.88.2 and with Version 1.83.2, it's all fine.

Here's the code:

def settings():
user_id = auth.user.id
u = db(db.auth_user.id == user_id).select(db.auth_user.ALL)[0]

change_password_form =
auth.change_password()

record = db.auth_user(user_id)
settings_form = SQLFORM(db.auth_user, record, fields = ['email',
'display_name'], labels = {'email' : 'Email:', 'display_name':
'Display Name:'}, submit_button = 'Save Changes', showid=False)
if settings_form.accepts(request.vars, formname = 'form2'):
--
--
--
--
return dict(form1 = change_password_form, form2 = settings_form)

On Dec 1, 8:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I do not think so. What do you mean it does not work? Could it be a
 problem with mail?

 On Dec 1, 1:57 am, Aniket Arora aniket.ar...@gmail.com wrote:

  Hey,

  I'm using web2py (Version 1.83.2) on my local machine. I used
  auth.change_password() function and it works fine on my local machine.
  But when I tried the same on live site with Version 1.88.2 , it's not
  working.

  Is there any change specific to this in the newer version?




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

2010-12-01 Thread mdipierro
There is no label for the table because the name of the table does
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 kmo...@hotmail.com wrote:
 Speaking of table names, I have a question:

 In Django models, when defining a table e.g. Unit, there is the
 ability to adjust the name of the table when it is shown in the admin
 app, using the Meta class as 'verbose_name' for single, and
 'verbose_name_plural' for plural:

 class Unit(models.Model):
         code=models.CharField(max_length=2, verbose_name=u'κωδικός')
         title=models.CharField(max_length=100,verbose_name=u'τίτλος')
         class Meta:
                 verbose_name = uμονάδα
                 verbose_name_plural = uμονάδες

 In Web2py, I would do:

 db.define_table('unit',
     Field('code','string',length=2,required=True,label=u'κωδικός'),
     Field('title','string',length=100, required=True,label=u'τίτλος'),
     )

 but what about the 'label' of the table?

 On Dec 1, 2:54 am, mdipierro mdipie...@cs.depaul.edu wrote:

  when the dal was designed I has singular in mind.




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

2010-12-01 Thread pbreit
I love the commitment to backwards compatibility but a security issue
warrants a fix.


[web2py] Re: Scalability of web2py?

2010-12-01 Thread pbreit
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).


[web2py] Re: onvalidation problem

2010-12-01 Thread VP
latest version.  THere are no form errors.

On Dec 1, 11:02 pm, mr.freeze nat...@freezable.com wrote:
 Can you verify that there are no form errors? Currently if there are
 any form errors, onvalidation will not run. Also, what version are you
 running?

 On Dec 1, 10:53 pm, VP vtp2...@gmail.com wrote:

  somehow onvalidation seems to work on create but not on update/edit.

  I have something like this:

  def edit_entry():
      form = SQLFORM(db.entry, request.args(0))
      if form.accepts(request.vars, session, onvalidation=func):
         ## blah blah

  The function func apparently is not called at all.




[web2py] Re: Please help: Are these errors?

2010-12-01 Thread Seeker
Hi Matt,

Thanks very much for responding.
I think you may (indirectly) be onto something.  It never occurred to
me that the auto population of tables with the wizard could be the
source of the problem. But it could in fact be that the wizard was
perhaps creating records with missing references.

I have just updated my Web2Py from trunk to test the theory (use the
wizard to create 2 apps: one with auto poplulate and one without.
Then compare.)
It seems however that the problem is now fixed in trunk.  I see a
commit in trunk that reads: wizard issue with sorting of popultate
statments fixed, thanks Tiago ... wonder if that fixed it?

Thanks for the assistance anyway.


On Dec 1, 7:55 pm, mattynoce mattyn...@gmail.com wrote:
 i get this error when i have mismatched data, but only on certain
 fields. i haven't done the example that you're talking about exactly,
 but maybe this can help.

 i have a normal auth_user table, a period table and an element table
 that look like this:

 auth_user

 period: userid, ...

 element: periodid, ...

 if i have test user, let's say with id 10, and i create a period, it
 works fine. but if i delete user 10, i get the Using a recursive
 select but encountered a broken reference error when looking on
 appadmin. the fact that user #10 isn't there breaks it.

 the weird part is that if element refers to a missing period, it's not
 a problem. so let's say there's an element that uses period 50. if i
 delete period 50 and then look at the element table on appadmin, it
 works fine. it simply leaves the period dropdown blank since there's
 no associated value.

 i'm not sure why a missing auth_user record causes an error but a
 missing period record doesn't. but hopefully this can be of some help.

 db.define_table('period',
     Field('userid', db.auth_user, requires=IS_IN_DB(db,
 db.auth_user.id, '%(last_name)s, %(first_name)s (%(id)s)')),
     ...
     )

 db.define_table('element',
     Field('periodid', 'integer', requires=IS_IN_DB(db, db.period.id, '%
 (startDate)s, %(endDate)s (%(id)s)')),
     ...
     )

 matt

 On Nov 25, 3:29 am, Seeker tmurn...@gmail.com wrote:



  Hi,
  Can anyone else replicate this issue (error 1 described at the top of
  this post)?
  It seems to be an error introduced when creating an app with the
  wizard and specifying related (referenced) tables in an incorrect
  order.

  Thanks.- Hide quoted text -

 - Show quoted text -