Re: [web2py] validator.py and T()

2010-12-28 Thread Martin Weissenboeck
Thank you very much - now is works!

2010/12/27 Bruno Rocha 

> That is because T() is not in context when validators are defined. you have
> to pass error_message to your validators.
>
> db.table.field.requires=IS_NOT_EMPTY(error_message=T('this field cannot be
> empty'))
>
> That is the way I am doing woth my Portuguese systems and sites.
>
> 2010/12/27 Martin Weissenboeck 
>
> Hi,
>>
>> I want to build a website using German. A lot of texts can be translated
>> using the T() object. But there are some problems:
>>
>> (1) I have modified default/user.html:
>>
>>- {{=T('register')}}
>>- >href="{{=URL(r=request,args='request_reset_password')}}">{{=T('lost
>>password')}}
>>
>> Works fine. Would be nice to have these lines as standard text.
>>  (2) There is a lot of English strings in gluon/validators.py, starting
>> with
>>
>>- error_message (e.g. "def __init__(self, expression,
>>error_message='invalid expression'):"),
>>- failures.append and
>>- format
>>
>> I was very surprised that I could not find any T() object in the code. Now
>> I tried to use the T() object for all of these lines, but T() is not known. 
>> That
>> is realy not good - a lot of users would not accept a website with mixed
>> German and English words. What can I do?
>>
>> Which kind regards
>> Martin
>>
>
>
>
> --
>
> Bruno Rocha
> http://about.me/rochacbruno/bio
>


[web2py] Re: Not open source yet... but

2010-12-28 Thread weheh
Very cool. Also enjoyed your Lagrange talk.

On Dec 28, 1:55 am, mdipierro  wrote:
> http://vimeo.com/18232653


[web2py] Re: Web2Py Foundation?

2010-12-28 Thread Graham Dumpleton


On Tuesday, December 28, 2010 5:37:30 PM UTC+11, mdipierro wrote:
>
> Not sure what a single person framework means. This framework counts 
> almost 100 contributors and at least 50 people very skilled here. If I 
> get hit by a track any of them can take over by forking my branch as 
> allowed by the license. 
>

That last line actually supports the idea that a piece of software is owned 
and controlled by a single person. If a piece of software was owned by a 
group, be it a corporation or a foundation, the death of the core developer 
would make no difference as it would continue to be developed within the 
structure of that corporation or foundation and copyright still held by the 
continuing entity.

In your case, if you get hit by a bus driven by a disgruntled Python 
developer, then no one else can simply take over the software as it is now, 
using any existing legal structure etc. Instead it would as you say need to 
be forked and in being forked legally may even need to change names as a 
result if you have sole rights over the original name.

So, your own words support the contention expressed by some that it is 
'single person framework' as far as ownership and control is concerned, an 
issue which is distinct from whether or not you have other contributors.

Graham
 

> The purpose of the foundation is to collect money for development and 
> advertising. Other organization like Rails have chose to create a 
> company instead of a foundation. 
>
> We have created a company (experts4solutions.com) whose purpose is to 
> promote skilled web2py professionals (and you can joins), foster 
> web2py projects, sell consulting and long term support contracts. 
>
> This was advertised here a few months ago. Some users have joined. 
>
> Massimo 
>
>
>
> On Dec 27, 9:46 pm, Pepe Araya  wrote: 
> > Hi, 
> > 
> > some news about this topic? 
> > 
> > I think 2 things are going in favor of creating a foundation or 
> [whatever]: 
> > 1. the community has grown a lot. 
> > 2. in all the reviews I read about web2py, always, always, ALWAYS!!! say 
> it 
> > is a single-person framework and that takes away the future security of 
> > their development. 
> > 
> > kind regards 
> > 
> > Pepe



[web2py] Re: Not open source yet... but

2010-12-28 Thread qqsaqq
+1

that impressively shows what is possible with html5.

I hope, 'they' get the websocket protocol fixed 
soon

[web2py] Mail.send failure:STARTTLS ...

2010-12-28 Thread Martin Weissenboeck
Hi,

I want my website to send emails.

I have tried (in db.py)

mail.settings.server = 'smtp.gmail.com:587'  # your SMTP server
mail.settings.sender = 'mygmailaddr...@gmail.com' # your email
mail.settings.login = 'mygmailaddr...@gmail.com:mygmailpassword'# your
credentials or None


and

mail.settings.server = '127.0.0.1'  # your SMTP server
mail.settings.sender = 'off...@mydomain.com' # your email
mail.settings.login = None# your credentials or None


In both cases I got the message

*WARNING:web2py:Mail.send failure:STARTTLS extension not supported by
server.*


Pure Python works fine:

# python2.7
>>> import smtplib
>>> server = smtplib.SMTP('127.0.0.1')
>>> server.sendmail('a...@test.com','mygmailaddr...@gmail.com','test')


Operating system: CentOS

What shall I do?

With kind regards
Martin


[web2py] question about trapped ajax link

2010-12-28 Thread weheh
I'm trying to get a trapped ajax link, which deletes a record, to
update two different divs on the screen. One div is rendered by its
controller. But how about the other div, assuming that it is usually
rendered by an entirely different controller? I tried using
response.js and response.headers['web2py-component-command'] to render
the other div, but it didn't work. I'm missing something.


[web2py] Re: Web2Py Foundation?

2010-12-28 Thread weheh
Gary is right.


[web2py] Re: Web2Py Foundation?

2010-12-28 Thread weheh
Unless Massimo has already willed the copyright and other web2py IP
to ...?


[web2py] Re: Web2Py Foundation?

2010-12-28 Thread weheh
Sorry Graham, I meant you are right.

On Dec 28, 3:47 am, weheh  wrote:
> Gary is right.


[web2py] components and css

2010-12-28 Thread weheh
When a single component reloads in it's cid, it is as if the css for
that cid changes. I'm using some jQuery UI tabs and after the div
updates, the tabs change from each being as wide as the text in the
tab to each being 100% of the window. I'm pretty sure it's a css
artifact. What happened?


Re: [web2py] Re: jquey effect problem

2010-12-28 Thread Sahil Arora
still not working

On Mon, Dec 27, 2010 at 10:05 PM, Martín Mulone wrote:

> For me this code is working, the jquery is loaded?, your source code
> point to /hello/static/js/jquery.js this exist?. Also try  to add ";"
> to the end of jquery sentence and change ".two" with "#b".
>
> 2010/12/27 Sahil Arora :
> >
> > I have attached the source html...i amgetting no idea
> > On Mon, Dec 27, 2010 at 7:53 PM, Luther Goh Lu Feng 
> > wrote:
> >>
> >> I suggest inspecting the source to see the hhtml for the blank line.
> >>
> >> On Dec 27, 9:10 pm, Sahil Arora  wrote:
> >> > see the attachment..
> >> > first is before clicking on hello
> >> > second is after clicking..
> >> > only a blank line comes
> >> >
> >> > On Mon, Dec 27, 2010 at 6:32 PM, Sahil Arora
> >> > wrote:
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > > i am doing this in default/index.html page in a application which
> >> > > extends
> >> > > layout.html which i think includes web2py_ajax.html . So is there
> any
> >> > > need
> >> > > to include any thing else.
> >> >
> >> > > On Mon, Dec 27, 2010 at 6:29 PM, Luther Goh Lu Feng
> >> > > wrote:
> >> >
> >> > >> The syntax is correct. Is the jquery library included?
> >> >
> >> > >> You need to include something like
> >> >
> >> > >> 

[web2py] Re: INNER JOIIN and aliased table

2010-12-28 Thread HaM
No :)

On Dec 27, 6:03 pm, mdipierro  wrote:
> Did this work with the old dal?
>
> On Dec 27, 9:41 am, HaM  wrote:
>
> > Hi,
>
> > I'm trying to do INNER JOIN with aliased table and I'm experiencing
> > problem.
> > Here is my example:
>
> > Domain = db.domain
> > Client = db.client
> > Manager = db.contact.with_alias('manager')
> > sql = db((Domain.id==1)&
> >         (Client.id==Domain.client_id)&
> >         (Manager.id==Client.manager_id))._select(
> >         Domain.name, Client.name, Manager.name)
> > print sql
>
> > Result:
> > SELECT  domain.name, client.name, contact.name FROM domain, client,
> > contact WHERE (((domain.id = 1) AND (client.id = domain.client_id))
> > AND (contact.id = client.manager_id));
>
> > It works but it doesn't use the alias name for the table contact. Thus
> > the resulting dict() doesn't contains the key "manager" but the key
> > "contact".
>
> > Thanks again for your investigations.
>
>


[web2py] Re: strange problem with checkbox and ajax

2010-12-28 Thread weheh
return false;

is definitely a problem.

On Dec 28, 2:23 am, weheh  wrote:
> Running 1.89.5


[web2py] Re: Left Join with aliased table and the new DAL

2010-12-28 Thread HaM
It's fixed for me. It works with revision 1454:c4465e21c715

Thanks !

On Dec 27, 8:11 pm, mdipierro  wrote:
> This should now be fixed in trunk. Please confirm.
>
> On Dec 27, 3:23 am, HaM  wrote:
>
> > First, Merry Christmas.
>
> > Since I still experiencing problem on left join I have looked more
> > deeply and try to find where is the difference between old and new
> > DAL.
> > I found that my problem only appears on a more complex request:
>
> > Domain = dbPsnol.domain
> > Client = dbPsnol.client
> > Contact = dbPsnol.contact
> > Manager = dbPsnol.contact.with_alias('manager')
> > Datacenter = dbPsnol.datacenter
> > PsnVersion = dbPsnol.psn_version
> > Server = dbPsnol.server
>
> > query = dbPsnol((Domain.id==request.args[0])&
> >         (Client.id==Domain.client_id)&
> >         (Datacenter.id==Domain.dc_id)&
> >         (PsnVersion.id==Domain.psn_version_id))
>
> > sql = query._select(Domain.name, Client.name,
> > Manager.name, left=[
> > Manager.on(Manager.id==Client.manager_id)])
> > print sql
>
> > With the old DAL:
> > SELECT domain.name, client.name, manager.name FROM datacenter, domain,
> > psn_version, client LEFT JOIN contact AS manager ON
> > manager.id=client.manager_id WHERE (((domain.id=211 AND
> > psn_version.id=domain.psn_version_id) AND datacenter.id=domain.dc_id)
> > AND client.id=domain.client_id);
>
> > With the new DAL:
> > SELECT  domain.name, client.name, manager.name FROM datacenter,
> > domain, client, psn_version LEFT JOIN contact AS manager ON
> > (manager.id = client.manager_id) WHERE domain.id = 211) AND
> > (psn_version.id = domain.psn_version_id)) AND (datacenter.id =
> > domain.dc_id)) AND (client.id = domain.client_id));
>
> > The difference is almost invisible, but tables client and psn_version
> > have swap in the FROM part of the request. It seems that my problem
> > come from there since the new DAL syntax isn't correct for PostgreSQL.
>
> > For my second problem (INNER JOIN and alias) I will open a new ticket
> > quickly. Many thanks for your work.
>
> > On 24 déc, 02:57, mdipierro  wrote:
>
> > > I took a second look. The first problem is indeed fixed. The second
> > > problem is not a new dal issue. It is just that aliased tables in
> > > INNER JOINs never worked well. I will continue to look into it. This
> > > may take a while so could you open a ticket on google code? Thanks.
>
> > > On Dec 22, 2:52 am, HaM  wrote:
>
> > > > Ok in order to simplify the problem I have changed my code to this:
> > > > Domain = db.domain
> > > > Client = db.client
> > > > Manager = db.contact.with_alias('manager')
>
> > > > sql = db((Domain.id==1)&(Client.id==Domain.client_id))._select(
> > > >                 Domain.name, Client.name, Manager.name,
> > > >                 left=[Manager.on(Manager.id==Client.manager_id)])
> > > > print sql
>
> > > > The result is:
> > > > SELECT  domain.name, client.name, contact.name FROM domain, client,
> > > > contact LEFT JOIN contact AS manager ON (contact.id =
> > > > client.manager_id) WHERE ((domain.id = 1) AND (client.id =
> > > > domain.client_id));
>
> > > > And this request is not correct for PostgreSQL. I think that it should
> > > > be :
> > > > SELECT  domain.name, client.name, manager.name FROM domain, client
> > > > LEFT JOIN contact as manager ON (manager.id = client.manager_id) WHERE
> > > > ((domain.id = 1) AND (client.id = domain.client_id));
>
> > > > Which works well.
>
> > > > In order to push research further I also tried to do only INNER JOIN
> > > > with an aliased table and it partially works:
> > > > Domain = db.domain
> > > > Client = db.client
> > > > Manager = db.contact.with_alias('manager')
> > > > sql = db((Domain.id==1)&
> > > >         (Client.id==Domain.client_id)&
> > > >         (Manager.id==Client.manager_id))._select(
> > > >         Domain.name, Client.name, Manager.name)
> > > > print sql
>
> > > > Result:
> > > > SELECT  domain.name, client.name, contact.name FROM domain, client,
> > > > contact WHERE (((domain.id = 1) AND (client.id = domain.client_id))
> > > > AND (contact.id = client.manager_id));
>
> > > > It works but it doesn't use the alias name for the table contact. Thus
> > > > the resulting dict() doesn't contains the key "manager" but the key
> > > > "contact".
>
> > > > Thank you for investigating this problem so quickly.
>
> > > > On Dec 21, 10:57 pm, mdipierro  wrote:
>
> > > > > hmm...
>
> > > > > I am trying your select and it now generates the same sql as the old
> > > > > dal. please try this:
>
> > > > > Domain = db.domain
> > > > > Client = db.client
> > > > > Manager = db.contact.with_alias('manager')
> > > > > sql = db(Domain.id==1)._select(
> > > > >     Domain.ALL, Client.ALL,Manager.ALL,
> > > > >     left=[Client.on(Client.id==Domain.client_id),
> > > > >           Manager.on(Manager.id==Client.manager_id)])
> > > > > print sql
>
> > > > > what do you get?
> > > > > I get
>
> > > > > SELECT  domain.id, domain.name, domain.client_id, client.id,
> > > > > client.name, cli

[web2py] Re: strange problem with checkbox and ajax

2010-12-28 Thread Martin.Mulone
I think you are checking request.vars instead of request.args

[web2py] Re: strange problem with checkbox and ajax

2010-12-28 Thread weheh
OK, I think I got it. web2py_ajax_page() is for updating whole
components. ajax() is for doing more surgical stuff within the
component. Perhaps that's why ajax(); is followed by returns false;
because it's not supposed to update the entire component? So I went
back to the ajax call and I was able to get it to work. Much ado about
nothing.


On Dec 28, 5:13 am, "Martin.Mulone"  wrote:
> I think you are checking request.vars instead of request.args


[web2py] Re: Not open source yet... but

2010-12-28 Thread Martin.Mulone
Look really good.

[web2py] Re: strange problem with checkbox and ajax [Closed]

2010-12-28 Thread weheh


On Dec 28, 5:20 am, weheh  wrote:
> OK, I think I got it. web2py_ajax_page() is for updating whole
> components. ajax() is for doing more surgical stuff within the
> component. Perhaps that's why ajax(); is followed by returns false;
> because it's not supposed to update the entire component? So I went
> back to the ajax call and I was able to get it to work. Much ado about
> nothing.
>
> On Dec 28, 5:13 am, "Martin.Mulone"  wrote:
>
> > I think you are checking request.vars instead of request.args
>
>


[web2py] Re: components and css

2010-12-28 Thread weheh
False alarm? Now I think it may not be a web2py issue after all. I
think this must be part of another jQuery package I'm using. I thought
it was something to do with: in which file do I source global
javascripts and css?

On Dec 28, 4:19 am, weheh  wrote:
> When a single component reloads in it's cid, it is as if the css for
> that cid changes. I'm using some jQuery UI tabs and after the div
> updates, the tabs change from each being as wide as the text in the
> tab to each being 100% of the window. I'm pretty sure it's a css
> artifact. What happened?


[web2py] unique constraint of multiple columns (at database level)

2010-12-28 Thread canna
hello everybody!

I created a table of contacts that requires the first name+last name
to be unique
the table:

db.define_table("Contacts",
  Field("FirstName", "string", length=45, notnull=True),
  Field("LastName", "string", length=45, notnull=True),
  Field("Title", "string", length=45, default=None),
  Field("Department", "string", length=45, default=None),
  Field("Address", "string", length=255, default=None),
  Field("Phone", "string", length=45, default=None),
  Field("Fax", "string", length=45, default=None),
  Field("Email", "string", length=45, default=None),
  Field("Comments", "text", default=None), migrate=True)

how do I instruct the DAL to create unique constraint on FirstName
+LastName when in creates the table in the database?
I have lots of tables that have unique constrain on 2-3 fields, so I
prefer not to do this manually.
any help will be appreciated!


[web2py] Re: Possible bug in SQLFORM.factory in version 1.91.4?

2010-12-28 Thread Lisandro
I had already try with the nightly built for testers version, but not
with trunk.
Thank you very much!

On 27 dic, 14:01, mdipierro  wrote:
> this has been fixed in trunk. I will post a new version soon.
>
> On Dec 27, 7:03 am, Lisandro  wrote:
>
> > I've been working with web2py for a while. Lastnight I updated to last
> > version, and my webforms collapsed (those constructed with
> > SQLFORM.factory).
>
> > More precisely, the problem appeared in the forms where I mix some
> > existing fields of the database with other fields defined on the run,
> > just like this example:
> > --
> > form = SQLFORM.factory(
> >   db.mytable.oneexistingfield,
> >   Field('nonexistingfield', 'string'),
> >   db.mytable.anotherexistingfield)
> > --
>
> > Anyway. After some minutes searching for the cause of the problem,
> > I've decided to start from scratch with an example. I downloaded the
> > version 1.91.4 (I'm using Ubuntu 10.04). I created a new application.
>
> > The model (very simple, I took it from web2py examples):
> > --
> > db.define_table('person',
> >    Field('name'))
> > db.define_table('dog',
> >    Field('name'),
> >    Field('owner', db.person))
> > --
>
> > Then, I wrote the "index" function on "default.py" controller:
> > --
> > def index():
> >    form = SQLFORM.factory(db.dog)
> >    dogs = db(db.dog.id>0).select()
> >    return dict(form=form, dogs=dogs)
> > --
> > In the view I just added {{=form}} and {{=BEAUTIFY(dogs)}}, just to
> > see the result of the function.
>
> > When I try to run the function, I receive the following error:
> > --
> > Traceback (most recent call last):
> >  File "/home/lisandro/pylicencias/gluon/restricted.py", line 188, in
> > restricted
> >    exec ccode in environment
> >  File "/home/lisandro/pylicencias/applications/prueba/controllers/
> > default.py", line 20, in 
> >  File "/home/lisandro/pylicencias/gluon/globals.py", line 95, in
> > 
> >    self._caller = lambda f: f()
> >  File "/home/lisandro/pylicencias/applications/prueba/controllers/
> > default.py", line 14, in index
> >    form = SQLFORM.factory(db.dog)
> >  File "/home/lisandro/pylicencias/gluon/sqlhtml.py", line 1182, in
> > factory
> >    return SQLFORM(SQLDB(None).define_table(table_name, *fields),
> >  File "/home/lisandro/pylicencias/gluon/dal.py", line 3314, in
> > define_table
> >    t._create_references()
> >  File "/home/lisandro/pylicencias/gluon/dal.py", line 3607, in
> > _create_references
> >    rtable = self._db[rtablename]
> >  File "/home/lisandro/pylicencias/gluon/dal.py", line 3335, in
> > __getitem__
> >    return dict.__getitem__(self, str(key))
> > KeyError: 'person'
> > --
>
> > The SAME code, but using SQLFORM(db.dog) instead of
> > SQLFORM.factory(db.dog), works just fine.
> > The SAME code, but with an older version of web2py, works just fine.
> > What happened to SQLFORM.factory? Some bug? Or it's just me that I'm
> > doing something wrong?
>
> > Thanks in advance.
>
>


[web2py] Re: jquey effect problem

2010-12-28 Thread Luther Goh Lu Feng
Have you looked at the javascript console for errors yet?

On Dec 28, 5:28 pm, Sahil Arora  wrote:
> still not working
>
> On Mon, Dec 27, 2010 at 10:05 PM, Martín Mulone 
> wrote:
>
>
>
>
>
>
>
>
>
> > For me this code is working, the jquery is loaded?, your source code
> > point to /hello/static/js/jquery.js this exist?. Also try  to add ";"
> > to the end of jquery sentence and change ".two" with "#b".
>
> > 2010/12/27 Sahil Arora :
>
> > > I have attached the source html...i amgetting no idea
> > > On Mon, Dec 27, 2010 at 7:53 PM, Luther Goh Lu Feng 
> > > wrote:
>
> > >> I suggest inspecting the source to see the hhtml for the blank line.
>
> > >> On Dec 27, 9:10 pm, Sahil Arora  wrote:
> > >> > see the attachment..
> > >> > first is before clicking on hello
> > >> > second is after clicking..
> > >> > only a blank line comes
>
> > >> > On Mon, Dec 27, 2010 at 6:32 PM, Sahil Arora
> > >> > wrote:
>
> > >> > > i am doing this in default/index.html page in a application which
> > >> > > extends
> > >> > > layout.html which i think includes web2py_ajax.html . So is there
> > any
> > >> > > need
> > >> > > to include any thing else.
>
> > >> > > On Mon, Dec 27, 2010 at 6:29 PM, Luther Goh Lu Feng
> > >> > > wrote:
>
> > >> > >> The syntax is correct. Is the jquery library included?
>
> > >> > >> You need to include something like
>
> > >> > >> 

[web2py] Re: question about trapped ajax link

2010-12-28 Thread Luther Goh Lu Feng
The link can trigger off 2 calls to web2py_component(url,id1) and
web2py_component(url,id) via javascript.


On Dec 28, 4:45 pm, weheh  wrote:
> I'm trying to get a trapped ajax link, which deletes a record, to
> update two different divs on the screen. One div is rendered by its
> controller. But how about the other div, assuming that it is usually
> rendered by an entirely different controller? I tried using
> response.js and response.headers['web2py-component-command'] to render
> the other div, but it didn't work. I'm missing something.


[web2py] Re: question about trapped ajax link

2010-12-28 Thread Luther Goh Lu Feng
This is based on pure memory recall so I might be mistaken.

You may need to use the .live jquery method when new elements are
added. Try it if you run into issues even though you are super suer
your code is right.

On Dec 28, 9:25 pm, Luther Goh Lu Feng  wrote:
> The link can trigger off 2 calls to web2py_component(url,id1) and
> web2py_component(url,id) via javascript.
>
> On Dec 28, 4:45 pm, weheh  wrote:
>
>
>
>
>
>
>
> > I'm trying to get a trapped ajax link, which deletes a record, to
> > update two different divs on the screen. One div is rendered by its
> > controller. But how about the other div, assuming that it is usually
> > rendered by an entirely different controller? I tried using
> > response.js and response.headers['web2py-component-command'] to render
> > the other div, but it didn't work. I'm missing something.


[web2py] New plugin for star rating

2010-12-28 Thread Arun K.Rajeevan
http://www.web2py.com/plugins/default/rating

I took this rating plug-in and modified a bit. 
This plug-in uses jQuery extension and I'm aware that there is a better 
rating jQuery plug-in (http://orkans-tmp.22web.net/star_rating/).
I've plan to port it to that js library. 

But for less complex things, this plugin will suffice. dependency is so 
small. (other one need jQuery-ui too & I prefer to make my client to 
download as less content as needed.)

I fixed some errors.

My version now support some things that's not there in original version

0) It uses same syntax as original plug-in (so home back again)
1) support to include more than one rating widget per page.
2) if the parent table for which we are using rating has a field called 
'rate' of type dobule, then average rating will be added to that field too.
It'll be handy, if we have to run complex queries on that table 
involving rating. So, this make less db calls.
Also, this degrades gracefully, if there's no 'rating' field in the 
table without making any noise. 
3) Now, added support to display same rating for same record twice in a 
page.
4) Split stars is supported now. 

To download the plug-in, please visit 
https://bitbucket.org/kra3/rating-plugin-for-web2py/downloads

Looking forward to here your comments and possible features that can be 
added. 
(I know, it doesn't support callback functions now, may be I release another 
one that uses star rating jq plugin for that to make this one simple and 
lean) 


[web2py] Re: New plugin for star rating

2010-12-28 Thread mr.freeze
Nice! Feel free to make a slice at web2pyslices.com.

On Dec 28, 8:51 am, "Arun K.Rajeevan"  wrote:
> http://www.web2py.com/plugins/default/rating
>
> I took this rating plug-in and modified a bit.
> This plug-in uses jQuery extension and I'm aware that there is a better
> rating jQuery plug-in (http://orkans-tmp.22web.net/star_rating/).
> I've plan to port it to that js library.
>
> But for less complex things, this plugin will suffice. dependency is so
> small. (other one need jQuery-ui too & I prefer to make my client to
> download as less content as needed.)
>
> I fixed some errors.
>
> My version now support some things that's not there in original version
>
> 0) It uses same syntax as original plug-in (so home back again)
> 1) support to include more than one rating widget per page.
> 2) if the parent table for which we are using rating has a field called
> 'rate' of type dobule, then average rating will be added to that field too.
>     It'll be handy, if we have to run complex queries on that table
> involving rating. So, this make less db calls.
>     Also, this degrades gracefully, if there's no 'rating' field in the
> table without making any noise.
> 3) Now, added support to display same rating for same record twice in a
> page.
> 4) Split stars is supported now.
>
> To download the plug-in, please 
> visithttps://bitbucket.org/kra3/rating-plugin-for-web2py/downloads
>
> Looking forward to here your comments and possible features that can be
> added.
> (I know, it doesn't support callback functions now, may be I release another
> one that uses star rating jq plugin for that to make this one simple and
> lean)


[web2py] Re: Logging of impersonation events

2010-12-28 Thread alexandremasbr
I used auth.add_permission(user_group_id,'impersonate','auth_user',0),

since I want to allow to impersonate any user.



On 27 dez, 17:14, mdipierro  wrote:
> Did you
>
> auth.add_permission(user_group_id,'impresonate','auth_user',217)
>
> ?
>
> On Dec 27, 12:51 pm, alexandremasbr  wrote:
>
> > Not working yet. It not recognize the request.post_vars
> > Please, give me a working example.
>
> > I used the form below
> > Simulate User: > class="hidden"> > div>
>
> > Alexandre
>
> > On 27 dez, 16:46, alexandremasbr  wrote:
>
> > > Not working yet. It not recognize the request.post_vars
>
> > > Please, give me a working example.
>
> > > Alexandre
>
> > > On 27 dez, 15:53, mdipierro  wrote:
>
> > > > fixed in trunk.
>
> > > > On Dec 27, 11:43 am, alexandremasbr  wrote:
>
> > > > > Massimo,
>
> > > > > I find the answer, but there is a bug, anyway.
>
> > > > > The id have to be send by POST, but generates a error caused by a typo
> > > > > in tools.py
>
> > > > >     if requested_id == DEFAULT and not rquest.post_vars:
> > > > > NameError: global name 'rquest' is not defined
>
> > > > > Please correct it.
>
> > > > > Alexandre
>
> > > > > On 27 dez, 15:26, alexandremasbr  wrote:
>
> > > > > > Massimo,
>
> > > > > > I usedimpersonationin a app, and update to 1.91.4, and it don't work
> > > > > > anymore, using the described in the book.
>
> > > > > > How it works now?
>
> > > > > > Alexandre
>
> > > > > > On 8 dez, 05:16, mdipierro  wrote:
>
> > > > > > > I will add logging.
>
> > > > > > > Mind that it has pointed out that impersonate/0 presents a mild
> > > > > > > security risk. We have already changed the impersonate action in 
> > > > > > > trunk
> > > > > > > and not you have to submit the user_id via POST to impersonate.
>
> > > > > > > I am still not 100% happy with this but since it is a security 
> > > > > > > issue
> > > > > > > we are breaking backward compatibility for this action. The 
> > > > > > > change for
> > > > > > > you will be minimal.
>
> > > > > > > Massimo
>
> > > > > > > On Dec 8, 1:12 am, Markus Schmitz  
> > > > > > > wrote:
>
> > > > > > > > Hi everybody,
>
> > > > > > > > I am working on a new site, where we also plan to use the
> > > > > > > >impersonationfeature for support purposes, which is very helpful.
> > > > > > > > Theimpersonationworks perfectly, but it looks like there is no 
> > > > > > > > log
> > > > > > > > in the auth_event table of this happening.
>
> > > > > > > > Is this intended or did I look at the wrong place?
>
> > > > > > > > Also as I can go back to the original user with impersonate/0, 
> > > > > > > > where
> > > > > > > > does web2py store the original user? We could use this to store 
> > > > > > > > on
> > > > > > > > each update and create not only the current user, but also the 
> > > > > > > > actual
> > > > > > > > user (similar to the effective and actual user id in unix 
> > > > > > > > systems).
>
> > > > > > > > Regards
>
> > > > > > > > Markus
>
>


[web2py] Re: Mail.send failure:STARTTLS ...

2010-12-28 Thread Martin Weissenboeck
I have found a solution:

In the file db.py I have found the following lines:
Line 37-39:

mail.settings.server = 'smtp.gmail.com:587'  # your SMTP server
mail.settings.sender = 'myqmailaddr...@gmail.com' # your email
mail.settings.login = 'mygmailaddr...@gmail.com:mygmailpassword'# your
credentials or None


Line 121-123:

mail.settings.server = settings.email_sender
mail.settings.sender = settings.email_sender
mail.settings.login = settings.email_login


*I do not understand what the purpose of these lines is. I have commented
these lines out and now sending by Gmail works very well.*

# mail.settings.server = settings.email_sender
# mail.settings.sender = settings.email_sender
# mail.settings.login = settings.email_login


And my localhost needs tls=False:

mail.settings.server = 'localhost:25'
mail.settings.sender = 'off...@mydomain.com'
mail.settings.tls = False
mail.settings.login = None

*By the way: I had to change #*

*"Click on the link http://..."; to *
*"Click on the link https://..."; *

***(lines 88 and 93)*

2010/12/28 Martin Weissenboeck 

> Hi,
>
> I want my website to send emails.
>
> I have tried (in db.py)
>
> mail.settings.server = 'smtp.gmail.com:587'  # your SMTP server
> mail.settings.sender = 'mygmailaddr...@gmail.com' # your email
> mail.settings.login = 'mygmailaddr...@gmail.com:mygmailpassword'# your
> credentials or None
>
>
> and
>
> mail.settings.server = '127.0.0.1'  # your SMTP server
> mail.settings.sender = 'off...@mydomain.com' # your email
> mail.settings.login = None# your credentials or None
>
>
> In both cases I got the message
>
> *WARNING:web2py:Mail.send failure:STARTTLS extension not supported by
> server.*
>
>
> Pure Python works fine:
>
> # python2.7
> >>> import smtplib
> >>> server = smtplib.SMTP('127.0.0.1')
> >>> server.sendmail('a...@test.com','mygmailaddr...@gmail.com','test')
>
>
> Operating system: CentOS
>
> What shall I do?
>
> With kind regards
> Martin
>


[web2py] Re: 1.91.4 error reading version file

2010-12-28 Thread reyelts
Both downloads were done using Linux, which wouldn't be playing around
with the names like Windows. The downloads were done to a clean/empty
directory, so no infection from a prior file, either.


Re: [web2py] Re: 1.91.4 error reading version file

2010-12-28 Thread Jonathan Lundell
On Dec 28, 2010, at 8:34 AM, reyelts wrote:
> 
> Both downloads were done using Linux, which wouldn't be playing around
> with the names like Windows. The downloads were done to a clean/empty
> directory, so no infection from a prior file, either.

What does unzip -l show you on the downloaded .zip? (I used unzip -l filename | 
grep -i version.)

Re: [web2py] SQLFORM into a pop window

2010-12-28 Thread David J.

Can I have a peek at the app also? I am trying to get this working as well.

Thanks.



On 12/28/10 1:37 AM, Kenneth Lundström wrote:

Thank you Bruno,

my first thought when I tested it was that this doesn´t work at all, 
but now I see that it works quite nice.



Kenneth


Attached is an app which opens a form in a modal box.

2010/12/27 Kenneth Lundström >


Does anybody have a example of how to make a sqlform open up in a
popup window?


Kenneth




--

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






[web2py] Re: New plugin for star rating

2010-12-28 Thread mdipierro
Would you send me a patch to plugin-wiki with your changes?

On Dec 28, 8:51 am, "Arun K.Rajeevan"  wrote:
> http://www.web2py.com/plugins/default/rating
>
> I took this rating plug-in and modified a bit.
> This plug-in uses jQuery extension and I'm aware that there is a better
> rating jQuery plug-in (http://orkans-tmp.22web.net/star_rating/).
> I've plan to port it to that js library.
>
> But for less complex things, this plugin will suffice. dependency is so
> small. (other one need jQuery-ui too & I prefer to make my client to
> download as less content as needed.)
>
> I fixed some errors.
>
> My version now support some things that's not there in original version
>
> 0) It uses same syntax as original plug-in (so home back again)
> 1) support to include more than one rating widget per page.
> 2) if the parent table for which we are using rating has a field called
> 'rate' of type dobule, then average rating will be added to that field too.
>     It'll be handy, if we have to run complex queries on that table
> involving rating. So, this make less db calls.
>     Also, this degrades gracefully, if there's no 'rating' field in the
> table without making any noise.
> 3) Now, added support to display same rating for same record twice in a
> page.
> 4) Split stars is supported now.
>
> To download the plug-in, please 
> visithttps://bitbucket.org/kra3/rating-plugin-for-web2py/downloads
>
> Looking forward to here your comments and possible features that can be
> added.
> (I know, it doesn't support callback functions now, may be I release another
> one that uses star rating jq plugin for that to make this one simple and
> lean)


[web2py] Re: Not open source yet... but

2010-12-28 Thread LightDot
Very nice!

I hope we'll be able to take a peak at the source code in the future.


[web2py] Re: Not open source yet... but

2010-12-28 Thread David Marko
Why tornado as webserver? Any observations you can share?

David


[web2py] Re: Web2Py Foundation?

2010-12-28 Thread mdipierro
A foundation is a corporation and, believe it or not, in US a
corporation is a person:

  
http://www.professorbainbridge.com/professorbainbridgecom/2010/01/the-corporation-is-a-legal-person-get-over-it.html

The Django foundation was created two years ago (and Django is 4-5
years older than web2py). Do you have any evidence that it has
improved its popularity:

  http://www.google.com/trends?q=django?

Python has a foundation and it looks to me it is always broke. I just
spoke with a recruiter that was looking for Python programmers for a
big US bank and I complained that his client relied on a product
(Python) and did not make any donation to support it. The python
developers are not supported by the foundation, as far as I know.

A foundation has costs higher than a corporation and I do not get
enough donation to cover those costs. A corporation
(experts4solutions) is cheaper (it still costs at least $500/year of
my own money). Moreover a foundation implies that design decision are
taken by committee and I do not believe in that.

I consult with core developers and users on important matters but I
think there has to be one individual who ultimately takes decisions
about the direction of the project.

We have explored the possibility of joining the free software
conservatory but we got no feedback.

Rails is owned by a corporation (37signals) which is owned by one
individual. It seems to be the model works well for them. In my case I
decided not to pass copyright and trademark to experts4solutions
because I thought some would have criticized it.

I am not the only committer to the main web2py branch. Jonathan L. is
also a committer and will use his power in case I am incapacitated.
Yet, that should not be a crowded space in order to avoid internal
conflicts.

I will write a will that explains what happens to the web2py trademark
and copyright in case I die.

Massimo




On Dec 28, 2:12 am, Graham Dumpleton 
wrote:
> On Tuesday, December 28, 2010 5:37:30 PM UTC+11, mdipierro wrote:
>
> > Not sure what a single person framework means. This framework counts
> > almost 100 contributors and at least 50 people very skilled here. If I
> > get hit by a track any of them can take over by forking my branch as
> > allowed by the license.
>
> That last line actually supports the idea that a piece of software is owned
> and controlled by a single person. If a piece of software was owned by a
> group, be it a corporation or a foundation, the death of the core developer
> would make no difference as it would continue to be developed within the
> structure of that corporation or foundation and copyright still held by the
> continuing entity.
>
> In your case, if you get hit by a bus driven by a disgruntled Python
> developer, then no one else can simply take over the software as it is now,
> using any existing legal structure etc. Instead it would as you say need to
> be forked and in being forked legally may even need to change names as a
> result if you have sole rights over the original name.
>
> So, your own words support the contention expressed by some that it is
> 'single person framework' as far as ownership and control is concerned, an
> issue which is distinct from whether or not you have other contributors.
>
> Graham
>
> > The purpose of the foundation is to collect money for development and
> > advertising. Other organization like Rails have chose to create a
> > company instead of a foundation.
>
> > We have created a company (experts4solutions.com) whose purpose is to
> > promote skilled web2py professionals (and you can joins), foster
> > web2py projects, sell consulting and long term support contracts.
>
> > This was advertised here a few months ago. Some users have joined.
>
> > Massimo
>
> > On Dec 27, 9:46 pm, Pepe Araya  wrote:
> > > Hi,
>
> > > some news about this topic?
>
> > > I think 2 things are going in favor of creating a foundation or
> > [whatever]:
> > > 1. the community has grown a lot.
> > > 2. in all the reviews I read about web2py, always, always, ALWAYS!!! say
> > it
> > > is a single-person framework and that takes away the future security of
> > > their development.
>
> > > kind regards
>
> > > Pepe
>
>


[web2py] Re: Web2Py Foundation?

2010-12-28 Thread VP
For what it's worth, here's my 2 cents:

I think the concern that web2py is a one-man framework and how the
makes enterprises (big guys) adopt web2py is a valid concern.
Although in theory, people can simply fork web2py when Massimo no
longer commits to the project, for whichever reason, from a
bystander's point of view, it doesn't seem that easy.  I am not
talking about a legal perspective, I am talking about the meat of the
matter.  When I look at web2py's project on Google, there are a dozen
developers.  And most of the fixes are done by Massimo.  And I maybe
wrong, but I don't think web2py has a #2 guy yet (in terms of intimate
technical know-how or time commitment).   So the question: who can
take over web2py, if Massimo no longer commits to it for whatever
reason?  It is not clear.   So I think this concern is legit.

At the same time, I think forming legal entities might not effectively
address this concern.  It might even hurt it with much legal and
administrative overhead.   Drupal did not form any legal entity until
it was really established with hundreds of developers and thousands
modules.

I think the real concern is that we need #2, #3, etc. guys, who know
web2py as much as Massimo.  I don't have an answer to this, but I
think one way has to do with documentation, or rather a platform that
assists developers to really understand the inner workings of web2py
to make it really natural for them contribute when something goes
wrong.

Drawing a lesson from Drupal, it has a beatiful API documentation
system, a beautiful bug reporting mechanism.  And it is a magnitude
more complex than web2py.

In summary, I think one way to address this concern is establish a
platform so that it really helps developers learn about the inner
workings of web2py, fix and report bugs, etc.











[web2py] Re: Not open source yet... but

2010-12-28 Thread mdipierro
I needed something that could do http get, http post and comet via
html5 websockets.

I looked at the other options gevent, twisted, etc, I either had
installation problems, or performance issues, or it was hard to figure
it out how to it.

With tornado this was trivial:

- begin --
LISTENERS = []
class NewMsgHandler(tornado.web.RequestHandler):
def get(self):
self.write('Hello')
def post(self):
data = self.request.arguments['data'][0]
[element.write_message(data) for element in LISTENERS]
class RealtimeHandler(tornado.websocket.WebSocketHandler):
def open(self):
LISTENERS.append(self)
def on_message(self, message):
pass
def on_close(self):
LISTENERS.remove(self)
application = tornado.web.Application([
(r'/', NewMsgHandler), # for get and post
(r'/websocket/', RealtimeHandler), # for websockets
], auto_reload=True)
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen()
tornado.ioloop.IOLoop.instance().start()
 end 

On post it streams data to all clients connected with websockets. It
runs as fast as bare metal. It cannot possibly be faster. I tried with
up with 100 posts/seconds with 10 connected clients) and 1 post/second
with 500 connected clients (my my laptop which does not even support
epoll).

Web2py acts like a proxy for the post (does the form generation,
validation, database IO, etc.) but stays out of the way as far as
websockets are concerned. Web2py serves all the pages that need db
access.

The clients receive data from tornado and store (do not process it
else slows down the server, it queues it). The processing.js thread
processes the data 5times/second for a smooth interface.

Massimo

On Dec 28, 11:27 am, David Marko  wrote:
> Why tornado as webserver? Any observations you can share?
>
> David


Re: [web2py] Re: Not open source yet... but

2010-12-28 Thread Albert Abril
I think Orbited has the feature of emulate websocket.
http://orbited.org/wiki/WebSocket

On Tue, Dec 28, 2010 at 7:04 PM, mdipierro  wrote:

> I needed something that could do http get, http post and comet via
> html5 websockets.
>
> I looked at the other options gevent, twisted, etc, I either had
> installation problems, or performance issues, or it was hard to figure
> it out how to it.
>
> With tornado this was trivial:
>
> - begin --
> LISTENERS = []
> class NewMsgHandler(tornado.web.RequestHandler):
>def get(self):
>self.write('Hello')
>def post(self):
>data = self.request.arguments['data'][0]
>[element.write_message(data) for element in LISTENERS]
> class RealtimeHandler(tornado.websocket.WebSocketHandler):
>def open(self):
>LISTENERS.append(self)
>def on_message(self, message):
>pass
>def on_close(self):
>LISTENERS.remove(self)
> application = tornado.web.Application([
>(r'/', NewMsgHandler), # for get and post
>(r'/websocket/', RealtimeHandler), # for websockets
>], auto_reload=True)
> http_server = tornado.httpserver.HTTPServer(application)
> http_server.listen()
> tornado.ioloop.IOLoop.instance().start()
>  end 
>
> On post it streams data to all clients connected with websockets. It
> runs as fast as bare metal. It cannot possibly be faster. I tried with
> up with 100 posts/seconds with 10 connected clients) and 1 post/second
> with 500 connected clients (my my laptop which does not even support
> epoll).
>
> Web2py acts like a proxy for the post (does the form generation,
> validation, database IO, etc.) but stays out of the way as far as
> websockets are concerned. Web2py serves all the pages that need db
> access.
>
> The clients receive data from tornado and store (do not process it
> else slows down the server, it queues it). The processing.js thread
> processes the data 5times/second for a smooth interface.
>
> Massimo
>
> On Dec 28, 11:27 am, David Marko  wrote:
> > Why tornado as webserver? Any observations you can share?
> >
> > David
>



-- 
Albert Abril,
@desmondo
http://bressol.org


Re: [web2py] Re: Not open source yet... but

2010-12-28 Thread Bruno Rocha
I Guess that Cyclone with RESTMQ is a good option for that. (I read about
it)

https://github.com/gleicon/restmq

http://www.restmq.com/

2010/12/28 mdipierro 

> I needed something that could do http get, http post and comet via
> html5 websockets.
>
> I looked at the other options gevent, twisted, etc, I either had
> installation problems, or performance issues, or it was hard to figure
> it out how to it.
>
> With tornado this was trivial:
>
> - begin --
> LISTENERS = []
> class NewMsgHandler(tornado.web.RequestHandler):
>def get(self):
>self.write('Hello')
>def post(self):
>data = self.request.arguments['data'][0]
>[element.write_message(data) for element in LISTENERS]
> class RealtimeHandler(tornado.websocket.WebSocketHandler):
>def open(self):
>LISTENERS.append(self)
>def on_message(self, message):
>pass
>def on_close(self):
>LISTENERS.remove(self)
> application = tornado.web.Application([
>(r'/', NewMsgHandler), # for get and post
>(r'/websocket/', RealtimeHandler), # for websockets
>], auto_reload=True)
> http_server = tornado.httpserver.HTTPServer(application)
> http_server.listen()
> tornado.ioloop.IOLoop.instance().start()
>  end 
>
> On post it streams data to all clients connected with websockets. It
> runs as fast as bare metal. It cannot possibly be faster. I tried with
> up with 100 posts/seconds with 10 connected clients) and 1 post/second
> with 500 connected clients (my my laptop which does not even support
> epoll).
>
> Web2py acts like a proxy for the post (does the form generation,
> validation, database IO, etc.) but stays out of the way as far as
> websockets are concerned. Web2py serves all the pages that need db
> access.
>
> The clients receive data from tornado and store (do not process it
> else slows down the server, it queues it). The processing.js thread
> processes the data 5times/second for a smooth interface.
>
> Massimo
>
> On Dec 28, 11:27 am, David Marko  wrote:
> > Why tornado as webserver? Any observations you can share?
> >
> > David
>



-- 

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


[web2py] variable include

2010-12-28 Thread mattynoce
hi all. i'm trying to have variable files included into my view, but
i'm not sure that it's possible since it seems includes are compiled
before runtime.

i want to do something like:

{{include nextStep + '.html'}}


that isn't working because it gets compiled. so i tried:

{{function getInclude(name):}}
{{include name + '.html'}}
{{return}}

{{getInclude(nextStep)}}


but that doesn't solve the problem. i need the include to be run
through the template interpreter, so i'm not sure i can do it in the
controller. is there any other solution available?

matt


[web2py] Re: Not open source yet... but

2010-12-28 Thread mdipierro
I was talking serverside code.

Client-side my app only works with Chrome but I am looking into these:
https://github.com/gimite/web-socket-js
http://socket.io/

The second looks really nice.

On Dec 28, 12:13 pm, Albert Abril  wrote:
> I think Orbited has the feature of emulate 
> websocket.http://orbited.org/wiki/WebSocket
>
>
>
> On Tue, Dec 28, 2010 at 7:04 PM, mdipierro  wrote:
> > I needed something that could do http get, http post and comet via
> > html5 websockets.
>
> > I looked at the other options gevent, twisted, etc, I either had
> > installation problems, or performance issues, or it was hard to figure
> > it out how to it.
>
> > With tornado this was trivial:
>
> > - begin --
> > LISTENERS = []
> > class NewMsgHandler(tornado.web.RequestHandler):
> >    def get(self):
> >        self.write('Hello')
> >    def post(self):
> >        data = self.request.arguments['data'][0]
> >        [element.write_message(data) for element in LISTENERS]
> > class RealtimeHandler(tornado.websocket.WebSocketHandler):
> >    def open(self):
> >        LISTENERS.append(self)
> >    def on_message(self, message):
> >        pass
> >    def on_close(self):
> >        LISTENERS.remove(self)
> > application = tornado.web.Application([
> >    (r'/', NewMsgHandler), # for get and post
> >    (r'/websocket/', RealtimeHandler), # for websockets
> >    ], auto_reload=True)
> > http_server = tornado.httpserver.HTTPServer(application)
> > http_server.listen()
> > tornado.ioloop.IOLoop.instance().start()
> >  end 
>
> > On post it streams data to all clients connected with websockets. It
> > runs as fast as bare metal. It cannot possibly be faster. I tried with
> > up with 100 posts/seconds with 10 connected clients) and 1 post/second
> > with 500 connected clients (my my laptop which does not even support
> > epoll).
>
> > Web2py acts like a proxy for the post (does the form generation,
> > validation, database IO, etc.) but stays out of the way as far as
> > websockets are concerned. Web2py serves all the pages that need db
> > access.
>
> > The clients receive data from tornado and store (do not process it
> > else slows down the server, it queues it). The processing.js thread
> > processes the data 5times/second for a smooth interface.
>
> > Massimo
>
> > On Dec 28, 11:27 am, David Marko  wrote:
> > > Why tornado as webserver? Any observations you can share?
>
> > > David
>
> --
> Albert Abril,
> @desmondohttp://bressol.org


[web2py] experts4solution: please update your profile

2010-12-28 Thread mdipierro
... and after you have done so, email me personally.


[web2py] Iniciar con python

2010-12-28 Thread Nolberto
Soy nuevo en este lenguaje, me pueden orientar por donde empiezo, que
libros o tutoriales leo.
Utilizo UBUNTU, que herramientas me descargo, tanto librerias como
IDE, Gestor de base de datos, etc


Re: [web2py] Re: try web2py with cherrypy, diesel, eventlet, fapws,flup, gnuicorn, paste, rocket, tornado, twisted, wsgiref

2010-12-28 Thread Branko Vukelić
Toranado used to be much faster (non-blocking), but it's been
stagnating lately because of the ever-increasing overhead. They've
been alrted, and will hopefully work on the performance.

Have you tried bjoern, btw?

On Tue, Dec 28, 2010 at 7:44 AM, mdipierro  wrote:
> Anyway... I have now try a few of these servers, specifically for
> comet via HTML5 WebSocket. I am impressed by Tornado for both the ease
> of use and performance.
>
> http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
>
> Massimo
>
>
>
> On Dec 28, 12:31 am, mdipierro  wrote:
>> Look at the code. It is trivial to add it.
>>
>> On Dec 27, 8:00 pm, Bruno Rocha  wrote:
>>
>> > Just tried Cyclone -https://github.com/fiorix/cyclone-It is based on
>> >  twisted then I thought that would run
>>
>> > <*cyclone*>
>> > rochacbr...@macubuntu:~/projects/web2py$ python anyserver.py -s cyclone -p
>> > 8081
>> > starting cyclone on 127.0.0.1:8081...
>> > Traceback (most recent call last):
>> >   File "anyserver.py", line 171, in 
>> >     main()
>> >   File "anyserver.py", line 168, in main
>>
>> >  run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
>> >   File "anyserver.py", line 129, in run
>> >     getattr(Servers,servername)(application,(ip,int(port)))
>> > AttributeError: class Servers has no attribute 'cyclone'
>> > 
>>
>> > --
>>
>> > Bruno Rochahttp://about.me/rochacbruno/bio
>>
>>
>



-- 
Branko Vukelic

stu...@brankovukelic.com
http://www.brankovukelic.com/


Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread Branko Vukelić
On Tue, Dec 28, 2010 at 6:28 PM, mdipierro  wrote:
>  http://www.google.com/trends?q=django?

FTR, the graph is for the 'keyword' Django, which can be many things,
and doesn't reflect the popularity of either the keyword or the Django
project. The overall volume of searches for the keyword includes also
items like Django Reinhardt, etc.

Here is a bit more realistic trend graph:

http://trends.google.com/websites?q=www.djangoproject.com&sa=N

-- 
Branko Vukelic

stu...@brankovukelic.com
http://www.brankovukelic.com/


[web2py] Re: Web2Py Foundation?

2010-12-28 Thread mdipierro
This is incorrect. You should look at the "thanks" in the commit log.
I am not happy with Ranking contributors but

Jonathan L., Thadeus B., Mariano R., Alvaro J., Iceberg to name a few.
They know web2py as well as I do (and some parts better).

Massimo

On Dec 28, 12:03 pm, VP  wrote:
> For what it's worth, here's my 2 cents:
>
> I think the concern that web2py is a one-man framework and how the
> makes enterprises (big guys) adopt web2py is a valid concern.
> Although in theory, people can simply fork web2py when Massimo no
> longer commits to the project, for whichever reason, from a
> bystander's point of view, it doesn't seem that easy.  I am not
> talking about a legal perspective, I am talking about the meat of the
> matter.  When I look at web2py's project on Google, there are a dozen
> developers.  And most of the fixes are done by Massimo.  And I maybe
> wrong, but I don't think web2py has a #2 guy yet (in terms of intimate
> technical know-how or time commitment).   So the question: who can
> take over web2py, if Massimo no longer commits to it for whatever
> reason?  It is not clear.   So I think this concern is legit.
>
> At the same time, I think forming legal entities might not effectively
> address this concern.  It might even hurt it with much legal and
> administrative overhead.   Drupal did not form any legal entity until
> it was really established with hundreds of developers and thousands
> modules.
>
> I think the real concern is that we need #2, #3, etc. guys, who know
> web2py as much as Massimo.  I don't have an answer to this, but I
> think one way has to do with documentation, or rather a platform that
> assists developers to really understand the inner workings of web2py
> to make it really natural for them contribute when something goes
> wrong.
>
> Drawing a lesson from Drupal, it has a beatiful API documentation
> system, a beautiful bug reporting mechanism.  And it is a magnitude
> more complex than web2py.
>
> In summary, I think one way to address this concern is establish a
> platform so that it really helps developers learn about the inner
> workings of web2py, fix and report bugs, etc.


[web2py] Re: try web2py with cherrypy, diesel, eventlet, fapws,flup, gnuicorn, paste, rocket, tornado, twisted, wsgiref

2010-12-28 Thread mdipierro
no

On Dec 28, 9:39 am, Branko Vukelić  wrote:
> Toranado used to be much faster (non-blocking), but it's been
> stagnating lately because of the ever-increasing overhead. They've
> been alrted, and will hopefully work on the performance.
>
> Have you tried bjoern, btw?
>
>
>
> On Tue, Dec 28, 2010 at 7:44 AM, mdipierro  wrote:
> > Anyway... I have now try a few of these servers, specifically for
> > comet via HTML5 WebSocket. I am impressed by Tornado for both the ease
> > of use and performance.
>
> >http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
>
> > Massimo
>
> > On Dec 28, 12:31 am, mdipierro  wrote:
> >> Look at the code. It is trivial to add it.
>
> >> On Dec 27, 8:00 pm, Bruno Rocha  wrote:
>
> >> > Just tried Cyclone -https://github.com/fiorix/cyclone-Itis based on
> >> >  twisted then I thought that would run
>
> >> > <*cyclone*>
> >> > rochacbr...@macubuntu:~/projects/web2py$ python anyserver.py -s cyclone 
> >> > -p
> >> > 8081
> >> > starting cyclone on 127.0.0.1:8081...
> >> > Traceback (most recent call last):
> >> >   File "anyserver.py", line 171, in 
> >> >     main()
> >> >   File "anyserver.py", line 168, in main
>
> >> >  run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
> >> >   File "anyserver.py", line 129, in run
> >> >     getattr(Servers,servername)(application,(ip,int(port)))
> >> > AttributeError: class Servers has no attribute 'cyclone'
> >> > 
>
> >> > --
>
> >> > Bruno Rochahttp://about.me/rochacbruno/bio
>
> --
> Branko Vukelic
>
> stu...@brankovukelic.comhttp://www.brankovukelic.com/


[web2py] Re: unique constraint of multiple columns (at database level)

2010-12-28 Thread ron_m
I would like to respectfully ask how a first and last name combined could be 
unique in the real world? There are lots of people with identical first and 
last names.

A better candidate in your table is Email.

I know that doesn't answer your question but I think it is worth 
consieration.

Ron


Re: [web2py] Iniciar con python

2010-12-28 Thread Bruno Rocha
Hay un grupo en tu idioma http://groups.google.com/group/web2py-usuarios

En primer lugar instalar python-tk (sudo apt-get install python-tk)

Descargue la versión estable de web2py en web2py.com

Inicie el terminal con $ python2.X  web2py.py

Yo no uso IDE para el desarrollo. Yo uso el VI en la
terminal, e también el KomodoEdit para editar los
códigos y sqliteman para gestionar las bases de datos de las pruebas de
desarrollo.

Cuando estoy con Postgres u Oracle uso el AquaDataStudio

Para empezar web2py no necesita mucho, sólo web2py y un editor de código,
puede inicar con la interfaz web, y asegúrese de leer el tercer
capítulo del libro en web2py.com/book

-- 

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


2010/12/28 Nolberto 

> Soy nuevo en este lenguaje, me pueden orientar por donde empiezo, que
> libros o tutoriales leo.
> Utilizo UBUNTU, que herramientas me descargo, tanto librerias como
> IDE, Gestor de base de datos, etc


Re: [web2py] Iniciar con python

2010-12-28 Thread Bruno Rocha
Spanish version of teh book ->
http://www.latinuxpress.com/books/drafts/web2py/

2010/12/28 Nolberto 

> Soy nuevo en este lenguaje, me pueden orientar por donde empiezo, que
> libros o tutoriales leo.
> Utilizo UBUNTU, que herramientas me descargo, tanto librerias como
> IDE, Gestor de base de datos, etc




-- 

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


Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread Bruno Rocha
>
> > So the question: who can
> > take over web2py, if Massimo no longer commits to it for whatever
> > reason?  It is not clear.
>

Looking at people list at google code page, I see Jlundell with comitter
role. http://code.google.com/p/web2py/people/list

Other contributors can write code reviews and send patches to Massimo or
Jlundell to apply
(I think it is OK because they are who knows web2py core very better)

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


[web2py] Re: variable include

2010-12-28 Thread ron_m
Its ugly but you must have a finite and small number of nextStep targets

{{if nextStep == 'step1':}}
  {{include 'step1.html'}}
{{elif nextStep == 'step2':}}
  {{include 'step2.html'}}
..
will get you going but introduces a maintenance issue if you add a step 
later that ou have to remember to come back to here and fix.

The problem is the include passes through the template generation and that 
pulls that body of code inline during the template substitution phase before 
any code executes. I don't think it is possible to have a variable inside 
the include statement. I would like to be proven wrong. :-)

Ron


[web2py] GEO region Searching...

2010-12-28 Thread Jason Brower
I know we can find good inforamtion geographical stuff in teh web2py
manual.  But is there a way to, for example, find things in a search
area around a coordinate?
My guess is that I should do the following:
Get the logged in users geo information (lat and long)
Get the distance away that I want to search around that person and
calculate the lat and logitudes of that area...
Find if the lat and log of the items.lat and items.long in my database
are within the regions of the users.lat and users.log and the (areas.lat
and areas.long)* for for four directions.
Does that make sences?  Would that be the best aproach?
Best Regards,
Jason Brower



Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread pbreit
I think we're OK for now. While there is a small perceptual problem of 
web2py being a single person's effort, I think at this stage it is 
beneficial for Massimo to continue with his rapid and prudent improvements. 
The best thing now is for more people to become web2py experts. There's a 
lot of knowledge to be gained and distributed without needing commit status.

[web2py] Re: variable include

2010-12-28 Thread Luther Goh Lu Feng
Try using http://www.web2py.com/book/default/chapter/13#Components-and-Plugins

I think it should be what you are looking for.

On Dec 29, 3:05 am, ron_m  wrote:
> Its ugly but you must have a finite and small number of nextStep targets
>
> {{if nextStep == 'step1':}}
>   {{include 'step1.html'}}
> {{elif nextStep == 'step2':}}
>   {{include 'step2.html'}}
> ..
> will get you going but introduces a maintenance issue if you add a step
> later that ou have to remember to come back to here and fix.
>
> The problem is the include passes through the template generation and that
> pulls that body of code inline during the template substitution phase before
> any code executes. I don't think it is possible to have a variable inside
> the include statement. I would like to be proven wrong. :-)
>
> Ron


Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread Vasile Ermicioi
I think web2py (Massimo) is moving in the right direction making web2py more
modular  (dal)
or using some ready solution (rocket or cherrypy server before)
doing so we can easily get experts for different modules


Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread Jonathan Lundell
On Dec 28, 2010, at 11:05 AM, Bruno Rocha wrote:
> > So the question: who can
> > take over web2py, if Massimo no longer commits to it for whatever
> > reason?  It is not clear. 
> 
> Looking at people list at google code page, I see Jlundell with comitter 
> role. http://code.google.com/p/web2py/people/list
> 
> Other contributors can write code reviews and send patches to Massimo or 
> Jlundell to apply 
> (I think it is OK because they are who knows web2py core very better)
> 

I'm acting as a kind of emergency backup; ordinarily patches should go to 
Massimo.



Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread Michele Comitini
Should we push the expert4solutions brand a bit more? Yes but, not too
much IMHO. That would suffice for some time
eventually  expert4solutions should care about creating a foundation
or other amenities if there is  enough busine$$ or investment on
web2py.

mic

2010/12/28 pbreit :
> I think we're OK for now. While there is a small perceptual problem of
> web2py being a single person's effort, I think at this stage it is
> beneficial for Massimo to continue with his rapid and prudent improvements.
> The best thing now is for more people to become web2py experts. There's a
> lot of knowledge to be gained and distributed without needing commit status.


Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread ron_m
+1 we don't want too many cooks without a head chef.


Re: [web2py] experts4solution: please update your profile

2010-12-28 Thread Bruno Rocha
Is there a profile who needs to be updated ->
http://experts4solutions.com/e4s/default/expert/1

LOL :o)

2010/12/28 mdipierro 

> ... and after you have done so, email me personally.




-- 

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


Re: [web2py] Re: experts4solution: please update your profile

2010-12-28 Thread Michele Comitini
Who is that? ;-)
Well I endorsed him anyway :-)



2010/12/28 mdipierro :
> Ouch!
>
> On Dec 28, 1:27 pm, Bruno Rocha  wrote:
>> Is there a profile who needs to be updated 
>> ->http://experts4solutions.com/e4s/default/expert/1
>>
>> LOL :o)
>>
>> 2010/12/28 mdipierro 
>>
>> > ... and after you have done so, email me personally.
>>
>> --
>>
>> Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: Web2Py Foundation?

2010-12-28 Thread VP
I love the fact that if I have a problem with web2py and asked a
question, Massimo will likely answer it.  But the perceptual problem
of web2py is a single-person effort is real.  Massimo fixes most of
the bugs (it seems so).  Massimo is mainly responsible for PR.
Massimo is in charge of experts4solution (it appears so).  Massimo is
mainly in charge of documentation (the book) (it appears so).

Note that these are not necessary bad things.  But the concern is
real. Now, you can say this issue should not be a concern (i.e. we are
okay with the current setup).  Then that's a different perspective, a
different story.

Rapid improvement is great.  But the issue is not related to rapid
development.

Note that I'm playing the role of a devil advocate.  I'm not
criticizing.  The current set up is perfect for me.



> I think we're OK for now. While there is a small perceptual problem of
> web2py being a single person's effort, I think at this stage it is
> beneficial for Massimo to continue with his rapid and prudent improvements.
> The best thing now is for more people to become web2py experts. There's a
> lot of knowledge to be gained and distributed without needing commit status.


Re: [web2py] Re: experts4solution: please update your profile

2010-12-28 Thread Branko Vukelić
I think Massimo said you cannot endorse users with incomplete profiles.

On Tue, Dec 28, 2010 at 8:44 PM, Michele Comitini
 wrote:
> Who is that? ;-)
> Well I endorsed him anyway :-)
>
>
>
> 2010/12/28 mdipierro :
>> Ouch!
>>
>> On Dec 28, 1:27 pm, Bruno Rocha  wrote:
>>> Is there a profile who needs to be updated 
>>> ->http://experts4solutions.com/e4s/default/expert/1
>>>
>>> LOL :o)
>>>
>>> 2010/12/28 mdipierro 
>>>
>>> > ... and after you have done so, email me personally.
>>>
>>> --
>>>
>>> Bruno Rochahttp://about.me/rochacbruno/bio
>



-- 
Branko Vukelic

stu...@brankovukelic.com
http://www.brankovukelic.com/


[web2py] Re: try web2py with cherrypy, diesel, eventlet, fapws,flup, gnuicorn, paste, rocket, tornado, twisted, wsgiref - TORNADO tried

2010-12-28 Thread David Marko
I just tried tornado on windowsXP wirh Python 2.7. I just used apache ab and 
its 2-3x faster than Rocket on the same hardware.
'hello5' example show 60 req/sec for 'hello5' example. Usi ng roekt I'm 
getting cca. 21 req/sec.

Can you share your results? Please try some of ewb2py standard example so we 
can compare.
David

--
Server Software:TornadoServer/1.1
Server Hostname:localhost
Server Port:8081

Document Path:  /examples/simple_examples/hello5
Document Length:179 bytes

Concurrency Level:  150
Time taken for tests:   16.750 seconds
Complete requests:  1000
Failed requests:0
Write errors:   0
Total transferred:  512000 bytes
HTML transferred:   179000 bytes
Requests per second:59.70 [#/sec] (mean)
Time per request:   2512.500 [ms] (mean)
Time per request:   16.750 [ms] (mean, across all concurrent requests)
Transfer rate:  29.85 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:02  27.7  0 547
Processing:   484 2445 533.5   23284828
Waiting:  484 2443 533.5   23284828
Total:484 2447 538.7   23284828

Percentage of the requests served within a certain time (ms)
  50%   2328
  66%   2469
  75%   2500
  80%   2609
  90%   2781
  95%   3953
  98%   4125
  99%   4219


[web2py] Re: Loading component with vars

2010-12-28 Thread mattynoce
i can confirm. request.args always comes through, whether ajax or not.
request.vars is dependent upon ajax.

{{=LOAD('comment',
'conversation_dropdown.load',vars={'dashboard':True}, ajax=False)}}
: vars => {}

{{=LOAD('comment',
'conversation_dropdown.load',vars={'dashboard':True}, ajax=True)}}
: vars => {'dashboard': True}

{{=LOAD('comment', 'conversation_dropdown.load',args=[True],
ajax=False)}}
: args[0] => True

matt

On Oct 29, 3:09 pm, mdipierro  wrote:
> Without ajax the component is loaded without the current request and
> therefore there are two request objects. I guess web2py got confused.
> It is a bug and I will fix it but I have not yet tested that is the
> case.
>
> Massimo
>
> On Oct 29, 1:56 pm, Luther Goh Lu Feng  wrote:
>
> > Thank you. I have set ajax = True and the line works now. What is the
> > reason for this requirement?
>
> > On Oct 30, 2:52 am, mdipierro  wrote:
>
> > > I am not sure this works unless you do it with ajax=True. I need to
> > > check.
>
> > > On Oct 29, 1:50 pm, Luther Goh Lu Feng  wrote:
>
> > > > In one of my views, I loaded a component using:
>
> > > > {{=LOAD('comment', 
> > > > 'conversation_dropdown.load',vars={'dashboard':True}, ajax=False)}}
>
> > > > In the action:
>
> > > > def conversation_download():
> > > >      return{'test':request.vars.dashboard}
>
> > > > In conversation_dropdown.load, {{=test}} evaluates to none.
>
> > > > Have I gotten the syntax wrong somewhere?
>
>


[web2py] Re: Loading component with vars

2010-12-28 Thread mattynoce
ps version 1.89.1

On Dec 28, 12:12 pm, mattynoce  wrote:
> i can confirm. request.args always comes through, whether ajax or not.
> request.vars is dependent upon ajax.
>
> {{=LOAD('comment',
> 'conversation_dropdown.load',vars={'dashboard':True}, ajax=False)}}
> : vars => {}
>
> {{=LOAD('comment',
> 'conversation_dropdown.load',vars={'dashboard':True}, ajax=True)}}
> : vars => {'dashboard': True}
>
> {{=LOAD('comment', 'conversation_dropdown.load',args=[True],
> ajax=False)}}
> : args[0] => True
>
> matt
>
> On Oct 29, 3:09 pm, mdipierro  wrote:
>
> > Without ajax the component is loaded without the current request and
> > therefore there are two request objects. I guess web2py got confused.
> > It is a bug and I will fix it but I have not yet tested that is the
> > case.
>
> > Massimo
>
> > On Oct 29, 1:56 pm, Luther Goh Lu Feng  wrote:
>
> > > Thank you. I have set ajax = True and the line works now. What is the
> > > reason for this requirement?
>
> > > On Oct 30, 2:52 am, mdipierro  wrote:
>
> > > > I am not sure this works unless you do it with ajax=True. I need to
> > > > check.
>
> > > > On Oct 29, 1:50 pm, Luther Goh Lu Feng  wrote:
>
> > > > > In one of my views, I loaded a component using:
>
> > > > > {{=LOAD('comment', 
> > > > > 'conversation_dropdown.load',vars={'dashboard':True}, ajax=False)}}
>
> > > > > In the action:
>
> > > > > def conversation_download():
> > > > >      return{'test':request.vars.dashboard}
>
> > > > > In conversation_dropdown.load, {{=test}} evaluates to none.
>
> > > > > Have I gotten the syntax wrong somewhere?
>
>


[web2py] cannot define_table after executesql drop table

2010-12-28 Thread apple
I called define_table to create a table "product". This worked fine.
Then I called executesql("DROP TABLE PRODUCT"). The product table
appears to have been dropped from the database. However when I run the
application again it fails in the model in at the define_table line
with "OperationalError: no such table: product"

I am able to define_table("product2".) and db.product2.drop() and
define_table("product2") again. However as soon as I use the
manual SQL DROP it seems that I cannot use that table name again in
the database.

Is there somewhere the table names are stored? Is it possible to
cleanly delete tables outside the DAL using DROP TABLE?




Re: [web2py] cannot define_table after executesql drop table

2010-12-28 Thread Bruno Rocha
Best way is manually defining migration file names, all the table history
information and diffs are stored in /databases/xxx.table which is
randomly named.

You can do:

db.define_table('products',Field('name'),migrate='products.table')


In that way, when you need to purge the table information and history, just
delete the products.table file from /databases folder.





2010/12/28 apple 

> I called define_table to create a table "product". This worked fine.
> Then I called executesql("DROP TABLE PRODUCT"). The product table
> appears to have been dropped from the database. However when I run the
> application again it fails in the model in at the define_table line
> with "OperationalError: no such table: product"
>
> I am able to define_table("product2".) and db.product2.drop() and
> define_table("product2") again. However as soon as I use the
> manual SQL DROP it seems that I cannot use that table name again in
> the database.
>
> Is there somewhere the table names are stored? Is it possible to
> cleanly delete tables outside the DAL using DROP TABLE?
>
>
>


-- 

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


[web2py] Re: try web2py with cherrypy, diesel, eventlet, fapws,flup, gnuicorn, paste, rocket, tornado, twisted, wsgiref - TORNADO tried

2010-12-28 Thread David Marko
U just tested tornado using others 'example' pages and its much, much faster 
than rocket. It event doesnt generate failed requests comparing to rocket. 
Can tornado be better/faster solution then Apache wsgi? I mean some 
apache/nginx+reverse proxy & tornado+web2py?


https://github.com/fiorix/cyclone/wiki/benchmarks 

David


[web2py] Re: variable include

2010-12-28 Thread mattynoce
great call, luther. thank to you and ron for the help.

here was the solution:

1) have the main view code call a component i called "stepFunc"
2) have stepFunc then render the appropriate mini-view

[views]
** first, i defined a view for each step. so there's a folder at
default/views/step and it has files like step1.html, step2.html, etc.
**

[main view]
** the variable step contains something like 'step1' **

{{=LOAD(c='default', f='stepFunc.load', args=[step], ajax=False,
ajax_trap=False)}}


[controller]
** there needs to be some error handling but this is the basic gist **
def stepFunc():
step = None
if request.args:
step = request.args[0]
response.view = 'step/' + step + '.html'
return dict(step=step)

this solves the problem perfectly. the only downside is that the steps
don't have access to variable from the original view -- everything the
steps see must be passed by the stepFunc controller. so it functions
differently from an include in that way -- the only variable it
understands here is step.

matt

On Dec 28, 11:15 am, Luther Goh Lu Feng  wrote:
> Try usinghttp://www.web2py.com/book/default/chapter/13#Components-and-Plugins
>
> I think it should be what you are looking for.
>
> On Dec 29, 3:05 am, ron_m  wrote:
>
> > Its ugly but you must have a finite and small number of nextStep targets
>
> > {{if nextStep == 'step1':}}
> >   {{include 'step1.html'}}
> > {{elif nextStep == 'step2':}}
> >   {{include 'step2.html'}}
> > ..
> > will get you going but introduces a maintenance issue if you add a step
> > later that ou have to remember to come back to here and fix.
>
> > The problem is the include passes through the template generation and that
> > pulls that body of code inline during the template substitution phase before
> > any code executes. I don't think it is possible to have a variable inside
> > the include statement. I would like to be proven wrong. :-)
>
> > Ron
>
>


Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread Jonathan Lundell
On Dec 28, 2010, at 11:54 AM, VP wrote:
> 
> I love the fact that if I have a problem with web2py and asked a
> question, Massimo will likely answer it.  But the perceptual problem
> of web2py is a single-person effort is real.  Massimo fixes most of
> the bugs (it seems so).  Massimo is mainly responsible for PR.
> Massimo is in charge of experts4solution (it appears so).  Massimo is
> mainly in charge of documentation (the book) (it appears so).
> 
> Note that these are not necessary bad things.  But the concern is
> real. Now, you can say this issue should not be a concern (i.e. we are
> okay with the current setup).  Then that's a different perspective, a
> different story.

Offhand, I can think of at least three major projects that have a single person 
in charge, in one way or another: Linux, OpenBSD and Python. I don't know much 
about the OpenBSD and Python patch processes, but all Linux patches go through 
Linus. So in that sense, Massimo's role is not unprecedented.



[web2py] Re: try web2py with cherrypy, diesel, eventlet, fapws,flup, gnuicorn, paste, rocket, tornado, twisted, wsgiref - TORNADO tried

2010-12-28 Thread Graham Dumpleton
That site you reference is meaningless. Neither Django or web.py are web 
servers but application frameworks.

That is the same sort of flawed benchmarking that Tornado used to claim 
their web server was so much better when they first announced it. That is, 
they compared a hello world program written with a full stack web framework 
to a very basic hello world program written directly to low level web server 
API. The fairer comparison would have been basic WSGI hello world program to 
basic Tornado hello world program. Do that and you will find the results are 
very very different.

Anyway, when will people learn that these simplistic benchmarks are 
meaningless. Your site would never run at 100% capacity and you would never 
want it to. The overheads are also never usually going to be in the hosting 
mechanism unless you really screw up its configuration, which admittedly 
many do. Instead the real bottlenecks are in your application and database 
usage.

Ultimately these benchmark comparisons are little more than a pissing 
competition and you are just wasting your time. Use whatever solution you 
find fits your ability to manage it. If you find one solution too much for 
your level of knowledge then don't use it. Just because you cant get a 
solution to work doesn't mean there is something wrong with that solution. 
This though doesn't seem though to stop people rubbishing particular 
solutions even though reality is that the problem is their own incompetence 
and inability to get it running properly.

Graham

On Wednesday, December 29, 2010 7:28:20 AM UTC+11, David Marko wrote:
>
> U just tested tornado using others 'example' pages and its much, much 
> faster than rocket. It event doesnt generate failed requests comparing to 
> rocket. Can tornado be better/faster solution then Apache wsgi? I mean some 
> apache/nginx+reverse proxy & tornado+web2py?
>
>
> https://github.com/fiorix/cyclone/wiki/benchmarks 
>
> David
>


Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread Tim Alexander
Then maybe a bit of info around massimo being the BDFL (python/linux,
benevolent dictator for life) being out there might work. As said before,
seems very much like a perception problem rather than something that will be
solved via some sort of company or group running things rather than a single
person.

The current setup works great for me, but identifying that there are a few
people (the list above is awesome) who are web2py experts, and very
experienced in the code, even if there is a BDFL who is gatekeeper, and
setting that as the expectation/perception going forward might well fix
perception without any changes neccesary. Perhaps an "about the developers"
page or something? Or an explanation of some sort on the web2py site?

On Tue, Dec 28, 2010 at 2:42 PM, Jonathan Lundell wrote:

> On Dec 28, 2010, at 11:54 AM, VP wrote:
> >
> > I love the fact that if I have a problem with web2py and asked a
> > question, Massimo will likely answer it.  But the perceptual problem
> > of web2py is a single-person effort is real.  Massimo fixes most of
> > the bugs (it seems so).  Massimo is mainly responsible for PR.
> > Massimo is in charge of experts4solution (it appears so).  Massimo is
> > mainly in charge of documentation (the book) (it appears so).
> >
> > Note that these are not necessary bad things.  But the concern is
> > real. Now, you can say this issue should not be a concern (i.e. we are
> > okay with the current setup).  Then that's a different perspective, a
> > different story.
>
> Offhand, I can think of at least three major projects that have a single
> person in charge, in one way or another: Linux, OpenBSD and Python. I don't
> know much about the OpenBSD and Python patch processes, but all Linux
> patches go through Linus. So in that sense, Massimo's role is not
> unprecedented.
>
>


[web2py] Re: couchdb anybody?

2010-12-28 Thread Kevin
With CouchDB in particular, is there any thoughts for treating nested
structures as though they had been retrieved through a join?

Taking the following document:

{
  _id: 'abcd1234',
  type: 'person',
  name: 'John Doe',
  phones: ['555-555-3614', '555-555-1812'],
  addresses: ['123 S Nowhere Ln...']
}

Because the phones and addresses, although nested objects, can be
added as top level objects to a view arbitrarily, and because self-
contained documents like the above are the way to do things in Couch,
it seems prudent to be able to simulate 'table' relationships in the
DAL in some way, in this example with phones and addresses being
understood as virtual tables so as to integrate with SQLTABLE and
CRUD, to name a few.

Additionally, when completed, will we be able to define arbitrary
predefined views as read-only tables that can only be filtered by key/
key-range?  Temporary views will have noticeably slower performance,
which would make ad-hoc filters something to be discouraged.

On Dec 8, 2:20 pm, mdipierro  wrote:
> Because the integration is not completed. Close but not done.
>
> On Dec 8, 2:44 pm, António Ramos  wrote:
>
> > For dummies why not a video tutorial on using couchdb with web2py?
> > I would help a lot for newcommers and for web2py in general!
>
> > Best regards
> > António
>
> > 2010/12/8 mdipierro 
>
> > > Please make sure you have the latest sql.py from trunk.
> > > CouchDB should call the rollback at 2325 not the one at line 988.
>
> > > Massimo
>
> > > On Dec 8, 1:57 pm, David Marko  wrote:
> > > > I tried it but getting following error:
>
> > > > Traceback (most recent call last):
> > > > File "c:\java\web2py\gluon\main.py", line 488, in wsgibase
> > > > BaseAdapter.close_all_instances(BaseAdapter.rollback)
> > > > File "c:\java\web2py\gluon\sql.py", line 264, in close_all_instances
> > > > action(instance)
> > > > File "c:\java\web2py\gluon\sql.py", line 988, in rollback
> > > > return self.connection.rollback()
> > > > AttributeError: 'Server' object has no attribute 'rollback'
>
> > > > Changes are available in CouchDB but after every request I'm getting
> > > > error above.
>
> > > > David
>
>


[web2py] RunimeError: No table selected

2010-12-28 Thread Emceha
Hi I have such controller in default.py

def index():
dzialy = db().select(db.dzialy.ALL,orderby=db.dzialy.kolejnosc)
dzialy_reversed = dzialy.sort(lambda dzial:
dzial.kolejnosc,reverse=True)
return dict(dzialy=dzialy,dzialy_reversed=dzialy_reversed)

I use this with google app engine SDK (for GAE deployment) so started
it up with dev_appserver.py

It works just fine with
Version 1.89.5 (2010-11-21 22:12:54)

but Version 1.91.4 (2010-12-22 17:31:23)
fails with this error listed below

Traceback (most recent call last):
  File "/media/AA1/GAE/web2py/gluon/restricted.py", line 188, in
restricted
exec ccode in environment
  File "/media/AA1/GAE/web2py/applications/init/controllers/
default.py:index", line 69, in 
  File "/media/AA1/GAE/web2py/gluon/globals.py", line 95, in 
self._caller = lambda f: f()
  File "/media/AA1/GAE/web2py/applications/init/controllers/
default.py:index", line 7, in index
  File "/media/AA1/GAE/web2py/gluon/dal.py", line 4388, in select
return self.db._adapter.select(self.query,fields,attributes)
  File "/media/AA1/GAE/web2py/gluon/dal.py", line 2654, in select
(items, tablename, fields) =
self.select_raw(query,fields,attributes)
  File "/media/AA1/GAE/web2py/gluon/dal.py", line 2611, in select_raw
tablename = self.get_table(query)
  File "/media/AA1/GAE/web2py/gluon/dal.py", line 894, in get_table
raise RuntimeError, "No table selected"
RunimeError: No table selected

Is that because my code is wrong or we lost some compatibility?


[web2py] Cron: what happens if a process isn't finished and the next time to start it comes again?

2010-12-28 Thread Lorin Rivers
I am working on moving some of the computation-intensive processes to a
cron-launched scheme. I have some that run every minute, every 2 minutes,
every 5 minutes and every 15 minutes.

In production, it's possible that the volume of incoming data would result
in the task not finishing before its next cron slot fires again. In
development , however, I can flood the system quite easily by importing data
in larger chunks.

At the moment, my laptop (fairly decent machine) is essentially unusable
because there are so many python processes consuming RAM.

Here's a slightly cleaned-up sample of ps:

 6716 ttys0000:01.70 ../Python web2py.py -a 1234 -i 127.0.0.1 -p 8000
 6722 ttys0000:36.46 ../Python ../web2py.py -J -M -S Debug/DAQ/setup_DAQ
-a 
 6724 ttys0000:00.00 (Python)
 7239 ttys0000:00.00 (Python)
 7543 ttys0000:00.00 (Python)
 7641 ttys0000:00.00 (Python)
 7720 ttys0000:00.00 (Python)
 7819 ttys0000:00.00 (Python)
 8781 ttys0000:00.00 (Python)
 8783 ttys0000:00.00 (Python)
 8784 ttys0000:00.00 (Python)
 8787 ttys0000:00.00 (Python)
 8789 ttys0000:00.00 (Python)
 8790 ttys0000:00.00 (Python)
 8791 ttys0000:00.00 (Python)
 8792 ttys0000:00.00 (Python)
 8867 ttys0000:00.00 (Python)
 8868 ttys0000:00.00 (Python)
 8872 ttys0000:00.00 (Python)
 8946 ttys0000:00.00 (Python)
 8947 ttys0000:00.00 (Python)
 8949 ttys0000:00.00 (Python)
 8950 ttys0000:00.00 (Python)
 8951 ttys0000:00.00 (Python)
 8948 ttys0000:00.46 ../Python ../web2py.py -J -M -S
Debug/rounding/array_1minsRollup -a 
 7320 ttys0001:04.75 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 7424 ttys0000:56.54 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 7544 ttys0000:50.19 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 7643 ttys0000:42.32 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 7722 ttys0000:36.26 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 7820 ttys0000:30.36 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 7899 ttys0000:25.12 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 8013 ttys0000:20.99 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 8090 ttys0000:17.28 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 8189 ttys0000:14.05 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 8271 ttys0000:11.55 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 8364 ttys0000:07.50 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 8455 ttys0000:07.51 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 8557 ttys0000:05.08 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 8635 ttys0000:00.73 ../Python ../web2py.py -J -M -S
Debug/rounding/data_tableRollup -a 
 8458 ttys0000:18.24 ../Python ../web2py.py -J -M -S
Debug/rounding/panel_1minsRollup -a 
 8638 ttys0000:16.68 ../Python ../web2py.py -J -M -S
Debug/rounding/panel_1minsRollup -a 
 8786 ttys0000:00.57 ../Python ../web2py.py -J -M -S
Debug/rounding/panel_1minsRollup -a 
 7061 ttys0000:43.78 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 7140 ttys0000:12.82 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 7240 ttys0000:12.35 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 7319 ttys0000:12.37 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 7423 ttys0000:12.20 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 7541 ttys0000:12.10 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 7640 ttys0000:12.26 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 7721 ttys0000:12.31 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 7818 ttys0000:12.59 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 7898 ttys0000:12.53 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 8012 ttys0000:12.46 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 8092 ttys0000:12.46 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 8188 ttys0000:12.26 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 8270 ttys0000:11.96 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 8363 ttys0000:12.05 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 8454 ttys0000:12.12 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 8556 ttys0000:12.02 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 8632 ttys0000:11.49 ../Python ../web2py.py -J -M -S
Debug/rounding/stringdataRollup -a 
 8785 ttys0000:00.55 ../Python ../web2py.py -J 

[web2py] Re: New plugin for star rating

2010-12-28 Thread Arun K.Rajeevan
sure, I'll make it tomorrow.

[web2py] Re: Web2Py Foundation?

2010-12-28 Thread VP


>>Then maybe a bit of info around massimo being the BDFL (python/linux,
>> benevolent dictator for life) being out there might work. As said before,
>> seems very much like a perception problem rather than something that will be
>> solved via some sort of company or group running things rather than a single
>> person.


I am going to clarify my opinion, not to be argumentative but in hope
that it can be helpful.

I do not think that it's a "perception problem".  I think the concern
that web2py being a one-man show is very real.  You can't deny the
fact that Massimo is at the forefront of every facet of web2py (PR,
documentation, coding, user interaction, etc.)  Now, we have to be
thankful to Massimo for all of the energy and passion put into this.
And maybe, without other people filling in the roles, he'll have to do
it.  But one can't deny the fact that this is very real.

Linux, Python, ... don't have this problem.  Linus' role, I think, is
quite minimal (but important).  But we shouldn't talk about and
implicitly compare web2py to these big projects as it's not fair.

The point is like you put every software, databases, etc. of your
company into one big, powerful, reliable server.  Yes, there's an
advantage.  But it's also a valid source of concern: one server.

Personally, I, and I think many people here, don't have problem with
this set up.  But I think big companies justifiably do.

I would like to see web2py becomes matured in a similar model as
Drupal, at lease with a PR manager, a release manager, a documentation
manager, and a newbie-assistance manager, together with a platform
that attracts developers and encourages contribution.   Massimo's role
should be in developing and setting visions.  This is what Dries
(Drupal's founder) does.  He gives visions for upcoming versions of
Drupal.  And this is really something that attracts the "big guys"
from the industry.  Imagine Massimo declares, for example, web2py 2.x
will heavily support on mobile computing, cloud computing, etc.  Then,
I'll predict that people, developers and companies with vested
interests in these areas will jump in.

In summary, the big guys care about not just where things are now, but
also where things will be.  They care about not being left in the
cold, if Massimo decides to move to Hawaii and retires early. They
care about where web2py is moving to.










[web2py] Re: Web2Py Foundation?

2010-12-28 Thread Christopher Steel
While it is not required due to the nature of his position, I do
hereby officially recognize Massimo Di Pierro as Web2py's Benevolent
Dictator for Life as is in keeping with the Pythonic and opensource
tradition and in recognition of his leadership and nurturing role in
the development and maintenance of the Web2py project.

Long Live Massimo!



http://en.wikipedia.org/wiki/Benevolent_Dictator_For_Life



On Dec 28, 4:02 pm, Tim Alexander  wrote:
> Then maybe a bit of info around massimo being the BDFL (python/linux,
> benevolent dictator for life) being out there might work. As said before,
> seems very much like a perception problem rather than something that will be
> solved via some sort of company or group running things rather than a single
> person.
>
> The current setup works great for me, but identifying that there are a few
> people (the list above is awesome) who are web2py experts, and very
> experienced in the code, even if there is a BDFL who is gatekeeper, and
> setting that as the expectation/perception going forward might well fix
> perception without any changes neccesary. Perhaps an "about the developers"
> page or something? Or an explanation of some sort on the web2py site?
>
> On Tue, Dec 28, 2010 at 2:42 PM, Jonathan Lundell wrote:
>
> > On Dec 28, 2010, at 11:54 AM, VP wrote:
>
> > > I love the fact that if I have a problem with web2py and asked a
> > > question, Massimo will likely answer it.  But the perceptual problem
> > > of web2py is a single-person effort is real.  Massimo fixes most of
> > > the bugs (it seems so).  Massimo is mainly responsible for PR.
> > > Massimo is in charge of experts4solution (it appears so).  Massimo is
> > > mainly in charge of documentation (the book) (it appears so).
>
> > > Note that these are not necessary bad things.  But the concern is
> > > real. Now, you can say this issue should not be a concern (i.e. we are
> > > okay with the current setup).  Then that's a different perspective, a
> > > different story.
>
> > Offhand, I can think of at least three major projects that have a single
> > person in charge, in one way or another: Linux, OpenBSD and Python. I don't
> > know much about the OpenBSD and Python patch processes, but all Linux
> > patches go through Linus. So in that sense, Massimo's role is not
> > unprecedented.


Re: [web2py] Cron: what happens if a process isn't finished and the next time to start it comes again?

2010-12-28 Thread Jonathan Lundell
On Dec 28, 2010, at 1:18 PM, Lorin Rivers wrote:
> I am working on moving some of the computation-intensive processes to a 
> cron-launched scheme. I have some that run every minute, every 2 minutes, 
> every 5 minutes and every 15 minutes.
> 
> In production, it's possible that the volume of incoming data would result in 
> the task not finishing before its next cron slot fires again. In development 
> , however, I can flood the system quite easily by importing data in larger 
> chunks.
> 
> At the moment, my laptop (fairly decent machine) is essentially unusable 
> because there are so many python processes consuming RAM.

Do you see this log message?

logger.warning('WEB2PY CRON: Stale cron.master detected')

I don't think that there's a good global solution to this kind of problem; cron 
is really oriented toward jobs that can finish in a short time period.

One approach would be to have a daemon process (or a pool of them, maybe one 
per core) to do the work, and in your cron jobs simply queue work for them.

Alternatively (or perhaps in addition) you might want to introduce a little 
back pressure to your clients, so as not to accept more work than your server 
is capable of handling in a reasonable time. 

With the latest version of web2py/Rocket, you can lower the limit on request 
threads (I count 22 below), which would be a brute-force way of getting back 
pressure.

> 
> Here's a slightly cleaned-up sample of ps:
> 
>  6716 ttys0000:01.70 ../Python web2py.py -a 1234 -i 127.0.0.1 -p 8000
>  6722 ttys0000:36.46 ../Python ../web2py.py -J -M -S Debug/DAQ/setup_DAQ 
> -a 
>  6724 ttys0000:00.00 (Python)
>  7239 ttys0000:00.00 (Python)
>  7543 ttys0000:00.00 (Python)
>  7641 ttys0000:00.00 (Python)
>  7720 ttys0000:00.00 (Python)
>  7819 ttys0000:00.00 (Python)
>  8781 ttys0000:00.00 (Python)
>  8783 ttys0000:00.00 (Python)
>  8784 ttys0000:00.00 (Python)
>  8787 ttys0000:00.00 (Python)
>  8789 ttys0000:00.00 (Python)
>  8790 ttys0000:00.00 (Python)
>  8791 ttys0000:00.00 (Python)
>  8792 ttys0000:00.00 (Python)
>  8867 ttys0000:00.00 (Python)
>  8868 ttys0000:00.00 (Python)
>  8872 ttys0000:00.00 (Python)
>  8946 ttys0000:00.00 (Python)
>  8947 ttys0000:00.00 (Python)
>  8949 ttys0000:00.00 (Python)
>  8950 ttys0000:00.00 (Python)
>  8951 ttys0000:00.00 (Python)
>  8948 ttys0000:00.46 ../Python ../web2py.py -J -M -S 
> Debug/rounding/array_1minsRollup -a 
>  7320 ttys0001:04.75 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  7424 ttys0000:56.54 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  7544 ttys0000:50.19 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  7643 ttys0000:42.32 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  7722 ttys0000:36.26 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  7820 ttys0000:30.36 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  7899 ttys0000:25.12 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  8013 ttys0000:20.99 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  8090 ttys0000:17.28 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  8189 ttys0000:14.05 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  8271 ttys0000:11.55 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  8364 ttys0000:07.50 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  8455 ttys0000:07.51 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  8557 ttys0000:05.08 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  8635 ttys0000:00.73 ../Python ../web2py.py -J -M -S 
> Debug/rounding/data_tableRollup -a 
>  8458 ttys0000:18.24 ../Python ../web2py.py -J -M -S 
> Debug/rounding/panel_1minsRollup -a 
>  8638 ttys0000:16.68 ../Python ../web2py.py -J -M -S 
> Debug/rounding/panel_1minsRollup -a 
>  8786 ttys0000:00.57 ../Python ../web2py.py -J -M -S 
> Debug/rounding/panel_1minsRollup -a 
>  7061 ttys0000:43.78 ../Python ../web2py.py -J -M -S 
> Debug/rounding/stringdataRollup -a 
>  7140 ttys0000:12.82 ../Python ../web2py.py -J -M -S 
> Debug/rounding/stringdataRollup -a 
>  7240 ttys0000:12.35 ../Python ../web2py.py -J -M -S 
> Debug/rounding/stringdataRollup -a 
>  7319 ttys0000:12.37 ../Python ../web2py.py -J -M -S 
> Debug/rounding/stringdataRollup -a 
>  7423 ttys0000:12.20 ../Python ../web2py.py -J -M -S 
> Debug/rounding/stringdataRollup -a 
>  7541 ttys0000:12.10 ../Python ../web2py.py -J -M -S 
> Debug/rounding/stringdataRollup -a 
>  7640 ttys0000:12.26 ../Python ../web2py.py -J -M -S 
> Debug/rounding/stringdataRollup -a 
>  7721 ttys0000:1

[web2py] Re: variable include

2010-12-28 Thread Luther Goh Lu Feng
If the variables to be accessed from the original view are not needed
to be passed back to python, it is possible to store the variables in
javascript, and then access the variables from different components.

To view the problem differently, you may wish to look at

http://flowplayer.org/tools/demos/tabs/wizard.html
http://flowplayer.org/tools/demos/scrollable/wizard.html



On Dec 29, 4:38 am, mattynoce  wrote:
> great call, luther. thank to you and ron for the help.
>
> here was the solution:
>
> 1) have the main view code call a component i called "stepFunc"
> 2) have stepFunc then render the appropriate mini-view
>
> [views]
> ** first, i defined a view for each step. so there's a folder at
> default/views/step and it has files like step1.html, step2.html, etc.
> **
>
> [main view]
> ** the variable step contains something like 'step1' **
> 
>     {{=LOAD(c='default', f='stepFunc.load', args=[step], ajax=False,
> ajax_trap=False)}}
> 
>
> [controller]
> ** there needs to be some error handling but this is the basic gist **
> def stepFunc():
>     step = None
>     if request.args:
>         step = request.args[0]
>     response.view = 'step/' + step + '.html'
>     return dict(step=step)
>
> this solves the problem perfectly. the only downside is that the steps
> don't have access to variable from the original view -- everything the
> steps see must be passed by the stepFunc controller. so it functions
> differently from an include in that way -- the only variable it
> understands here is step.
>
> matt
>
> On Dec 28, 11:15 am, Luther Goh Lu Feng  wrote:
>
>
>
>
>
>
>
> > Try 
> > usinghttp://www.web2py.com/book/default/chapter/13#Components-and-Plugins
>
> > I think it should be what you are looking for.
>
> > On Dec 29, 3:05 am, ron_m  wrote:
>
> > > Its ugly but you must have a finite and small number of nextStep targets
>
> > > {{if nextStep == 'step1':}}
> > >   {{include 'step1.html'}}
> > > {{elif nextStep == 'step2':}}
> > >   {{include 'step2.html'}}
> > > ..
> > > will get you going but introduces a maintenance issue if you add a step
> > > later that ou have to remember to come back to here and fix.
>
> > > The problem is the include passes through the template generation and that
> > > pulls that body of code inline during the template substitution phase 
> > > before
> > > any code executes. I don't think it is possible to have a variable inside
> > > the include statement. I would like to be proven wrong. :-)
>
> > > Ron


[web2py] web2py 1.91.5 is OUT

2010-12-28 Thread mdipierro
Mostly bug fixes about new dal (joins, with_alias, ordering on joins
in postgresql, db().select(db.table.ALL) on GAE, behavior of boolean
writable=False, upload of new apps with missing file) and some
internal improvements (mostly due to Jonathan, so he can explain).

Massimo


[web2py] Re: Web2Py Foundation?

2010-12-28 Thread mdipierro
benevolent?

On Dec 28, 4:01 pm, Christopher Steel  wrote:
> While it is not required due to the nature of his position, I do
> hereby officially recognize Massimo Di Pierro as Web2py's Benevolent
> Dictator for Life as is in keeping with the Pythonic and opensource
> tradition and in recognition of his leadership and nurturing role in
> the development and maintenance of the Web2py project.
>
> Long Live Massimo!
>
> http://en.wikipedia.org/wiki/Benevolent_Dictator_For_Life
>
> On Dec 28, 4:02 pm, Tim Alexander  wrote:
>
> > Then maybe a bit of info around massimo being the BDFL (python/linux,
> > benevolent dictator for life) being out there might work. As said before,
> > seems very much like a perception problem rather than something that will be
> > solved via some sort of company or group running things rather than a single
> > person.
>
> > The current setup works great for me, but identifying that there are a few
> > people (the list above is awesome) who are web2py experts, and very
> > experienced in the code, even if there is a BDFL who is gatekeeper, and
> > setting that as the expectation/perception going forward might well fix
> > perception without any changes neccesary. Perhaps an "about the developers"
> > page or something? Or an explanation of some sort on the web2py site?
>
> > On Tue, Dec 28, 2010 at 2:42 PM, Jonathan Lundell wrote:
>
> > > On Dec 28, 2010, at 11:54 AM, VP wrote:
>
> > > > I love the fact that if I have a problem with web2py and asked a
> > > > question, Massimo will likely answer it.  But the perceptual problem
> > > > of web2py is a single-person effort is real.  Massimo fixes most of
> > > > the bugs (it seems so).  Massimo is mainly responsible for PR.
> > > > Massimo is in charge of experts4solution (it appears so).  Massimo is
> > > > mainly in charge of documentation (the book) (it appears so).
>
> > > > Note that these are not necessary bad things.  But the concern is
> > > > real. Now, you can say this issue should not be a concern (i.e. we are
> > > > okay with the current setup).  Then that's a different perspective, a
> > > > different story.
>
> > > Offhand, I can think of at least three major projects that have a single
> > > person in charge, in one way or another: Linux, OpenBSD and Python. I 
> > > don't
> > > know much about the OpenBSD and Python patch processes, but all Linux
> > > patches go through Linus. So in that sense, Massimo's role is not
> > > unprecedented.
>
>


Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread Tim Alexander
Something like that.

We could go with "semi tolerant dictator for life"... :)

On Tue, Dec 28, 2010 at 4:21 PM, mdipierro  wrote:

> benevolent?
>
> On Dec 28, 4:01 pm, Christopher Steel  wrote:
> > While it is not required due to the nature of his position, I do
> > hereby officially recognize Massimo Di Pierro as Web2py's Benevolent
> > Dictator for Life as is in keeping with the Pythonic and opensource
> > tradition and in recognition of his leadership and nurturing role in
> > the development and maintenance of the Web2py project.
> >
> > Long Live Massimo!
> >
> > http://en.wikipedia.org/wiki/Benevolent_Dictator_For_Life
> >
> > On Dec 28, 4:02 pm, Tim Alexander  wrote:
> >
> > > Then maybe a bit of info around massimo being the BDFL (python/linux,
> > > benevolent dictator for life) being out there might work. As said
> before,
> > > seems very much like a perception problem rather than something that
> will be
> > > solved via some sort of company or group running things rather than a
> single
> > > person.
> >
> > > The current setup works great for me, but identifying that there are a
> few
> > > people (the list above is awesome) who are web2py experts, and very
> > > experienced in the code, even if there is a BDFL who is gatekeeper, and
> > > setting that as the expectation/perception going forward might well fix
> > > perception without any changes neccesary. Perhaps an "about the
> developers"
> > > page or something? Or an explanation of some sort on the web2py site?
> >
> > > On Tue, Dec 28, 2010 at 2:42 PM, Jonathan Lundell  >wrote:
> >
> > > > On Dec 28, 2010, at 11:54 AM, VP wrote:
> >
> > > > > I love the fact that if I have a problem with web2py and asked a
> > > > > question, Massimo will likely answer it.  But the perceptual
> problem
> > > > > of web2py is a single-person effort is real.  Massimo fixes most of
> > > > > the bugs (it seems so).  Massimo is mainly responsible for PR.
> > > > > Massimo is in charge of experts4solution (it appears so).  Massimo
> is
> > > > > mainly in charge of documentation (the book) (it appears so).
> >
> > > > > Note that these are not necessary bad things.  But the concern is
> > > > > real. Now, you can say this issue should not be a concern (i.e. we
> are
> > > > > okay with the current setup).  Then that's a different perspective,
> a
> > > > > different story.
> >
> > > > Offhand, I can think of at least three major projects that have a
> single
> > > > person in charge, in one way or another: Linux, OpenBSD and Python. I
> don't
> > > > know much about the OpenBSD and Python patch processes, but all Linux
> > > > patches go through Linus. So in that sense, Massimo's role is not
> > > > unprecedented.
> >
> >
>


Re: [web2py] Re: Web2Py Foundation?

2010-12-28 Thread Branko Vukelić
On Tue, Dec 28, 2010 at 11:21 PM, mdipierro  wrote:
> benevolent?

What? Prefer malevolent? :)

-- 
Branko Vukelic

stu...@brankovukelic.com
http://www.brankovukelic.com/


Re: [web2py] web2py 1.91.5 is OUT

2010-12-28 Thread Jonathan Lundell
On Dec 28, 2010, at 2:09 PM, mdipierro wrote:
> 
> Mostly bug fixes about new dal (joins, with_alias, ordering on joins
> in postgresql, db().select(db.table.ALL) on GAE, behavior of boolean
> writable=False, upload of new apps with missing file) and some
> internal improvements (mostly due to Jonathan, so he can explain).

Aside from the minor Rocket patch, described earlier, the only other 
substantive patch was one to URL, for vars in which a give variable has more 
than one value.

There was a fix a little while back, I think, to handle this for incoming URLs. 
Sometimes a key appears more than once in a URL query string, like this:

http://domain.com/a/b/c?a=1&b=2&b=3

A typical place this happens is for form checkboxes, where the same key 
(associated with the group of checkboxes) gets sent once for each box that's 
checked.

This shows up in request.vars as a list, so the above ends up being something 
like:

vars = dict(a=1, b=[2,3])

...except that they're strings.

The problem was that this wasn't being handled for outgoing URLs (in URL()), so 
if you tried to send the example above you'd get something like:

http://domain.com/a/b/c?a=1&b=[2, 3]

...which isn't right. The fix is to generate a URL that looks like the first 
example above.

This fix is also incorporated into the recent hmac signature checking of 
immutable vars.

[web2py] Re: unique constraint of multiple columns (at database level)

2010-12-28 Thread Luther Goh Lu Feng
Is there a reason why you are not using Auth, if you aren't?

http://www.web2py.com/book/default/chapter/08#Authentication

Anyway, assuming that you truly want to add the unique constraint,
then I am guessing that you could construct virtual fields

http://www.web2py.com/book/default/chapter/06#Virtual-Fields

and apply the constraint 
http://www.web2py.com/book/default/docstring/IS_NOT_IN_DB

db.page.title.requires = IS_NOT_IN_DB(db, 'page.title') #http://
www.web2py.com/book/default/chapter/03

On Dec 29, 2:47 am, ron_m  wrote:
> I would like to respectfully ask how a first and last name combined could be
> unique in the real world? There are lots of people with identical first and
> last names.
>
> A better candidate in your table is Email.
>
> I know that doesn't answer your question but I think it is worth
> consieration.
>
> Ron


[web2py] Recaptcha in Email Form

2010-12-28 Thread Andrew Evans
How can I add Recaptcha to an email form?

I am defining my mail settings here

def email_user(sender,message,subject="Web Request from [NamiYama]"):
from gluon.tools import Mail
mail=Mail()

mail.settings.server='smtp.gmail.com:587'
mail.settings.login=None or 'user:pass'
mail.settings.register_captcha = Recaptcha(request, 'PUBLIC_KEY',
'PRIVATE_KEY')
mail.settings.sender=sender
toaddrs=[x.email for x in db().select(db.recipient.email)]
mail.send(to=toaddrs, subject=subject, message=message)

does this line work mail.settings.register_captcha = Recaptcha(request,
'PUBLIC_KEY',
'PRIVATE_KEY')

if so how can I ad it to my form?

Any ideas *cheers


[web2py] Re: GEO region Searching...

2010-12-28 Thread Luther Goh Lu Feng
http://arstechnica.com/civis/viewtopic.php?f=20&t=1115412

has quite a few tips.

On Dec 29, 3:12 am, Jason Brower  wrote:
> I know we can find good inforamtion geographical stuff in teh web2py
> manual.  But is there a way to, for example, find things in a search
> area around a coordinate?
> My guess is that I should do the following:
> Get the logged in users geo information (lat and long)
> Get the distance away that I want to search around that person and
> calculate the lat and logitudes of that area...
> Find if the lat and log of the items.lat and items.long in my database
> are within the regions of the users.lat and users.log and the (areas.lat
> and areas.long)* for for four directions.
> Does that make sences?  Would that be the best aproach?
> Best Regards,
> Jason Brower


Re: [web2py] web2py 1.91.5 is OUT

2010-12-28 Thread Robert
Nice! Deploying and testing it right away! :)

Re: [web2py] web2py 1.91.5 is OUT

2010-12-28 Thread Michele Comitini
I thought it was intentional to keep urlencode compat.

I used to solve it like this:

vars = (('a',1), ('b',2), ('b',3))


> There was a fix a little while back, I think, to handle this for incoming 
> URLs. Sometimes a key appears more than once in a URL query string, like this:
>
>        http://domain.com/a/b/c?a=1&b=2&b=3
>
> A typical place this happens is for form checkboxes, where the same key 
> (associated with the group of checkboxes) gets sent once for each box that's 
> checked.
>
> This shows up in request.vars as a list, so the above ends up being something 
> like:
>
>        vars = dict(a=1, b=[2,3])
>
> ...except that they're strings.
>
> The problem was that this wasn't being handled for outgoing URLs (in URL()), 
> so if you tried to send the example above you'd get something like:
>
>        http://domain.com/a/b/c?a=1&b=[2, 3]
>
> ...which isn't right. The fix is to generate a URL that looks like the first 
> example above.
>
> This fix is also incorporated into the recent hmac signature checking of 
> immutable vars.


Re: [web2py] web2py 1.91.5 is OUT

2010-12-28 Thread Jonathan Lundell
On Dec 28, 2010, at 3:43 PM, Michele Comitini wrote:
> 
> I thought it was intentional to keep urlencode compat.
> 
> I used to solve it like this:
> 
> vars = (('a',1), ('b',2), ('b',3))

request.vars is a dict already, so it was more straightforward to go the other 
way. Also, I think that's the way that a lot of cgi packages do it (Perl, for 
example, IIRC).

> 
> 
>> There was a fix a little while back, I think, to handle this for incoming 
>> URLs. Sometimes a key appears more than once in a URL query string, like 
>> this:
>> 
>>http://domain.com/a/b/c?a=1&b=2&b=3
>> 
>> A typical place this happens is for form checkboxes, where the same key 
>> (associated with the group of checkboxes) gets sent once for each box that's 
>> checked.
>> 
>> This shows up in request.vars as a list, so the above ends up being 
>> something like:
>> 
>>vars = dict(a=1, b=[2,3])
>> 
>> ...except that they're strings.
>> 
>> The problem was that this wasn't being handled for outgoing URLs (in URL()), 
>> so if you tried to send the example above you'd get something like:
>> 
>>http://domain.com/a/b/c?a=1&b=[2, 3]
>> 
>> ...which isn't right. The fix is to generate a URL that looks like the first 
>> example above.
>> 
>> This fix is also incorporated into the recent hmac signature checking of 
>> immutable vars.




[web2py] How to test for a web2py record or record ID ?

2010-12-28 Thread Fabiano
Hi, using web2py, frequently I write functions that will do stuff with
specific database records.

When writing functions that will deal with specific database records,
I want to write them to be flexible on the way I may reference the
record I want. I mean, I may pass different kinds of arguments to the
function and, as long as this argument is sufficient to identify a
record, the function should figure it out how to retrieve the record.

For example, if I call myfunc("some string"), the function will query
db for a record with title==arg, if I have an object that has enough
information for the function to build a query, I want to be able to
call it myfunc(myobj). If I have an ID returned from a database
insertion, I want to be able to pass it as myfunc(id), if I have the
record itself, I want to be able to pass it also, like
myfunc(rows.first()), and so on..

My doubt is how to reliably identify if the argument is from web2py. I
thought in something like:


def somefunc(arg1)
if isinstance(arg1, string):
myrecord = db().select(db.mytable.myfield == arg1)
if isinstance(arg1, myclass):
myrecord = db.mytable(myclass.record_id)
elif IS_WEB2PY_ID(arg1):
myrecord = db.mytable(arg1)
elif IS_WEB2PY_RECORD(arg1):
myrecord = arg1
# do whatever with myrecord


So, how could be the test for IS_WEB2PY_ID() ? I took a look at web2py
source and saw that insert() may return many things, it may be an
integer id, a dict, a tuple... I also got a bit confused when tables
uses custom primarykeys.

And about IS_WEB2PY_RECORD() ? Test if argument is an instance of Row
class is enough?

Regards,
Fabiano


[web2py] Book misinformation about Multiple submission prevention with multiple forms

2010-12-28 Thread Fabiano

Hi,

I just read a paragraph on the book that really worried me, on Chapter 7, 
Section Forms and Validators / FORM / Multiple forms per page:

It reads "(...) when multiple forms are present on the same page, the 
mechanism for preventing double submission breaks, and you must omit the 
session argument when calling the accepts method. (...)".

This really disturbed me because the way I see, the main benefit of this 
mechanism is not to prevent double form submission but to prevent CSRF 
attacks, which is a very important feature these days. Prevent CSRF attacks 
per se is a complex subject [1] to just let it on each developers hand, 
specially when the framework in use already has good prevention mechanism.

What also bothered me was that, considering the importance of this matter, I 
could not see any technical reason to this mechanism not work with multiple 
forms or be broken by it. So, before look at web2py code, I decide to test 
it first.

Doing what the book recommends, omitting the session when call accepts(), 
has the obvious effect of disabling the mechanism, just pressing F5 after a 
submission makes a new submission.

Then, I tried to put the session argument back to see how would it break 
before dive in to the code. And I had a very pleasant surprise, it didn't! 
It worked flawlessly, with each form having a different formkey.

I guess this was fixed after that book section was written. If so, it may 
look just an outdated information, but I see it as security issue also, as 
any one that follows its recommendation may end with a vulnerable 
application, without need, with an important security feature just disabled. 


[1] 
http://www.owasp.org/index.php/Cross-Site_Request_Forgery_%28CSRF%29_Prevention_Cheat_Sheet

Regards,


[web2py] Re: Book misinformation about Multiple submission prevention with multiple forms

2010-12-28 Thread mdipierro
The book is incorrect. There is no problem with multiple forms per
page with one caveat.

If two or more of the form are SQLFORM.factory forms or if they are
SQLFORMs related to the same table, you must give each of them unique
names.

Massimo

On Dec 28, 9:44 pm, Fabiano  wrote:
> Hi,
>
> I just read a paragraph on the book that really worried me, on Chapter 7,
> Section Forms and Validators / FORM / Multiple forms per page:
>
> It reads "(...) when multiple forms are present on the same page, the
> mechanism for preventing double submission breaks, and you must omit the
> session argument when calling the accepts method. (...)".
>
> This really disturbed me because the way I see, the main benefit of this
> mechanism is not to prevent double form submission but to prevent CSRF
> attacks, which is a very important feature these days. Prevent CSRF attacks
> per se is a complex subject [1] to just let it on each developers hand,
> specially when the framework in use already has good prevention mechanism.
>
> What also bothered me was that, considering the importance of this matter, I
> could not see any technical reason to this mechanism not work with multiple
> forms or be broken by it. So, before look at web2py code, I decide to test
> it first.
>
> Doing what the book recommends, omitting the session when call accepts(),
> has the obvious effect of disabling the mechanism, just pressing F5 after a
> submission makes a new submission.
>
> Then, I tried to put the session argument back to see how would it break
> before dive in to the code. And I had a very pleasant surprise, it didn't!
> It worked flawlessly, with each form having a different formkey.
>
> I guess this was fixed after that book section was written. If so, it may
> look just an outdated information, but I see it as security issue also, as
> any one that follows its recommendation may end with a vulnerable
> application, without need, with an important security feature just disabled.
>
> [1]http://www.owasp.org/index.php/Cross-Site_Request_Forgery_%28CSRF%29_...
>
> Regards,


[web2py] Re: Book misinformation about Multiple submission prevention with multiple forms

2010-12-28 Thread Fabiano
On Wednesday, December 29, 2010 1:59:24 AM UTC-2, mdipierro wrote:
> The book is incorrect. There is no problem with multiple forms per page

That is exactly what I said, but that is not my point.

My point is: The fact that the book is incorrect may pose a security risk to 
users that follow it and don't know that it is incorrect.

Users may code a CSRF vulnerable application by inadvertently disabling the 
CSRF protection when following the incorrect recommendation on the book.


Regards,
Fabiano.


[web2py] Re: Powertable remarks

2010-12-28 Thread tomt
Hi Bruno,

I've just tried using your powertables plugin and I love it. The
general appearance is great and the default search function is exactly
what I was looking for.  I'm looking forward to trying out the
features you've planned.

One small concern I have is the example I implemented allows me to
page to 'next' and 'previous' but there is not a link for 'first' or
'last' page.  It would be great if this was possible.

Keep up the good work.  - Tom


On Dec 18, 3:38 pm, Bruno Rocha  wrote:
> >  jqGrid also supports progressive loading (without paging , it
> > does ajax to load while scrolling down).
>
> > I do not see those features exist in datatables.
>
> Just got progressive loading working on powerTable plugin
>
> powerTable.dtfeatures['bScrollInfinite'] = True
> powerTable.dtfeatures['iScrollLoadGap'] = 10 #number of rows to load by time
>
> I am still working hard to make server side load to work well.
>
> (I am having a good time with datatables library, the community in
> datatables.net forum is very helpful)
>
> Will update the plugin soon.
>
> --
>
> Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: Book misinformation about Multiple submission prevention with multiple forms

2010-12-28 Thread mdipierro
You are right. We will fix it in the next edition.

On Dec 28, 10:15 pm, Fabiano  wrote:
> On Wednesday, December 29, 2010 1:59:24 AM UTC-2, mdipierro wrote:
> > The book is incorrect. There is no problem with multiple forms per page
>
> That is exactly what I said, but that is not my point.
>
> My point is: The fact that the book is incorrect may pose a security risk to
> users that follow it and don't know that it is incorrect.
>
> Users may code a CSRF vulnerable application by inadvertently disabling the
> CSRF protection when following the incorrect recommendation on the book.
>
> Regards,
> Fabiano.


[web2py] Re: Book misinformation about Multiple submission prevention with multiple forms

2010-12-28 Thread cjrh
On Dec 29, 7:13 am, mdipierro  wrote:
> You are right. We will fix it in the next edition.

I made a fix in the online book (more of a deletion, really).  Please
Fabiano check it to make sure the new text is accurate:

http://web2py.com/book/default/chapter/07#Multiple-forms-per-page


[web2py] Re: Book misinformation about Multiple submission prevention with multiple forms

2010-12-28 Thread Fabiano
Yes, much better, you didn't forget to update the sample code as well ;)

On Wednesday, December 29, 2010 4:01:36 AM UTC-2, cjrh wrote:
>
> On Dec 29, 7:13 am, mdipierro  wrote: 
> > You are right. We will fix it in the next edition. 
>
> I made a fix in the online book (more of a deletion, really).  Please 
> Fabiano check it to make sure the new text is accurate: 
>
> http://web2py.com/book/default/chapter/07#Multiple-forms-per-page 
>


  1   2   >