[web2py] Re: inter-component communication

2010-12-24 Thread weheh
I thinking componentizing is the future present of website development.


Re: [web2py] Re: please explain this

2010-12-24 Thread Sahil Arora
thanks

On Sat, Dec 25, 2010 at 12:09 PM, Thadeus Burgess wrote:

> Escape will convert the text to html entities. For example,
>
> >>> x = "A 'quote' is bold"
> >>> print response.write(x, escape=True)
> A 'quote' is bold
>
> This protects your page from html injection hacks. If you need to display
> html from a variable and you know absolutely sure that it is safe, use
>
> {{=XML(x)}}
>
> Which also provides some helper methods to allow you to select "safe" tags
> without allowing everything.
>
> --
> Thadeus
>
>
>
>
>
> On Fri, Dec 24, 2010 at 11:39 PM, Sahil Arora wrote:
>
>> I am asking what does escape=true does
>>
>>
>> On Sat, Dec 25, 2010 at 11:02 AM, mdipierro wrote:
>>
>>> {{=x}}
>>>
>>> is equivalent to
>>>
>>> {{response.write(x,escape=True)}}
>>>
>>> Did I answer the question?
>>>
>>>
>>> On Dec 24, 10:04 pm, Sahil Arora  wrote:
>>> > what do you mean by word 'escape' when we say escape = False
>>> >
>>> > or
>>> > in
>>> > {{=x}}
>>> > Variables injected into the HTML in this way are escaped by default.
>>> The
>>> > escaping is ignored if x is an XML object, even if escape is set to
>>> True.
>>> >
>>> > --
>>> > Sahil Arora
>>> > B.Tech 2nd year
>>> > Computer Science and Engineering
>>> > IIT Delhi
>>> > Contact No: +91 9871491046
>>>
>>
>>
>>
>> --
>> Sahil Arora
>> B.Tech 2nd year
>> Computer Science and Engineering
>> IIT Delhi
>> Contact No: +91 9871491046
>>
>
>


-- 
Sahil Arora
B.Tech 2nd year
Computer Science and Engineering
IIT Delhi
Contact No: +91 9871491046


Re: [web2py] Re: please explain this

2010-12-24 Thread Thadeus Burgess
Escape will convert the text to html entities. For example,

>>> x = "A 'quote' is bold"
>>> print response.write(x, escape=True)
A 'quote' is bold

This protects your page from html injection hacks. If you need to display
html from a variable and you know absolutely sure that it is safe, use

{{=XML(x)}}

Which also provides some helper methods to allow you to select "safe" tags
without allowing everything.

--
Thadeus




On Fri, Dec 24, 2010 at 11:39 PM, Sahil Arora wrote:

> I am asking what does escape=true does
>
>
> On Sat, Dec 25, 2010 at 11:02 AM, mdipierro wrote:
>
>> {{=x}}
>>
>> is equivalent to
>>
>> {{response.write(x,escape=True)}}
>>
>> Did I answer the question?
>>
>>
>> On Dec 24, 10:04 pm, Sahil Arora  wrote:
>> > what do you mean by word 'escape' when we say escape = False
>> >
>> > or
>> > in
>> > {{=x}}
>> > Variables injected into the HTML in this way are escaped by default. The
>> > escaping is ignored if x is an XML object, even if escape is set to
>> True.
>> >
>> > --
>> > Sahil Arora
>> > B.Tech 2nd year
>> > Computer Science and Engineering
>> > IIT Delhi
>> > Contact No: +91 9871491046
>>
>
>
>
> --
> Sahil Arora
> B.Tech 2nd year
> Computer Science and Engineering
> IIT Delhi
> Contact No: +91 9871491046
>


Re: [web2py] Re: please explain this

2010-12-24 Thread Sahil Arora
I am asking what does escape=true does

On Sat, Dec 25, 2010 at 11:02 AM, mdipierro  wrote:

> {{=x}}
>
> is equivalent to
>
> {{response.write(x,escape=True)}}
>
> Did I answer the question?
>
>
> On Dec 24, 10:04 pm, Sahil Arora  wrote:
> > what do you mean by word 'escape' when we say escape = False
> >
> > or
> > in
> > {{=x}}
> > Variables injected into the HTML in this way are escaped by default. The
> > escaping is ignored if x is an XML object, even if escape is set to True.
> >
> > --
> > Sahil Arora
> > B.Tech 2nd year
> > Computer Science and Engineering
> > IIT Delhi
> > Contact No: +91 9871491046
>



-- 
Sahil Arora
B.Tech 2nd year
Computer Science and Engineering
IIT Delhi
Contact No: +91 9871491046


[web2py] Re: inter-component communication

2010-12-24 Thread mdipierro
it is ok. i just it is more readable to use resnpose.js

On Dec 24, 11:18 pm, weheh  wrote:
> I don't understand. Let's say app has 2 components, a and b, each with
> its load view. I have discovered that an ajax that causes a to go to
> the server can then have a update b by returning a
> jQuery("#b_some_id").html("hello");
>
> I discovered this because I'm completely recasting my app as
> components and all the ajax scripts from before still work (after
> getting updating urls). I know this isn't what the doc describes
> (using response.js), but is it kosher, anyway?
>
> On Dec 24, 10:33 pm, mdipierro  wrote:
>
> > You can do and there is nothing against it. It just that the
> > components should not directly communicate serverside, execpt by
> > sharing data in session. The component can return response.js with
> > client-side instructions that affect other components. That is the
> > idea and that is fine.
>
> > On Dec 24, 7:09 pm, weheh  wrote:
>
> > > I'm diving into components but the doc says something that could be a
> > > show-stopper:
>
> > > "A component ... must perform its task independently of the rest of
> > > the page."
>
> > > I want to be able to ajax click on an item in one component and have
> > > it update a div in another component. I can't imagine this won't be
> > > possible, but the doc seems to suggest otherwise.
>
>


[web2py] Re: memory leak - model remains in memory after requests

2010-12-24 Thread mdipierro
There is an easy way to check this: run web2py with any other web
server using the new web2py/anyserver.py script.



On Dec 24, 10:12 pm, Timbo  wrote:
> Thadeus,
>
> You seem to have more knowledge about this problem.  Can you file a
> bug report?  Did you know that Rocket was recently updated fixing
> several bugs (and creating one that has already be addressed).  I'm
> not denying the possibility, but let's be a good open source
> community.
>
> David,
>
> If your environment allows it, please replace rocket.py line 1071
> "break" with "return".  Note that this will put a hard limit on the
> number of requests/second rocket can serve to the number of
> min_threads set.  If the problem remains after that, then rocket is
> not the issue.
>
> I'm tending to side with Massimo.  Caching issue?
>
> -tim
>
> On Dec 24, 6:20 pm, Thadeus Burgess  wrote:
>
> > This is due to the built in rocket server (it is not ment for production).
> > If you use Apache with mod_wsgi this will not happen.
>
> > --
> > Thadeus
>
> > 2010/12/24 David Zejda 
>
> > > -BEGIN PGP SIGNED MESSAGE-
> > > Hash: SHA1
>
> > > My web2py instance gradually eats memory, during day the consumption
> > > grows up to several gigs, so I have to restart often. According to guppy
> > > most of memory is occupied by gluon.dal.Field and other classes of dal:
>
> > > Partition of a set of 3231760 objects. Total size = 443724152 bytes.
> > >  Index  Count   %     Size   % Cumulative  % Kind
> > >     0 113419   4 189636568  43 189636568  43 dict of gluon.dal.Field
> > >     1 1324208  41 80561096  18 270197664  61 str
> > >     2 328642  10 15982732   4 286180396  64 tuple
> > >     3  26637   1 13851240   3 300031636  68 dict of
> > > gluon.validators.IS_IN_DB
> > >     4  98796   3 13436256   3 313467892  71 dict of gluon.dal.Set
> > >     5  20042   1 13344464   3 326812356  74 dict (no owner)
> > >     6   8199   0 11860464   3 338672820  76 gluon.dal.Row
> > >     7  16615   1 11482224   3 350155044  79 gluon.dal.Table
> > >     8  63682   2  8660752   2 358815796  81 dict of gluon.dal.Query
> > >     9 137779   4  7363776   2 366179572  83 list
> > > <2282 more rows. Type e.g. '_.more' to view.>
>
> > > The proportion is relatively stable. It seems that model definition
> > > remains in memory after each request. It is probably caused by a weird
> > > reference, but I'm not sure how to track it. Please do you have any ideas?
>
> > > Thanks :)
> > > David
> > > -BEGIN PGP SIGNATURE-
> > > Version: GnuPG v1.4.9 (GNU/Linux)
> > > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> > > iEYEARECAAYFAk0VN9gACgkQ3oCkkciamVFHHwCfWiIkmrH9buBYA/7HvgIbz+mR
> > > ei0AniZ0UYwZtj9zagp2sx/IawmBE2iA
> > > =9cqX
> > > -END PGP SIGNATURE-
>
>


[web2py] Re: please explain this

2010-12-24 Thread mdipierro
{{=x}}

is equivalent to

{{response.write(x,escape=True)}}

Did I answer the question?


On Dec 24, 10:04 pm, Sahil Arora  wrote:
> what do you mean by word 'escape' when we say escape = False
>
> or
> in
> {{=x}}
> Variables injected into the HTML in this way are escaped by default. The
> escaping is ignored if x is an XML object, even if escape is set to True.
>
> --
> Sahil Arora
> B.Tech 2nd year
> Computer Science and Engineering
> IIT Delhi
> Contact No: +91 9871491046


[web2py] Re: inter-component communication

2010-12-24 Thread weheh
I don't understand. Let's say app has 2 components, a and b, each with
its load view. I have discovered that an ajax that causes a to go to
the server can then have a update b by returning a
jQuery("#b_some_id").html("hello");

I discovered this because I'm completely recasting my app as
components and all the ajax scripts from before still work (after
getting updating urls). I know this isn't what the doc describes
(using response.js), but is it kosher, anyway?

On Dec 24, 10:33 pm, mdipierro  wrote:
> You can do and there is nothing against it. It just that the
> components should not directly communicate serverside, execpt by
> sharing data in session. The component can return response.js with
> client-side instructions that affect other components. That is the
> idea and that is fine.
>
> On Dec 24, 7:09 pm, weheh  wrote:
>
> > I'm diving into components but the doc says something that could be a
> > show-stopper:
>
> > "A component ... must perform its task independently of the rest of
> > the page."
>
> > I want to be able to ajax click on an item in one component and have
> > it update a div in another component. I can't imagine this won't be
> > possible, but the doc seems to suggest otherwise.
>
>


[web2py] Re: memory leak - model remains in memory after requests

2010-12-24 Thread Timbo
Thadeus,

You seem to have more knowledge about this problem.  Can you file a
bug report?  Did you know that Rocket was recently updated fixing
several bugs (and creating one that has already be addressed).  I'm
not denying the possibility, but let's be a good open source
community.

David,

If your environment allows it, please replace rocket.py line 1071
"break" with "return".  Note that this will put a hard limit on the
number of requests/second rocket can serve to the number of
min_threads set.  If the problem remains after that, then rocket is
not the issue.

I'm tending to side with Massimo.  Caching issue?

-tim

On Dec 24, 6:20 pm, Thadeus Burgess  wrote:
> This is due to the built in rocket server (it is not ment for production).
> If you use Apache with mod_wsgi this will not happen.
>
> --
> Thadeus
>
> 2010/12/24 David Zejda 
>
>
>
>
>
>
>
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
>
> > My web2py instance gradually eats memory, during day the consumption
> > grows up to several gigs, so I have to restart often. According to guppy
> > most of memory is occupied by gluon.dal.Field and other classes of dal:
>
> > Partition of a set of 3231760 objects. Total size = 443724152 bytes.
> >  Index  Count   %     Size   % Cumulative  % Kind
> >     0 113419   4 189636568  43 189636568  43 dict of gluon.dal.Field
> >     1 1324208  41 80561096  18 270197664  61 str
> >     2 328642  10 15982732   4 286180396  64 tuple
> >     3  26637   1 13851240   3 300031636  68 dict of
> > gluon.validators.IS_IN_DB
> >     4  98796   3 13436256   3 313467892  71 dict of gluon.dal.Set
> >     5  20042   1 13344464   3 326812356  74 dict (no owner)
> >     6   8199   0 11860464   3 338672820  76 gluon.dal.Row
> >     7  16615   1 11482224   3 350155044  79 gluon.dal.Table
> >     8  63682   2  8660752   2 358815796  81 dict of gluon.dal.Query
> >     9 137779   4  7363776   2 366179572  83 list
> > <2282 more rows. Type e.g. '_.more' to view.>
>
> > The proportion is relatively stable. It seems that model definition
> > remains in memory after each request. It is probably caused by a weird
> > reference, but I'm not sure how to track it. Please do you have any ideas?
>
> > Thanks :)
> > David
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.9 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> > iEYEARECAAYFAk0VN9gACgkQ3oCkkciamVFHHwCfWiIkmrH9buBYA/7HvgIbz+mR
> > ei0AniZ0UYwZtj9zagp2sx/IawmBE2iA
> > =9cqX
> > -END PGP SIGNATURE-


[web2py] please explain this

2010-12-24 Thread Sahil Arora
what do you mean by word 'escape' when we say escape = False

or
in
{{=x}}
Variables injected into the HTML in this way are escaped by default. The
escaping is ignored if x is an XML object, even if escape is set to True.

-- 
Sahil Arora
B.Tech 2nd year
Computer Science and Engineering
IIT Delhi
Contact No: +91 9871491046


[web2py] Re: Custom form

2010-12-24 Thread mdipierro
+1

On Dec 24, 8:48 pm, rochacbruno  wrote:
> Em 24/12/2010, às 16:38, mdipierro  escreveu:
>
> > please no more links in code. :-(
>
> I always copy the code from traceback in tickets page and it is copied 
> formated.
>
> We need an option to copy raw text from the code in errors page.
>
> Most syntax highliters can do that, so I think this could be easy with JS to 
> create a raw copy button.
>
> This would be useful for peeking code in admin/pluginwiki too.
>
> I mentioned that here before ( sometime when I pointed the Thadeu's weblog 
> which has this feature)
>
> I'll try to include (raw, copy, print) buttons as options to highlight.py 
> CODE helper and send a patch to explain better what I am saying.
>
> Bruno


[web2py] Re: inter-component communication

2010-12-24 Thread mdipierro
You can do and there is nothing against it. It just that the
components should not directly communicate serverside, execpt by
sharing data in session. The component can return response.js with
client-side instructions that affect other components. That is the
idea and that is fine.

On Dec 24, 7:09 pm, weheh  wrote:
> I'm diving into components but the doc says something that could be a
> show-stopper:
>
> "A component ... must perform its task independently of the rest of
> the page."
>
> I want to be able to ajax click on an item in one component and have
> it update a div in another component. I can't imagine this won't be
> possible, but the doc seems to suggest otherwise.


[web2py] Re: memory leak - model remains in memory after requests

2010-12-24 Thread mdipierro
Are we sure it is not a cache issue? Caching selects or actions with
arguments eats memory.

On Dec 24, 6:26 pm, Jonathan Lundell  wrote:
> On Dec 24, 2010, at 4:20 PM, Thadeus Burgess wrote:
>
> > This is due to the built in rocket server (it is not ment for production). 
> > If you use Apache with mod_wsgi this will not happen.
>
> Do we understand why? Seems like it ought to be fixable.
>
>
>
> > --
> > Thadeus
>
> > 2010/12/24 David Zejda 
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
>
> > My web2py instance gradually eats memory, during day the consumption
> > grows up to several gigs, so I have to restart often. According to guppy
> > most of memory is occupied by gluon.dal.Field and other classes of dal:
>
> > Partition of a set of 3231760 objects. Total size = 443724152 bytes.
> >  Index  Count   %     Size   % Cumulative  % Kind
> >     0 113419   4 189636568  43 189636568  43 dict of gluon.dal.Field
> >     1 1324208  41 80561096  18 270197664  61 str
> >     2 328642  10 15982732   4 286180396  64 tuple
> >     3  26637   1 13851240   3 300031636  68 dict of
> > gluon.validators.IS_IN_DB
> >     4  98796   3 13436256   3 313467892  71 dict of gluon.dal.Set
> >     5  20042   1 13344464   3 326812356  74 dict (no owner)
> >     6   8199   0 11860464   3 338672820  76 gluon.dal.Row
> >     7  16615   1 11482224   3 350155044  79 gluon.dal.Table
> >     8  63682   2  8660752   2 358815796  81 dict of gluon.dal.Query
> >     9 137779   4  7363776   2 366179572  83 list
> > <2282 more rows. Type e.g. '_.more' to view.>
>
> > The proportion is relatively stable. It seems that model definition
> > remains in memory after each request. It is probably caused by a weird
> > reference, but I'm not sure how to track it. Please do you have any ideas?
>
> > Thanks :)
> > David
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.9 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> > iEYEARECAAYFAk0VN9gACgkQ3oCkkciamVFHHwCfWiIkmrH9buBYA/7HvgIbz+mR
> > ei0AniZ0UYwZtj9zagp2sx/IawmBE2iA
> > =9cqX
> > -END PGP SIGNATURE-
>
>


[web2py] Re: Server slow

2010-12-24 Thread mdipierro
No idea. How much data.
What db? is it local? Probably something is wrong anyway.

On Dec 24, 5:55 pm, Kenneth Lundström 
wrote:
> I finally had time to find out a little about loggin.conf.
>
> In my logs/web2py.log I get this line:
> 2010-12-25 01:42:30,097 - root - INFO - time to fetch 1.81220602989
>
> So it takes under 2 seconds to fetch the data and the rest 37 to show
> it? How come?
>
> Kenneth
>
> > Were is this logged, I could not find anything in any logs?
>
> > Kenneth
>
> >> try
>
> >> import time, logging
>
> >> def testing():
> >>      t0=time.time()
> >>      orders = db(db.orders.id>  0).select()
> >>      logging.info('time to fetch %s' % (time.time()-t0))
> >>      return orders
>
> >> so you can isolate the problem and see if it is in fetching or
> >> somewhere else (for example session locking).
>
> >> On Dec 2, 4:21 pm, Kenneth Lundstr m
> >> wrote:
> >>> >  When you test is that the only active connection to the db?
>
> >>> I tested it on an application running on the test instance. There could
> >>> have been lite activity one production site.
> >>> But when I tested loading the same function five times in about 10
> >>> minutes I allways 39 seconds to load the data.
>
> >>> Kenneth
>
>  2010/12/2 Kenneth Lundstr m:
> >> Please tell us more about the setup. Are the three instances behind
> >> running on the same server?
> > Yes.
> >> why three? What do they do?
> > One is production, one is testing and last one is development. I
> > had two
> > instances running on a virtual server before and it worked fine.
> >> This is not normal but I suspect the problem is with database.
> >> Did you set DAL(...,pool_size=10)?
> > No, but I tried but no change.
> > If I try to select more rows:
> > def testing():
> >      orders = db(db.orders.id>    0).select()
> >      return orders
> > It takes 80 seconds to return 1608 rows.
> > If I change the return to return len(troops) it only takes 1,5
> > seconds.
> > I have no view defined, just trying out the database.
> > Kenneth
> >> On Dec 2, 5:13 am, Kenneth Lundstr m
> >> wrote:
> >>> Hello list,
> >>> need some help finding out why my server is so slow.
> >>> The server is with a Intel Celeron 2.66 GHz CPU, 4 GB of memory
> >>> CentOS 5.5 64-bit, Apache 2.2.3, MySQL 5.0.77, mod_wsgi, Web2py
> >>> 1.89.5
> >>> The server is dedicated to web2py, there is three instances of
> >>> web2py
> >>> running.
> >>> I have migrate=False, sessions on disc.
> >>> If I try the following code
> >>> def testing():
> >>>        customers = db(db.customer.id>      0).select()
> >>>        return customers
> >>> takes 39 seconds, 5 times in a row, to return 979 rows.
> >>> If I put db.customer<      100 it takes 4,5 seconds to return 87
> >>> rows.
> >>> Is it just me or are this a bit long times?
> >>> Kenneth
>
>


Re: [web2py] Re: Custom form

2010-12-24 Thread rochacbruno
Em 24/12/2010, às 16:38, mdipierro  escreveu:

> please no more links in code. :-(

I always copy the code from traceback in tickets page and it is copied 
formated. 

We need an option to copy raw text from the code in errors page. 

Most syntax highliters can do that, so I think this could be easy with JS to 
create a raw copy button. 

This would be useful for peeking code in admin/pluginwiki too. 

I mentioned that here before ( sometime when I pointed the Thadeu's weblog 
which has this feature)

I'll try to include (raw, copy, print) buttons as options to highlight.py CODE 
helper and send a patch to explain better what I am saying. 

Bruno

[web2py] inter-component communication

2010-12-24 Thread weheh
I'm diving into components but the doc says something that could be a
show-stopper:

"A component ... must perform its task independently of the rest of
the page."

I want to be able to ajax click on an item in one component and have
it update a div in another component. I can't imagine this won't be
possible, but the doc seems to suggest otherwise.


Re: [web2py] memory leak - model remains in memory after requests

2010-12-24 Thread Jonathan Lundell
On Dec 24, 2010, at 4:20 PM, Thadeus Burgess wrote:
> This is due to the built in rocket server (it is not ment for production). If 
> you use Apache with mod_wsgi this will not happen.

Do we understand why? Seems like it ought to be fixable.

> 
> --
> Thadeus
> 
> 
> 
> 
> 2010/12/24 David Zejda 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> My web2py instance gradually eats memory, during day the consumption
> grows up to several gigs, so I have to restart often. According to guppy
> most of memory is occupied by gluon.dal.Field and other classes of dal:
> 
> Partition of a set of 3231760 objects. Total size = 443724152 bytes.
>  Index  Count   % Size   % Cumulative  % Kind
> 0 113419   4 189636568  43 189636568  43 dict of gluon.dal.Field
> 1 1324208  41 80561096  18 270197664  61 str
> 2 328642  10 15982732   4 286180396  64 tuple
> 3  26637   1 13851240   3 300031636  68 dict of
> gluon.validators.IS_IN_DB
> 4  98796   3 13436256   3 313467892  71 dict of gluon.dal.Set
> 5  20042   1 13344464   3 326812356  74 dict (no owner)
> 6   8199   0 11860464   3 338672820  76 gluon.dal.Row
> 7  16615   1 11482224   3 350155044  79 gluon.dal.Table
> 8  63682   2  8660752   2 358815796  81 dict of gluon.dal.Query
> 9 137779   4  7363776   2 366179572  83 list
> <2282 more rows. Type e.g. '_.more' to view.>
> 
> The proportion is relatively stable. It seems that model definition
> remains in memory after each request. It is probably caused by a weird
> reference, but I'm not sure how to track it. Please do you have any ideas?
> 
> Thanks :)
> David
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAk0VN9gACgkQ3oCkkciamVFHHwCfWiIkmrH9buBYA/7HvgIbz+mR
> ei0AniZ0UYwZtj9zagp2sx/IawmBE2iA
> =9cqX
> -END PGP SIGNATURE-
> 




Re: [web2py] memory leak - model remains in memory after requests

2010-12-24 Thread Thadeus Burgess
This is due to the built in rocket server (it is not ment for production).
If you use Apache with mod_wsgi this will not happen.

--
Thadeus




2010/12/24 David Zejda 

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> My web2py instance gradually eats memory, during day the consumption
> grows up to several gigs, so I have to restart often. According to guppy
> most of memory is occupied by gluon.dal.Field and other classes of dal:
>
> Partition of a set of 3231760 objects. Total size = 443724152 bytes.
>  Index  Count   % Size   % Cumulative  % Kind
> 0 113419   4 189636568  43 189636568  43 dict of gluon.dal.Field
> 1 1324208  41 80561096  18 270197664  61 str
> 2 328642  10 15982732   4 286180396  64 tuple
> 3  26637   1 13851240   3 300031636  68 dict of
> gluon.validators.IS_IN_DB
> 4  98796   3 13436256   3 313467892  71 dict of gluon.dal.Set
> 5  20042   1 13344464   3 326812356  74 dict (no owner)
> 6   8199   0 11860464   3 338672820  76 gluon.dal.Row
> 7  16615   1 11482224   3 350155044  79 gluon.dal.Table
> 8  63682   2  8660752   2 358815796  81 dict of gluon.dal.Query
> 9 137779   4  7363776   2 366179572  83 list
> <2282 more rows. Type e.g. '_.more' to view.>
>
> The proportion is relatively stable. It seems that model definition
> remains in memory after each request. It is probably caused by a weird
> reference, but I'm not sure how to track it. Please do you have any ideas?
>
> Thanks :)
> David
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAk0VN9gACgkQ3oCkkciamVFHHwCfWiIkmrH9buBYA/7HvgIbz+mR
> ei0AniZ0UYwZtj9zagp2sx/IawmBE2iA
> =9cqX
> -END PGP SIGNATURE-
>


[web2py] memory leak - model remains in memory after requests

2010-12-24 Thread David Zejda
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

My web2py instance gradually eats memory, during day the consumption
grows up to several gigs, so I have to restart often. According to guppy
most of memory is occupied by gluon.dal.Field and other classes of dal:

Partition of a set of 3231760 objects. Total size = 443724152 bytes.
 Index  Count   % Size   % Cumulative  % Kind
 0 113419   4 189636568  43 189636568  43 dict of gluon.dal.Field
 1 1324208  41 80561096  18 270197664  61 str
 2 328642  10 15982732   4 286180396  64 tuple
 3  26637   1 13851240   3 300031636  68 dict of
gluon.validators.IS_IN_DB
 4  98796   3 13436256   3 313467892  71 dict of gluon.dal.Set
 5  20042   1 13344464   3 326812356  74 dict (no owner)
 6   8199   0 11860464   3 338672820  76 gluon.dal.Row
 7  16615   1 11482224   3 350155044  79 gluon.dal.Table
 8  63682   2  8660752   2 358815796  81 dict of gluon.dal.Query
 9 137779   4  7363776   2 366179572  83 list
<2282 more rows. Type e.g. '_.more' to view.>

The proportion is relatively stable. It seems that model definition
remains in memory after each request. It is probably caused by a weird
reference, but I'm not sure how to track it. Please do you have any ideas?

Thanks :)
David
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAk0VN9gACgkQ3oCkkciamVFHHwCfWiIkmrH9buBYA/7HvgIbz+mR
ei0AniZ0UYwZtj9zagp2sx/IawmBE2iA
=9cqX
-END PGP SIGNATURE-


Re: [web2py] Re: Server slow

2010-12-24 Thread Kenneth Lundström

I finally had time to find out a little about loggin.conf.

In my logs/web2py.log I get this line:
2010-12-25 01:42:30,097 - root - INFO - time to fetch 1.81220602989

So it takes under 2 seconds to fetch the data and the rest 37 to show 
it? How come?



Kenneth


Were is this logged, I could not find anything in any logs?


Kenneth


try

import time, logging

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

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


On Dec 2, 4:21 pm, Kenneth Lundström
wrote:

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

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

Kenneth




2010/12/2 Kenneth Lundström:

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

Yes.

why three? What do they do?
One is production, one is testing and last one is development. I 
had two

instances running on a virtual server before and it worked fine.

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

No, but I tried but no change.
If I try to select more rows:
def testing():
 orders = db(db.orders.id>0).select()
 return orders
It takes 80 seconds to return 1608 rows.
If I change the return to return len(troops) it only takes 1,5 
seconds.

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

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

Hello list,
need some help finding out why my server is so slow.
The server is with a Intel Celeron 2.66 GHz CPU, 4 GB of memory
CentOS 5.5 64-bit, Apache 2.2.3, MySQL 5.0.77, mod_wsgi, Web2py 
1.89.5
The server is dedicated to web2py, there is three instances of 
web2py

running.
I have migrate=False, sessions on disc.
If I try the following code
def testing():
   customers = db(db.customer.id>  0).select()
   return customers
takes 39 seconds, 5 times in a row, to return 979 rows.
If I put db.customer<  100 it takes 4,5 seconds to return 87 
rows.

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








[web2py] Re: Any success getting web2py to run on Cherokee?

2010-12-24 Thread pbreit
Cool, thanks for following up. I did manage to finally get something working 
and turned it into a new slice:
http://web2pyslices.com/main/slices/take_slice/110

This is for Cherokee 1.0.14 which has a slightly different front-end. I also 
was able to get self-signed certs set up.

Seems like a pretty nice setup.


[web2py] Re: ajax polling with web2py [Closed]

2010-12-24 Thread weheh
Looks like this is going to have to be done with components. Didn't
know until today that they even existed. Thank you chapter 13!

On Dec 24, 3:53 pm, weheh  wrote:
> Argh. I'm struggling. The third arg to web2py_ajax_page is data. If
> I'm ajaxing a multi-field form, can I make this
> data=['field1','field2',...]? I'm trying it but it doesn't seem to be
> working.
>
> On Dec 24, 1:36 pm, mdipierro  wrote:
>
> > The general solution is web2py_ajax_page in my previous example and
> > return js using response.js.
>
> > On Dec 24, 11:22 am, weheh  wrote:
>
> > > Yes, I do have an ajax generated by code inside another ajax. But I'm
> > > not married to that approach, especially if it doesn't work. I'm just
> > > looking for anything that works -- doesn't have to be pretty.
>
> > > Bottom line, we need a general solution to this problem. User clicks
> > > an ajax-ified widget/link/whatever. This generates a job-queue entry
> > > and a callback. Callback checks status of job and returns one of two
> > > responses. If job finished, returns final view. If job not finished,
> > > returns wait message and ajax countdown to check queue status again
> > > after prescribed time period.
>
> > > I've cracked my skull on this problem now on two different occasions
> > > over the last 3 months. On many attempts, I feel like I've gotten
> > > close, but in the end have made zero progress. As I said, this is
> > > mission critical to my app, so any help is much appreciated.
>
> > > On Dec 24, 2:22 am, mdipierro  wrote:
>
> > > > Do you have an ajax generated by code inside another ajax request?
> > > > I believe SCRIPT(...) is returned but never executed for the same
> > > > reason as in your code at the beginning of the thread: 

[web2py] Re: Any success getting web2py to run on Cherokee?

2010-12-24 Thread John-Kim Murphy
I just posted some instructions 
here
 for 
Cherokee 0.99.39. I think you can follow the same instructions for 1.0.12, 
but just be aware that the final Cherokee virtual server platform setup 
steps were changed. See the comments at the very bottom of the 
slice
:
*
*

*__D: Virtual Servers -> New (top left) *
*1: Select platform uwsgi and Add *
*2: Configuration File: /var/web2py/config.xml *
*3: Give new hostname *
*4: Documentroot: /var/web2py *
*5: Use same log as "default(combined)" *
*
*
*I could see its working for http://localhost without E,F,G and its 
beautiful!!*


Also a note to the Web2Py-Ubuntu-install script maintainers: "Universe" 
repositories must be enabled in order to find some Web2Py dependencies. It 
was very confusing for me because I didn't realize this.


[web2py] Re: does response.js only work with web2py_ajax_page(...)? [Closed]

2010-12-24 Thread weheh
Looks like all roads lead to components.

On Dec 24, 4:15 pm, weheh  wrote:
> All my tests seem to say that response.js doesn't work with ajax(...),
> only with web2py_ajax_pag(...).
>
> On Dec 24, 3:57 pm, weheh  wrote:
>
> > Does response.js only work with web2py_ajax_page(...) call or will it
> > also work with an ajax(...) call?
>
>


Re: [web2py] Re: The stability of web2py releases

2010-12-24 Thread Kenneth Lundström

+1 for a changelog view.

The idea behind a two button upgrade is just as Branco explained, on my 
production instance I´d only upgrade to stable but on my development I´d 
upgrade to newest release just for helping out with testing.


This way maybe not everyone upgrades their production server to a not 
stable release candidate.



Kenneth


On Fri, Dec 24, 2010 at 10:18 PM, VP  wrote:

For one thing, I don't think the 2-button suggestion is a good idea;
it's just another indirect layer of information that might not be
meaningful if the underlying mechanism is meaningful.  Conversely, if
the underlying mechanism is meaningful, there's no need for the 2-
button solution.   For example, if the release mechanism follows
strictly Massimo's rule that 1.x.0 is likely a feature-introducing
"big release" with potential big bugs, where as 1.x.9 is likely a bug-
fixing release, then users can make intelligent decision to upgrade or
not; so there's no need for 2 buttons.  If this rule is not adhered as
intended, however, then 2 buttons do not help.

2-button solution doesn't solve the issue of making informed
decisions. It solves the issue of having an option between upgrading
to the next stable release, versus upgrading to the next release
candidate. The use-case is valid, and was outlined by Kenneth.
Inclusion of changelog is a good idea as well. The best place would be
the confirmation page for the upgrade action. It may also be
worthwhile to consider a single-button upgrade with a drop-down on the
confirmation page.






[web2py] Re: question about ajax(...); return false; [Closed]

2010-12-24 Thread weheh


On Dec 24, 4:42 pm, weheh  wrote:
> I guess that must be it. I am always using href="#" on my links with
> ajax onclicks, so it never redirects even if return false; is missing.
>
> On Dec 24, 4:40 pm, Marin Pranjic  wrote:
>
> > ok, i made a mistake. just ignore the explanation. didn't test :D
> > just try experimenting and see what happens.
> > return false --> prevents reloading, just like massimo said.
> > if you call function by onclick event in  with a href set, return will
> > prevent hyperlink event.
> > you can set href="#" and that will have the same effect as return false.
> > but i prefer return false
>
> > On Fri, Dec 24, 2010 at 10:26 PM, Marin Pranjic 
> > wrote:
>
> > > try this:
> > > 
> > > 
> > > 
> > >        function remove()
> > >       {
> > >       var a = document.getElementById('id');
> > >       var b = (a.parentNode).removeChild(a);
> > >       }
> > >       function add(x,y){
> > >         alert(x+y);
> > >         return x+y;
> > >         }
> > > 
> > > 
> > > 
> > > text
> > > 
> > > 
> > > 2+3?
> > > 
> > > 
>
> > > now try removing "return false" after add function.
> > > the thing is, if function returnes value, page will be reloaded.
> > > If functions does not have a return value, it will not reload the page.
> > > But using "return false" always won't hurt ;)
>
> > > p.s. you can see if it is reloaded if you remove text and click 2+3?.
> > > if text is back, it is reloaded.
>
> > > On Fri, Dec 24, 2010 at 9:52 PM, weheh  wrote:
>
> > >> I use onclick="ajax(...);" in lots of places without the return false
> > >> and never have observed the page getting reloaded on either firefox or
> > >> chrome.
>
> > >> On Dec 24, 1:37 pm, mdipierro  wrote:
> > >> > only
>
> > >> > ...
>
> > >> > else the page is reloaded no matter what the . do.
>
> > >> > On Dec 24, 11:26 am, weheh  wrote:
>
> > >> > > Should one's view *always* have a return false; statement immediately
> > >> > > after an ajax request? Why?
>
>


[web2py] Re: Anybody use web2py_ajax_page(...) function? [Closed]

2010-12-24 Thread weheh
OK, I think I figured out that I need components. Somehow, I missed
this new capability of web2py. But it looks like it is precisely what
I need.

On Dec 24, 4:44 pm, weheh  wrote:
> It takes a data argument. I'm wondering how to pass data from my form
> to the data argument?


[web2py] Anybody use web2py_ajax_page(...) function?

2010-12-24 Thread weheh
It takes a data argument. I'm wondering how to pass data from my form
to the data argument?


[web2py] Re: question about ajax(...); return false;

2010-12-24 Thread weheh
I guess that must be it. I am always using href="#" on my links with
ajax onclicks, so it never redirects even if return false; is missing.

On Dec 24, 4:40 pm, Marin Pranjic  wrote:
> ok, i made a mistake. just ignore the explanation. didn't test :D
> just try experimenting and see what happens.
> return false --> prevents reloading, just like massimo said.
> if you call function by onclick event in  with a href set, return will
> prevent hyperlink event.
> you can set href="#" and that will have the same effect as return false.
> but i prefer return false
>
> On Fri, Dec 24, 2010 at 10:26 PM, Marin Pranjic 
> wrote:
>
> > try this:
> > 
> > 
> > 
> >        function remove()
> >       {
> >       var a = document.getElementById('id');
> >       var b = (a.parentNode).removeChild(a);
> >       }
> >       function add(x,y){
> >         alert(x+y);
> >         return x+y;
> >         }
> > 
> > 
> > 
> > text
> > 
> > 
> > 2+3?
> > 
> > 
>
> > now try removing "return false" after add function.
> > the thing is, if function returnes value, page will be reloaded.
> > If functions does not have a return value, it will not reload the page.
> > But using "return false" always won't hurt ;)
>
> > p.s. you can see if it is reloaded if you remove text and click 2+3?.
> > if text is back, it is reloaded.
>
> > On Fri, Dec 24, 2010 at 9:52 PM, weheh  wrote:
>
> >> I use onclick="ajax(...);" in lots of places without the return false
> >> and never have observed the page getting reloaded on either firefox or
> >> chrome.
>
> >> On Dec 24, 1:37 pm, mdipierro  wrote:
> >> > only
>
> >> > ...
>
> >> > else the page is reloaded no matter what the . do.
>
> >> > On Dec 24, 11:26 am, weheh  wrote:
>
> >> > > Should one's view *always* have a return false; statement immediately
> >> > > after an ajax request? Why?
>
>


Re: [web2py] Re: question about ajax(...); return false;

2010-12-24 Thread Marin Pranjic
ok, i made a mistake. just ignore the explanation. didn't test :D
just try experimenting and see what happens.
return false --> prevents reloading, just like massimo said.
if you call function by onclick event in  with a href set, return will
prevent hyperlink event.
you can set href="#" and that will have the same effect as return false.
but i prefer return false

On Fri, Dec 24, 2010 at 10:26 PM, Marin Pranjic wrote:

> try this:
> 
> 
> 
>function remove()
>   {
>   var a = document.getElementById('id');
>   var b = (a.parentNode).removeChild(a);
>   }
>   function add(x,y){
> alert(x+y);
> return x+y;
> }
> 
> 
> 
> text
> 
> 
> 2+3?
> 
> 
>
> now try removing "return false" after add function.
> the thing is, if function returnes value, page will be reloaded.
> If functions does not have a return value, it will not reload the page.
> But using "return false" always won't hurt ;)
>
> p.s. you can see if it is reloaded if you remove text and click 2+3?.
> if text is back, it is reloaded.
>
>
> On Fri, Dec 24, 2010 at 9:52 PM, weheh  wrote:
>
>> I use onclick="ajax(...);" in lots of places without the return false
>> and never have observed the page getting reloaded on either firefox or
>> chrome.
>>
>> On Dec 24, 1:37 pm, mdipierro  wrote:
>> > only
>> >
>> > ...
>> >
>> > else the page is reloaded no matter what the . do.
>> >
>> > On Dec 24, 11:26 am, weheh  wrote:
>> >
>> > > Should one's view *always* have a return false; statement immediately
>> > > after an ajax request? Why?
>> >
>> >
>>
>
>


[web2py] Re: Unable to detect your browser

2010-12-24 Thread greenpoise
I did not know that. Is that a web2py common practice? last time I
read anything similar was in TGears.

Thanks again, appreciate it!


d


On Dec 23, 2:38 pm, Branko Vukelić  wrote:
> 2010/12/23 greenpoise :
>
> > brilliant!! THANKS SO MUCH!
>
> You're welcome. It also helps if you build a virtual environment for
> developing your apps. Keeps things clean.
>
> First you get virtualenv package with:
>
> $ easy_install-2.7 virtualenv
>
> Then you just run this:
>
> $ virtualenv --no-site-packages /path/to/my/env
> $ cd /path/to/my/env
> $ source bin/activate
> (env) $ python
>
> You'll notice that the interpreter version is now 2.7.x within the
> env, and that '(env)' is printed before your prompt. As far as I know,
> you cannot exit the environment other than by exiting the shell
> altogether.
>
> The environment is sealed off from your local Python install, so
> anything that you install within your environment is available only
> within the environment and if you use the ``--no-site-packages`` flag,
> no packages installed in your local Python path will not be accessible
> within the environment. Now, to develop with web2py within the
> virtualenv, you just copy web2py dir into the virtualenv dir, and
> that's it. Now you can run ``./web2py.py`` normally and web2py will
> use the interpreter installed in the env.
>
> --
> Branko Vukelic
>
> stu...@brankovukelic.comhttp://www.brankovukelic.com/


Re: [web2py] Url variable's problem

2010-12-24 Thread Jonathan Lundell
On Dec 24, 2010, at 11:30 AM, Arun K.Rajeevan wrote:
> Voila, I found the culprit.
> In linux box, I changed vars={'indx':search_form.vars.indx} to 
> vars={'i':search_form.vars.indx}
> 
> Note: key 'indx' is renamed to 'i' (indx is the name of hidden field)
> 
> I still don't know, why this occurred. 
> it's just a key name (string). still!!!

That's good. I'm still thinking that the underlying problem has something to do 
with indx showing up twice in the form submission.

Re: [web2py] Re: The stability of web2py releases

2010-12-24 Thread Branko Vukelić
On Fri, Dec 24, 2010 at 10:18 PM, VP  wrote:
> For one thing, I don't think the 2-button suggestion is a good idea;
> it's just another indirect layer of information that might not be
> meaningful if the underlying mechanism is meaningful.  Conversely, if
> the underlying mechanism is meaningful, there's no need for the 2-
> button solution.   For example, if the release mechanism follows
> strictly Massimo's rule that 1.x.0 is likely a feature-introducing
> "big release" with potential big bugs, where as 1.x.9 is likely a bug-
> fixing release, then users can make intelligent decision to upgrade or
> not; so there's no need for 2 buttons.  If this rule is not adhered as
> intended, however, then 2 buttons do not help.

2-button solution doesn't solve the issue of making informed
decisions. It solves the issue of having an option between upgrading
to the next stable release, versus upgrading to the next release
candidate. The use-case is valid, and was outlined by Kenneth.
Inclusion of changelog is a good idea as well. The best place would be
the confirmation page for the upgrade action. It may also be
worthwhile to consider a single-button upgrade with a drop-down on the
confirmation page.


-- 
Branko Vukelic

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


Re: [web2py] Re: question about ajax(...); return false;

2010-12-24 Thread Marin Pranjic
try this:



   function remove()
  {
  var a = document.getElementById('id');
  var b = (a.parentNode).removeChild(a);
  }
  function add(x,y){
alert(x+y);
return x+y;
}



text


2+3?



now try removing "return false" after add function.
the thing is, if function returnes value, page will be reloaded.
If functions does not have a return value, it will not reload the page.
But using "return false" always won't hurt ;)

p.s. you can see if it is reloaded if you remove text and click 2+3?.
if text is back, it is reloaded.

On Fri, Dec 24, 2010 at 9:52 PM, weheh  wrote:

> I use onclick="ajax(...);" in lots of places without the return false
> and never have observed the page getting reloaded on either firefox or
> chrome.
>
> On Dec 24, 1:37 pm, mdipierro  wrote:
> > only
> >
> > ...
> >
> > else the page is reloaded no matter what the . do.
> >
> > On Dec 24, 11:26 am, weheh  wrote:
> >
> > > Should one's view *always* have a return false; statement immediately
> > > after an ajax request? Why?
> >
> >
>


[web2py] Re: The stability of web2py releases

2010-12-24 Thread VP
I am also satisfied with the release mechanism, but I'm working on
small apps.  If something goes wrong it's not the end of the world for
me right now.   But I think there are at least 2 reasons why this
issue should be taken seriously.  One is that the word "Enterprise"
must be taken seriously (it was a source of criticism of web2py).  And
things like this is *one* contributing factor to whether or not this
word "Enterprise" means something.   Second reason is that while the
current release mechanism is acceptable, if web2py grows and more
people use web2py to develop critical apps, things like this
inevitably becomes important.

I think there is no need for a complex release mechanism.  I think a
simple mechanism can be effective and sufficient.

For one thing, I don't think the 2-button suggestion is a good idea;
it's just another indirect layer of information that might not be
meaningful if the underlying mechanism is meaningful.  Conversely, if
the underlying mechanism is meaningful, there's no need for the 2-
button solution.   For example, if the release mechanism follows
strictly Massimo's rule that 1.x.0 is likely a feature-introducing
"big release" with potential big bugs, where as 1.x.9 is likely a bug-
fixing release, then users can make intelligent decision to upgrade or
not; so there's no need for 2 buttons.  If this rule is not adhered as
intended, however, then 2 buttons do not help.


ONE SPECIFIC SUGGESTION I HAVE IS THIS:

One upgrade button is fine, but in addition to that, there should be a
summary Change Log, so users can preview the changes.   This together
with the current rule for release (as described by Massimo) should be
sufficient for developers to make well-informed decision to upgrade or
to wait.






[web2py] Re: does response.js only work with web2py_ajax_page(...)?

2010-12-24 Thread weheh
All my tests seem to say that response.js doesn't work with ajax(...),
only with web2py_ajax_pag(...).

On Dec 24, 3:57 pm, weheh  wrote:
> Does response.js only work with web2py_ajax_page(...) call or will it
> also work with an ajax(...) call?


[web2py] does response.js only work with web2py_ajax_page(...)?

2010-12-24 Thread weheh
Does response.js only work with web2py_ajax_page(...) call or will it
also work with an ajax(...) call?


[web2py] Re: ajax polling with web2py

2010-12-24 Thread weheh
Argh. I'm struggling. The third arg to web2py_ajax_page is data. If
I'm ajaxing a multi-field form, can I make this
data=['field1','field2',...]? I'm trying it but it doesn't seem to be
working.

On Dec 24, 1:36 pm, mdipierro  wrote:
> The general solution is web2py_ajax_page in my previous example and
> return js using response.js.
>
> On Dec 24, 11:22 am, weheh  wrote:
>
> > Yes, I do have an ajax generated by code inside another ajax. But I'm
> > not married to that approach, especially if it doesn't work. I'm just
> > looking for anything that works -- doesn't have to be pretty.
>
> > Bottom line, we need a general solution to this problem. User clicks
> > an ajax-ified widget/link/whatever. This generates a job-queue entry
> > and a callback. Callback checks status of job and returns one of two
> > responses. If job finished, returns final view. If job not finished,
> > returns wait message and ajax countdown to check queue status again
> > after prescribed time period.
>
> > I've cracked my skull on this problem now on two different occasions
> > over the last 3 months. On many attempts, I feel like I've gotten
> > close, but in the end have made zero progress. As I said, this is
> > mission critical to my app, so any help is much appreciated.
>
> > On Dec 24, 2:22 am, mdipierro  wrote:
>
> > > Do you have an ajax generated by code inside another ajax request?
> > > I believe SCRIPT(...) is returned but never executed for the same
> > > reason as in your code at the beginning of the thread: 

[web2py] Re: question about ajax(...); return false;

2010-12-24 Thread weheh
I use onclick="ajax(...);" in lots of places without the return false
and never have observed the page getting reloaded on either firefox or
chrome.

On Dec 24, 1:37 pm, mdipierro  wrote:
> only
>
> ...
>
> else the page is reloaded no matter what the . do.
>
> On Dec 24, 11:26 am, weheh  wrote:
>
> > Should one's view *always* have a return false; statement immediately
> > after an ajax request? Why?
>
>


[web2py] New QA-Stack version released (beta)

2010-12-24 Thread Julio Schwarzbeck
Hi Folks, thanks for testing the site, I've released the third beta of
qa-stack, this release includes JANRAIN login, use your google, yahoo,
openid/myopenid accounts to log in into the site, and feel free to
post test questions and answers, there are still many things to work
out but at least you can get a feel of what is to come.

Site is http://beta.qa-stack.com/

qa-stack uses a "point" system to "advance" the user to higher
"roles", which in turn allows you to do "more stuff" on the site, like
ban questions, edit other user's data, mark questions as featured,
mark answers as outstanding, etc. However, a user with lower roles can
be "upgraded" to a higher role by a SysAdmin, this will give you lots
of flexibility, there will be about 5 more cycles of beta releases and
finally a version you can download yourselves and test locally, etc.

Merry Christmas,

Julio


[web2py] Re: pointing to the DB folder with new DAL

2010-12-24 Thread mart
THANK YOU! :) working even better than before :)

BTW - the new DAL caught a couple of my mistakes. Made the change to
my script and ran it through the diff tool. Here's a snippet. You can
dump the following to a browser to see. pretty nifty!

Thanks again for quick turn around, much appreciated!

thanks,
Mart :)


http://www.w3.org/
TR/html4/strict.dtd">



Untitled Document


build_of_day = None0¶
buildOfDay =
db(db.cumulativeProperties.name=='buildOfDay').select()¶
ifor row in buildOfDay:¶if row.name == 'buildOfDay':¶
build_of_day = int(buildOfDrow.vaylue) + 1¶
else:¶
build_of_day = 0









On Dec 24, 1:47 pm, mdipierro  wrote:
> Please check trunk. I think it is now fixed.
>
> On Dec 24, 12:04 pm, mart  wrote:
>
> > Hey,
>
> > Trying the new DAL with latest trunk again.  Only one issue left which
> > is pointing to the DB folder. This used to work, now, no matter what I
> > have tried, it generates everything relative to the script  making the
> > connection. This is what I do using pre 1.9x :
>
> > tail,head = os.path.split(sys.argv[0])
> > db = DAL("sqlite://storage.sqlite",
> >                  folder="{0}/blueLite/db_storage".format(tail))
>
> > I tried different variations, but all yield the same results.
>
> > This is for my build&release system. I use both w2p, the full
> > framework, and  DAL (outside of the web context - so scripted only). I
> > need to wipe clean the entire contents of the top level folder, which
> > includes all scripts as well as the DB every time builds are kicked
> > off (which is many times a day, many different servers and OS
> > platforms).
>
> > I would prefer not having 2 versions of w2p on each box (time needed
> > in bootstrapping servers is important).
>
> > Anyone with insight convincing DAL  to make use of the 'folder' param
> > in the connection string?
>
> > Thanks,
> > Mart :)
>
>


Re: [web2py] Re: Is this broken?

2010-12-24 Thread Arun K.Rajeevan
Silly me.
I forgot to convert value into int. (it's in string form '3')


Re: [web2py] Url variable's problem

2010-12-24 Thread Arun K.Rajeevan
Voila, I found the culprit.
In linux box, I changed *vars={'indx':search_form.vars.indx}** *to* vars={
'i':search_form.vars.indx}

Note:* key 'indx' is renamed to 'i' (indx is the name of hidden field)

I still don't know, why this occurred. 
it's just a key name (string). still!!!


Re: [web2py] Url variable's problem

2010-12-24 Thread Arun K.Rajeevan
Hi hi, back on windows. Problem is still there.
If this is not python, then it must be browser.


Re: [web2py] Url variable's problem

2010-12-24 Thread Arun K.Rajeevan
Nope, I didn't go for dumping variables.
I'm also interested to know the cause. may be another day


Re: [web2py] Re: Is this broken?

2010-12-24 Thread Arun K.Rajeevan
This is only a part of original form. ;-)

Links appear in code without my knowledge. I copies from browser but new 
groups support rich text so those without using it sees links. else it's 
fine.

List have 251 elements. (it's a list of languages)


Re: [web2py] Re: Is this broken?

2010-12-24 Thread Arun K.Rajeevan
This is only a part of original form. ;-)

Links appear in code without my knowledge. I copies from browser but new 
groups support rich text so those without using it sees links. else it's 
fine.


[web2py] Re: pointing to the DB folder with new DAL

2010-12-24 Thread mdipierro
Please check trunk. I think it is now fixed.

On Dec 24, 12:04 pm, mart  wrote:
> Hey,
>
> Trying the new DAL with latest trunk again.  Only one issue left which
> is pointing to the DB folder. This used to work, now, no matter what I
> have tried, it generates everything relative to the script  making the
> connection. This is what I do using pre 1.9x :
>
> tail,head = os.path.split(sys.argv[0])
> db = DAL("sqlite://storage.sqlite",
>                  folder="{0}/blueLite/db_storage".format(tail))
>
> I tried different variations, but all yield the same results.
>
> This is for my build&release system. I use both w2p, the full
> framework, and  DAL (outside of the web context - so scripted only). I
> need to wipe clean the entire contents of the top level folder, which
> includes all scripts as well as the DB every time builds are kicked
> off (which is many times a day, many different servers and OS
> platforms).
>
> I would prefer not having 2 versions of w2p on each box (time needed
> in bootstrapping servers is important).
>
> Anyone with insight convincing DAL  to make use of the 'folder' param
> in the connection string?
>
> Thanks,
> Mart :)


[web2py] Re: Custom form

2010-12-24 Thread Arun K.Rajeevan
Oh, How that happernd.

I'm using new groups. It have advanced edit field. Hides links.
For me it doesn't show links

anyways, code without links follows. 
(*But, I'll be more than happy, if I can go with a custom form.*
**
*Only thing that I don't know in that case, is how to deal with upload field 
and make it into db.)*

db.define_table('languages',
Field('full', 'string', length=30, notnull=True, 
required=True),
Field('short', 'string', length=10 , notnull=True, 
required=True),
Field('natural', 'string', length=30),
format='%(full)s - %(short)s')

db.define_table('words',
Field('word', 'string', notnull=True, required=True),
Field('lang', db.languages, notnull=True, writable=False),
Field('entry_by', db.auth_user, notnull=True, 
readable=False, writable=False))

db.define_table('pictures',
Field('image', 'upload', notnull=True, required=True, 
label='Visual Lingua'),
Field('word', 'list:reference words', readable=False, 
writable=False, required=True),
Field('total', 'integer', readable=False, writable=False, 
default=2),
Field('clicks', 'integer', readable=False, writable=False, 
default=1),
Field('rating', 'double', readable=False, writable=False, 
compute=lambda row: row['total']/row['clicks']),
Field('entry_by', db.auth_user, notnull=True, 
readable=False, writable=False))

db.languages.full.requires = [IS_NOT_EMPTY(), 
IS_NOT_IN_DB(db, 'languages.full')]
db.languages.short.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 
'languages.short')]
db.languages.natural.requires = [IS_NOT_IN_DB(db, 'languages.natural')]

db.words.word.requires = IS_NOT_EMPTY()
db.words.lang.requires = IS_IN_DB(db, 'languages.id')
db.words.entry_by.requires = [IS_IN_DB(db, 'auth_user.id')]

db.pictures.image.requires = [IS_NOT_EMPTY(), IS_LENGTH(262144, 4096), 
IS_IMAGE(minsize=(60, 60))] #min_size 4kb, 
max_size 256kb; min_width 60px min_height 60px
db.pictures.entry_by.requires = [IS_IN_DB(db, 'auth_user.id')]


[web2py] Re: pointing to the DB folder with new DAL

2010-12-24 Thread mdipierro
I see there is a problem... working to fix it.

Massimo

On Dec 24, 12:04 pm, mart  wrote:
> Hey,
>
> Trying the new DAL with latest trunk again.  Only one issue left which
> is pointing to the DB folder. This used to work, now, no matter what I
> have tried, it generates everything relative to the script  making the
> connection. This is what I do using pre 1.9x :
>
> tail,head = os.path.split(sys.argv[0])
> db = DAL("sqlite://storage.sqlite",
>                  folder="{0}/blueLite/db_storage".format(tail))
>
> I tried different variations, but all yield the same results.
>
> This is for my build&release system. I use both w2p, the full
> framework, and  DAL (outside of the web context - so scripted only). I
> need to wipe clean the entire contents of the top level folder, which
> includes all scripts as well as the DB every time builds are kicked
> off (which is many times a day, many different servers and OS
> platforms).
>
> I would prefer not having 2 versions of w2p on each box (time needed
> in bootstrapping servers is important).
>
> Anyone with insight convincing DAL  to make use of the 'folder' param
> in the connection string?
>
> Thanks,
> Mart :)


[web2py] Re: App admin error

2010-12-24 Thread Arun K.Rajeevan
Yes, That's working now. Great & Thank you. :)


[web2py] Re: Custom form

2010-12-24 Thread mdipierro
please no more links in code. :-(

On Dec 24, 11:19 am, "Arun K.Rajeevan"  wrote:
> Following are my tables.
>
> I need a form with an image upload (that's for table pictures), a disabled 
> input with content (that's words.word) and a languages selection box(for 
> word.lang). Upon form submission, I'll populate all other fields required for 
> both tables.
>
> Is there a simple way to do this?
>
> If not,
>
> How to insert a picture manually.(with proper renaming etc., that's default)
>
> I'm running on GAE.
>
> db.define_table('languages',
>                 Field 
> ('full', 'string', 
> length=30, notnull=True, required=True),
>                 Field 
> ('short', 'string', 
> length=10 , notnull=True, required=True),
>                 Field 
> ('natural', 'string', 
> length=30),
>                 format='%(full)s - %(short)s')
>
> db.define_table('words',
>                 Field 
> ('word', 'string', 
> notnull=True, required=True),
>                 Field 
> ('lang', db.languages, 
> notnull=True, writable=False),
>                 Field 
> ('entry_by', db.auth_user, 
> notnull=True, readable=False, writable=False))
>
> db.define_table('pictures',
>                 Field 
> ('image', 'upload', 
> notnull=True, required=True, label='Visual Lingua'),
>                 Field 
> ('word', 'list:reference 
> words', readable=False, writable=False, required=True),
>                 Field 
> ('total', 'integer', 
> readable=False, writable=False, default=2),
>                 Field 
> ('clicks', 'integer', 
> readable=False, writable=False, default=1),
>                 Field 
> ('rating', 'double', 
> readable=False, writable=False, compute=lambda row: 
> row['total']/row['clicks']),
>                 Field 
> ('entry_by', db.auth_user, 
> notnull=True, readable=False, writable=False))
>
> db.languages.full.requires = [IS_NOT_EMPTY 
> (), IS_NOT_IN_DB 
> (db, 
> 'languages.full')]
> db.languages.short.requires = [IS_NOT_EMPTY 
> (), IS_NOT_IN_DB 
> (db, 
> 'languages.short')]
> db.languages.natural.requires = [IS_NOT_IN_DB 
> (db, 
> 'languages.natural')]
>
> db.words.word.requires = IS_NOT_EMPTY 
> ()
> db.words.lang.requires = IS_IN_DB 
> (db, 'languages.id')
> db.words.entry_by.requires = [IS_IN_DB 
> (db, 'auth_user.id')]
>
> db.pictures.image.requires = [IS_NOT_EMPTY 
> (), IS_LENGTH 
> (262144, 4096),
>                                 IS_IMAGE 
> (minsize=(60, 60))] 
> #min_size 4kb, max_size 256kb; min_width 60px min_height 60px
> db.pictures.entry_by.requires = [IS_IN_DB 
> (db, 'auth_user.id')]


[web2py] Re: question about ajax(...); return false;

2010-12-24 Thread mdipierro
only

...

else the page is reloaded no matter what the . do.

On Dec 24, 11:26 am, weheh  wrote:
> Should one's view *always* have a return false; statement immediately
> after an ajax request? Why?


Re: [web2py] Re: Is this broken?

2010-12-24 Thread Branko Vukelić
search_form = FORM(LABEL('Search a word: ', _for='word',
_id='word_label', _name='word_label'),
INPUT(_id='word', _name='word', requires=IS_NOT_EMPTY()),
SELECT(_name='languages', _id='languages',
requires=IS_IN_DB(db,'languages.id'), *options_added),
INPUT(_type="submit",_value="SEARCH"),
 _name='search_form')

That better? Looks like a book example, though.

On Fri, Dec 24, 2010 at 7:35 PM, mdipierro  wrote:
> Nothing changed in this respect. Probably the values of the indices [2]
> [3] is wrong.
> I will try if you post your code without links in it. ;-)
>
>
> On Dec 24, 11:21 am, "Arun K.Rajeevan"  wrote:
>> See following form
>>
>> search_form = FORM (LABEL 
>> ('Search a word: ', 
>> _for='word', _id='word_label', _name='word_label'),
>>                     INPUT 
>> (_id='word', _name='word', 
>> requires=IS_NOT_EMPTY 
>> ()),
>>                     SELECT 
>> (_name='languages', 
>> _id='languages', requires=IS_IN_DB 
>> (db,'languages.id'), 
>> *options_added),
>>                     INPUT 
>> (_type="submit",_value="SEARCH"),
>>                      _name='search_form')
>>
>>  I used to do something like search_form[2][3]['_selected']=True
>>
>> But now with 1.91.x this shows an error (Assignment with NoneType or 
>> something similar)
>>
>> What happened?
>



-- 
Branko Vukelic

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


[web2py] Re: ajax polling with web2py

2010-12-24 Thread mdipierro
The general solution is web2py_ajax_page in my previous example and
return js using response.js.

On Dec 24, 11:22 am, weheh  wrote:
> Yes, I do have an ajax generated by code inside another ajax. But I'm
> not married to that approach, especially if it doesn't work. I'm just
> looking for anything that works -- doesn't have to be pretty.
>
> Bottom line, we need a general solution to this problem. User clicks
> an ajax-ified widget/link/whatever. This generates a job-queue entry
> and a callback. Callback checks status of job and returns one of two
> responses. If job finished, returns final view. If job not finished,
> returns wait message and ajax countdown to check queue status again
> after prescribed time period.
>
> I've cracked my skull on this problem now on two different occasions
> over the last 3 months. On many attempts, I feel like I've gotten
> close, but in the end have made zero progress. As I said, this is
> mission critical to my app, so any help is much appreciated.
>
> On Dec 24, 2:22 am, mdipierro  wrote:
>
> > Do you have an ajax generated by code inside another ajax request?
> > I believe SCRIPT(...) is returned but never executed for the same
> > reason as in your code at the beginning of the thread: 

[web2py] Re: Is this broken?

2010-12-24 Thread mdipierro
Nothing changed in this respect. Probably the values of the indices [2]
[3] is wrong.
I will try if you post your code without links in it. ;-)


On Dec 24, 11:21 am, "Arun K.Rajeevan"  wrote:
> See following form
>
> search_form = FORM (LABEL 
> ('Search a word: ', 
> _for='word', _id='word_label', _name='word_label'),
>                     INPUT 
> (_id='word', _name='word', 
> requires=IS_NOT_EMPTY 
> ()),
>                     SELECT 
> (_name='languages', 
> _id='languages', requires=IS_IN_DB 
> (db,'languages.id'), 
> *options_added),
>                     INPUT 
> (_type="submit",_value="SEARCH"),
>                      _name='search_form')
>
>  I used to do something like search_form[2][3]['_selected']=True
>
> But now with 1.91.x this shows an error (Assignment with NoneType or 
> something similar)
>
> What happened?


[web2py] pointing to the DB folder with new DAL

2010-12-24 Thread mart
Hey,

Trying the new DAL with latest trunk again.  Only one issue left which
is pointing to the DB folder. This used to work, now, no matter what I
have tried, it generates everything relative to the script  making the
connection. This is what I do using pre 1.9x :

tail,head = os.path.split(sys.argv[0])
db = DAL("sqlite://storage.sqlite",
 folder="{0}/blueLite/db_storage".format(tail))

I tried different variations, but all yield the same results.

This is for my build&release system. I use both w2p, the full
framework, and  DAL (outside of the web context - so scripted only). I
need to wipe clean the entire contents of the top level folder, which
includes all scripts as well as the DB every time builds are kicked
off (which is many times a day, many different servers and OS
platforms).

I would prefer not having 2 versions of w2p on each box (time needed
in bootstrapping servers is important).

Anyone with insight convincing DAL  to make use of the 'folder' param
in the connection string?

Thanks,
Mart :)







Re: [web2py] Url variable's problem

2010-12-24 Thread Jonathan Lundell
On Dec 24, 2010, at 9:34 AM, Arun K.Rajeevan wrote:
> I'm running python 2.5.1 at windows and 2.6.5 at linux. Is there any change 
> in python's behaviors with dict()

Not a relevant one that I can think of. If you have the time and inclination, 
it'd be interesting to track down exactly what's going on. Assuming that the 
problem is reproducible

Did you get a chance to dump query_string in the failing case?



Re: [web2py] Re: form.accepts = False. How to find out why

2010-12-24 Thread Jonathan Lundell
On Dec 24, 2010, at 9:19 AM, DenesL wrote:
> 
> On Dec 24, 2:21 am, Johann Spies  wrote:
>> 
>> I have it working now and it seems that the main thing I have changed to
>> make it work was to change the name of the field (from 'id' to something
>> else).  I did not check afterwards in the documentation but I suspect that
>> SQLFORM.factory uses an 'id' field (hidden).
>> 
> Makes sense since the handling of 'id' is special but only a trace
> will tell us why.
> There is no hidden 'id' field in SQLFORM.factory

I've been thinking about this one (generally, not the id issue specifically). 
The semantics of accepts() is designed to catch form validation errors and 
provide feedback to the client. It's not designed to diagnose form programming 
errors, and many (most?) of those errors come back looking as though the form 
had not been submitted (return False, nothing in form.errors). 

That reinforces my notion that there ought to be another form variable to 
provide feedback to the designer about why a form was not accepted, say 
form.status. I realize that this might not always be clear-cut, in that in the 
event of some form errors it's not 100% obvious whether there's an error or 
there was no submission. But at least it'd be possible to describe what 
accepts() thinks it saw. 

The intent would be to help with development diagnostics, not so much for 
deployment.

>> 
>> What I could not understand was that when I the normal crud form in the html
>> there were two identical fields('id') although I had only one in my
>> definition.  Changing the name of the field corrected that and the
>> redirection took place as expected.
>> 
> What crud?.
> 




Re: [web2py] Url variable's problem

2010-12-24 Thread Arun K.Rajeevan
I'm running python 2.5.1 at windows and 2.6.5 at linux. Is there any change 
in python's behaviors with dict()

[web2py] Re: Merry Christmas

2010-12-24 Thread weheh
@Kostas -- LOL, very cute.
Happy holidays, everyone!
+1 to all the other posts, too.

On Dec 24, 9:11 am, Ramjee Ganti  wrote:
> Merry Christmas and Happy New Year to all on the group.
>
> This is one of the most active groups I am on, thanks for the excellent
> support.
>
> rAm
>
> i Think, i Wait, i Fast -- Siddharthahttp://sodidi.ramjeeganti.com
>
> On Fri, Dec 24, 2010 at 11:52 AM, Kostas M  wrote:
> > def best_wishes(web2py):
> >    for i in web2py.users:
> >        print "Dear %s I wish you Merry Christmas \
> >                     and a Happy New Year!!" % i
>
>


[web2py] Re: Custom form

2010-12-24 Thread Arun K.Rajeevan
*I'll be more than happy, if I can go with a custom form.*
*Only thing that I don't know in that case, is how to deal with upload field 
and make it into db.*


[web2py] question about ajax(...); return false;

2010-12-24 Thread weheh
Should one's view *always* have a return false; statement immediately
after an ajax request? Why?


Re: [web2py] Url variable's problem

2010-12-24 Thread Arun K.Rajeevan
Nothing else is changed AFAIK. 
some magic may be. (it's X'mas :D)


[web2py] Re: ajax polling with web2py

2010-12-24 Thread weheh
Yes, I do have an ajax generated by code inside another ajax. But I'm
not married to that approach, especially if it doesn't work. I'm just
looking for anything that works -- doesn't have to be pretty.

Bottom line, we need a general solution to this problem. User clicks
an ajax-ified widget/link/whatever. This generates a job-queue entry
and a callback. Callback checks status of job and returns one of two
responses. If job finished, returns final view. If job not finished,
returns wait message and ajax countdown to check queue status again
after prescribed time period.

I've cracked my skull on this problem now on two different occasions
over the last 3 months. On many attempts, I feel like I've gotten
close, but in the end have made zero progress. As I said, this is
mission critical to my app, so any help is much appreciated.



On Dec 24, 2:22 am, mdipierro  wrote:
> Do you have an ajax generated by code inside another ajax request?
> I believe SCRIPT(...) is returned but never executed for the same
> reason as in your code at the beginning of the thread: 

[web2py] Is this broken?

2010-12-24 Thread Arun K.Rajeevan
See following form

search_form = FORM (LABEL 
('Search a word: ', 
_for='word', _id='word_label', _name='word_label'),
INPUT 
(_id='word', _name='word', 
requires=IS_NOT_EMPTY 
()), 
SELECT 
(_name='languages', 
_id='languages', requires=IS_IN_DB 
(db,'languages.id'), 
*options_added),
INPUT 
(_type="submit",_value="SEARCH"),
 _name='search_form')

 I used to do something like search_form[2][3]['_selected']=True

But now with 1.91.x this shows an error (Assignment with NoneType or something 
similar)

What happened?



[web2py] Re: form.accepts = False. How to find out why

2010-12-24 Thread DenesL


On Dec 24, 2:21 am, Johann Spies  wrote:
>
> I have it working now and it seems that the main thing I have changed to
> make it work was to change the name of the field (from 'id' to something
> else).  I did not check afterwards in the documentation but I suspect that
> SQLFORM.factory uses an 'id' field (hidden).
>
Makes sense since the handling of 'id' is special but only a trace
will tell us why.
There is no hidden 'id' field in SQLFORM.factory
>
> What I could not understand was that when I the normal crud form in the html
> there were two identical fields('id') although I had only one in my
> definition.  Changing the name of the field corrected that and the
> redirection took place as expected.
>
What crud?.
>
> Regards
> Johann


Re: [web2py] Re: App admin error

2010-12-24 Thread Jonathan Lundell
On Dec 24, 2010, at 8:55 AM, mdipierro wrote:
> 
> This was a nasty one. It is not fixed in trunk.

now fixed in trunk

> The problem anyway was
> not with new dal but preexisting. Somehow it was not caught before.
> 
> Please check and let us know if it works for you.
> 
> On Dec 24, 3:53 am, "Arun K.Rajeevan"  wrote:
>> Oh, I forgot that I've a plug-gin(SQLite Manager) installed in my FF.
>> 
>> I tried that too, but in vein.
>> There's no problem at all.
>> 
>> Am I correctly assuming that list reference field get represented as TEXT in
>> SQLite.
>> Data is in format like |5| . so it's correct.
>> 
>> Problem is somewhere else. May be in DAL !!




[web2py] Re: App admin error

2010-12-24 Thread mdipierro
This was a nasty one. It is not fixed in trunk. The problem anyway was
not with new dal but preexisting. Somehow it was not caught before.

Please check and let us know if it works for you.

On Dec 24, 3:53 am, "Arun K.Rajeevan"  wrote:
> Oh, I forgot that I've a plug-gin(SQLite Manager) installed in my FF.
>
> I tried that too, but in vein.
> There's no problem at all.
>
> Am I correctly assuming that list reference field get represented as TEXT in
> SQLite.
> Data is in format like |5| . so it's correct.
>
> Problem is somewhere else. May be in DAL !!


[web2py] Re: application: web2py in app.yaml

2010-12-24 Thread Belov I
Problem solved.
It is necessary to restart the GAE

On 24 дек, 16:36, Belov I  wrote:
> Use:
> web2py: 1.91.4
> GoogleAppEngine: 1.4.0 - 2010-12-02
> WinXP
>
> web2py runs through GAE without problems
> But when I change the name of the application in app.yaml (ex: 1line:
> application: my_web2py)
> I get error:
> "Internal error
> Ticket issued: unrecoverable"


Re: [web2py] Url variable's problem

2010-12-24 Thread Jonathan Lundell
On Dec 24, 2010, at 8:04 AM, Arun K.Rajeevan wrote:
> After a bit of trail and error through session.flash
> 
> I changed following 
> 
>  indx = dict(indx = search_form.vars.indx)
>  redirect(URL(r=request, f='search', args=[lang, word], vars=indx))
> 
> to 
> 
>  redirect(URL(r=request, f='search', args=[lang, word], 
> vars={'indx':search_form.vars.indx}))
> 
> seems working now. (On Linux, previously was on windows) 
> But what was wrong with first approach!!!

As Massimo says, they look identical. Could you try switching it back and see 
what happens? I'm guessing that it was some other change, that fixed the 
problem, perhaps involving JavaScript. (Unless the switch from Windows to Linux 
is relevant; that would be interesting.)

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

2010-12-24 Thread mdipierro
Believe this is fixed in trunk. Did you try that. If so I will post to
stable soon.

On Dec 24, 6:24 am, Lisandro  wrote:
> I've been working with web2py for a while. Lastnight I updated to last
> version, and my webforms just collapsed (sorry for my poor english).
> 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)
>     if form.accepts(request.vars, keepvalues=True):
>         response.flash = 'New dog inserted'
>     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: application: web2py in app.yaml

2010-12-24 Thread mdipierro
The name in app.yaml should be the application id that you registered
with google.

On Dec 24, 2:36 am, Belov I  wrote:
> Use:
> web2py: 1.91.4
> GoogleAppEngine: 1.4.0 - 2010-12-02
> WinXP
>
> web2py runs through GAE without problems
> But when I change the name of the application in app.yaml (ex: 1line:
> application: my_web2py)
> I get error:
> "Internal error
> Ticket issued: unrecoverable"


[web2py] Re: Url variable's problem

2010-12-24 Thread Arun K.Rajeevan
I know, that's why I wondered, why did it produced such a weired url at 
first place.

[web2py] Re: Url variable's problem

2010-12-24 Thread mdipierro
They are equivalent.

BTW. make it shorter:

redirect(URL('search',args=[lang,
word],vars={'indx':search_form.vars.indx}))

On Dec 24, 10:04 am, "Arun K.Rajeevan"  wrote:
> After a bit of trail and error through session.flash
>
> I changed following
>
>  indx = dict(indx = search_form.vars.indx)
>  redirect(URL(r=request, f='search', args=[lang, word], vars=indx))
>
> to
>
>  redirect(URL(r=request, f='search', args=[lang, word],
> vars={'indx':search_form.vars.indx}))
>
> seems working now. (On Linux, previously was on windows)
> But what was wrong with first approach!!!


Re: [web2py] Url variable's problem

2010-12-24 Thread Arun K.Rajeevan
After a bit of trail and error through session.flash

I changed following 

 indx = dict(indx = search_form.vars.indx)
 redirect(URL(r=request, f='search', args=[lang, word], vars=indx))

to 

 redirect(URL(r=request, f='search', args=[lang, word], 
vars={'indx':search_form.vars.indx}))

seems working now. (On Linux, previously was on windows) 
But what was wrong with first approach!!!


Re: [web2py] Re: Merry Christmas

2010-12-24 Thread Ramjee Ganti
Merry Christmas and Happy New Year to all on the group.

This is one of the most active groups I am on, thanks for the excellent
support.

rAm

i Think, i Wait, i Fast -- Siddhartha
http://sodidi.ramjeeganti.com


On Fri, Dec 24, 2010 at 11:52 AM, Kostas M  wrote:

> def best_wishes(web2py):
>for i in web2py.users:
>print "Dear %s I wish you Merry Christmas \
> and a Happy New Year!!" % i
>


[web2py] Re: Great summary of web2py

2010-12-24 Thread villas
Yes Michele,  +1 to web pages!

I often see frameworks being compared in threaded discussions. That's
such a waste of time when a simple reference to a webpage could tell a
much better and more complete story.

It is a shame that when some newbie enters a search like 'web2py vs
django|flask|rails' they might so easily find some long argumentative
thread peppered with expletives with someone unfairly ranting about
something Massimo said in 2007. This was certainly my initial
experience and I can say it was quite off-putting.

We could then collectively always reference these pages in other
threads. The backlinks would really boost the SEO and the inevitable
scrutiny of devotees of other frameworks would help us keep the pages
accurate and fair.

-David


On Dec 23, 11:55 pm, Michele Comitini 
wrote:
> Maybe we should keep a comparison just on web2py.com.  Pay attention
> to framework lists around and putting a sane description there.
> It is useless and even counterproductive starting flame wars in
> threaded discussions.  It is more importante that googlers find web2py
> when
> they search a good framework to work with.
>
> 2010/12/24 JmiXIII :
>
> > Just to give a pleased newbie feed-back :
>
> > _I'm newbie to web2py (well a couple of month)
> > _I've never studied informatics nor did I have an informatic job
>
> > BUT I needed something to handle database easely + human interface +
> > network for my job
> > I tried a crack access => beurk => begin to learn python
> > I tried Zope/Plone => too heavy
> > I tried Django => not enough efficient for what I wanted
>
> > THEN
> > I've seen some comparaison made by Massimo between Django and web2py
> > 'do not remember the url)
> > AND This is these comparisons which decided me to try web2py
> > I'm very pleased because it is so efficient
>
> > you are right VP , it's a waste of time to fuel the fire. But a short
> > comparison would help newbies to make their choice and choose to try
> > web2py. Yet I'm speaking of comparison showing the efficientness of
> > web2py not long long debates/war.
>
> > On 23 déc, 23:51, VP  wrote:
> >> On Dec 23, 3:44 am, Branko Vukelić  wrote:
>
> >> > Or am I missing something?
>
> >> > In the summary, also no mention of Django or Flask.
>
> >> My comment is not just about that specific thread of discussion, but
> >> about a general PR strategy of web2py.   My suggestion to Massimo
> >> still stands.   Forget about Flask and Django !!!  Don't talk about
> >> them at all.  None. Nothing.
>
> >> People who think that Django/Flask are superior to web2py, and/or
> >> web2py is deeply flawed, aren't changing their minds.  There's no
> >> point to debate, justify, etc.
>
> >> I do not see much benefit for web2py when Massimo discusses Django/
> >> Flask.   On the other hand, the (serious) newbies will get lost in hot
> >> exchanges between the web2py folks and the Django/Flask folks.
> >> Occasionally, this dude Armin will come around the proclaim web2py to
> >> be the worst thing there is.  And my suggestion to Massimo is that he
> >> will have to live with that, and instead of spending energy to justify
> >> him, turn that energy into making web2py to be a great platform.
>
> >> Specifically, to attract newbies, I would recommend making Chapter 3
> >> of the book to be better than it currently is.   Right now, it's very
> >> good.  But I think there are places that can be improved.  This
> >> chapter is where web2py can be/should be showcased to attract the
> >> newbies.   This comes from my experience when I first learned about
> >> web2py.
>
>


[web2py] application: web2py in app.yaml

2010-12-24 Thread Belov I
Use:
web2py: 1.91.4
GoogleAppEngine: 1.4.0 - 2010-12-02
WinXP

web2py runs through GAE without problems
But when I change the name of the application in app.yaml (ex: 1line:
application: my_web2py)
I get error:
"Internal error
Ticket issued: unrecoverable"


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

2010-12-24 Thread pbreit
Bjoern: a screamingly fast Python WSGI server written in C
https://github.com/jonashaag/bjoern


[web2py] Bug in SQLFORM.factory in version 1.91.4?

2010-12-24 Thread Lisandro
I've been working with web2py for a while. Lastnight I updated to last
version, and my webforms just collapsed (sorry for my poor english).
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)
if form.accepts(request.vars, keepvalues=True):
response.flash = 'New dog inserted'
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.


Re: [web2py] Re: The stability of web2py releases

2010-12-24 Thread Branko Vukelić
2010/12/24 Kenneth Lundström :
> Is there instructions how to use the hg stuff to use the trunk. Could not
> find the hg command in the book?

Look here:

http://code.google.com/p/web2py/source/checkout

I think the double-update button is a good idea. I was going to
suggest/implement the same thing. I haven't looked yet at how the
update works server-side. Will look as soon as I have more time.

@Massimo, what do you think about cloning the project to Bitbucket?

https://bitbucket.org/


-- 
Branko Vukelic

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


Re: [web2py] Re: The stability of web2py releases

2010-12-24 Thread Kenneth Lundström

Merry christmas to the whole list.

I think this has been suggested earlier but thought I´d bring it up again.

I have two instances of web2py via wsgi and Apache running on my server. 
One reason is the possibility to upgrade my development side everytime I 
log in to admin, that way getting all new features and testing at the 
same time.


Would it be possible to get two upgrade buttons in admin, one for 
"stable" and one for the latest release. Lot of the time there their the 
same. Maybe a third button for trunk, if that is possible.


Is there instructions how to use the hg stuff to use the trunk. Could 
not find the hg command in the book?



Kenneth


+1

On Fri, Dec 24, 2010 at 8:20 AM, Luis Díaz  wrote:

+1

2010/12/24 ron_m

I for one am happy with the current release cycle. It is a good balance
between new features and the ultimate stability of release 1.XX.N  where N
is the last version before XX+1 for example. The nightly build is a bit of a
misnomer, many projects (C or C++ mostly) have some automated process that
takes trunk and compiles it to produce a .tar.gz labelled nightly which
"might" work. For web2py we should just hg pull; hg update to achieve that
result. The nightly for web2py is more like a beta because Massimo hand
picks code from trunk that will or will not be in the nightly which could
really be a weekly.

I am currently developing the application I am working on and testing is
easy enough that I test trunk at least daily. The web2py server is quite
easy to use but the code in some places is complicated and has many possible
use cases. It is only through exposure out to the user base that a large
number of use cases of the code get tested. I have even seen problems
reported where something was fixed but used by maybe one person in a way
that should not have worked resulting in the dreaded bug that worked and
became a useful feature for someone.

Once I go to production I will probably move the releases a lot slower
through the installed base. In fact I have 2 beta production systems up now
and only push a new web2py when I push a new version of the application to
the stakeholders to look at.

Massimo provides a fantastic service with the web2py project and I would
not like to see him stifled by a load of process. Anyone that has time to
test will definitely help the quality, if you don't have time, that is okay
too. I personally don't mind doing some release management between where
Massimo is burning the midnight oil and what I let out into the production
systems I have/will manage. The product is alive with new features and bug
fixes sometimes occur in minutes once reported. That is worth a lot.

Ron





--
Díaz Luis
TSU Analisis de Sistemas
Universidad de Carabobo
http://web2pyfacil.blogspot.com/
Facultad de Odontología








[web2py] Re: App admin error

2010-12-24 Thread Arun K.Rajeevan
Oh, I forgot that I've a plug-gin(SQLite Manager) installed in my FF.

I tried that too, but in vein. 
There's no problem at all.

Am I correctly assuming that list reference field get represented as TEXT in 
SQLite. 
Data is in format like |5| . so it's correct. 

Problem is somewhere else. May be in DAL !!


Re: [web2py] Url variable's problem

2010-12-24 Thread Arun K.Rajeevan
Can you point me on how to run a controller in web2py shell.

Or in that matter how to debug a web2py controller or view?


[web2py] Re: GAE shows problem.

2010-12-24 Thread Arun K.Rajeevan
Thank you for suggestion. 
It worked in 1.89.x.

But problem is resolved now.
And for the benefit of others, I get past it by running *dev_appserver.py*with 
*-c* option.
So, the data already there may be caused problem. I changed DB a little bit.
-c option clears datastore. 



Re: [web2py] Re: The stability of web2py releases

2010-12-24 Thread Branko Vukelić
+1

On Fri, Dec 24, 2010 at 8:20 AM, Luis Díaz  wrote:
> +1
>
> 2010/12/24 ron_m 
>>
>> I for one am happy with the current release cycle. It is a good balance
>> between new features and the ultimate stability of release 1.XX.N  where N
>> is the last version before XX+1 for example. The nightly build is a bit of a
>> misnomer, many projects (C or C++ mostly) have some automated process that
>> takes trunk and compiles it to produce a .tar.gz labelled nightly which
>> "might" work. For web2py we should just hg pull; hg update to achieve that
>> result. The nightly for web2py is more like a beta because Massimo hand
>> picks code from trunk that will or will not be in the nightly which could
>> really be a weekly.
>>
>> I am currently developing the application I am working on and testing is
>> easy enough that I test trunk at least daily. The web2py server is quite
>> easy to use but the code in some places is complicated and has many possible
>> use cases. It is only through exposure out to the user base that a large
>> number of use cases of the code get tested. I have even seen problems
>> reported where something was fixed but used by maybe one person in a way
>> that should not have worked resulting in the dreaded bug that worked and
>> became a useful feature for someone.
>>
>> Once I go to production I will probably move the releases a lot slower
>> through the installed base. In fact I have 2 beta production systems up now
>> and only push a new web2py when I push a new version of the application to
>> the stakeholders to look at.
>>
>> Massimo provides a fantastic service with the web2py project and I would
>> not like to see him stifled by a load of process. Anyone that has time to
>> test will definitely help the quality, if you don't have time, that is okay
>> too. I personally don't mind doing some release management between where
>> Massimo is burning the midnight oil and what I let out into the production
>> systems I have/will manage. The product is alive with new features and bug
>> fixes sometimes occur in minutes once reported. That is worth a lot.
>>
>> Ron
>>
>>
>
>
>
> --
> Díaz Luis
> TSU Analisis de Sistemas
> Universidad de Carabobo
> http://web2pyfacil.blogspot.com/
> Facultad de Odontología
>



-- 
Branko Vukelic

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


Re: [web2py] I just discovered this

2010-12-24 Thread Branko Vukelić
On Fri, Dec 24, 2010 at 8:41 AM, mdipierro  wrote:
> http://reia-lang.org/

Sweet!


-- 
Branko Vukelic

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