[web2py] Re: XML sanitizer question

2010-07-22 Thread mdipierro
I agree.

On Jul 23, 12:34 am, Jonathan Lundell  wrote:
> On Jul 22, 2010, at 10:07 PM, mr.freeze wrote:
>
> > That works. Thanks.
>
> I think perhaps sanitizer could use some work. A bare  is harmless enough. 
> And  ought to be OK.
>
>
>
> > On Jul 22, 11:23 pm, Jonathan Lundell  wrote:
> >> On Jul 22, 2010, at 7:41 PM, mr.freeze wrote:
>
> >>> Negative, it sanitizes those too:
> >> XML('test',sanitize=True,permitted_tags = 
> >> ['a']).xml()
> >>> 'test'
>
> >> Only absolute URLs are acceptable. Tryhttp://web2py.com.
>
> >>> On Jul 22, 9:38 pm, Jonathan Lundell  wrote:
>  On Jul 22, 2010, at 7:04 PM, mr.freeze wrote:
>
>  XML('test',sanitize=True,permitted_tags = ['b']).xml()
> > 'test'
>  XML('test',sanitize=True,permitted_tags = ['a']).xml()
> > 'test'
>
> > Why does the 'a' element get sanitized?
>
>  At first glance, it looks like it might require an attribute from 
>  allowed_attributes. Does it work if you give it an href or a title?
>
>  Turning off allowed_attributes won't fix it, I think, because of this:
>
>              if bt == '                  return
>
>  Seems unfortunate to have those tags hard-coded.


[web2py] Re: Trouble creating session variable

2010-07-22 Thread mdipierro
field objects cannot be stored in sessions because they contain a
reference to an open database connection. That is not serializable.

On Jul 23, 12:18 am, weheh  wrote:
> I want to create a session variable session.orderby so that later on,
> I can do
>
>     db(query).select(db.table.ALL,orderby=session.orderby)
>
> Problem is, when I set
>
>     session.orderby=db.table.field
>
> I get a ticket:
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\main.py", line 407, in wsgibase
>     session._try_store_on_disk(request, response)
>   File "C:\web2py\gluon\globals.py", line 378, in _try_store_on_disk
>     cPickle.dump(dict(self), response.session_file)
>   File "C:\Program Files\Python25\Lib\copy_reg.py", line 73, in
> _reduce_ex
>     getstate = self.__getstate__
>   File "C:\web2py\gluon\sql.py", line 1611, in __getattr__
>     return dict.__getitem__(self,key)
> KeyError: '__getstate__'
>
> What am I doing wrong?


[web2py] Re: How to pass field list to select() clause?

2010-07-22 Thread mdipierro
db(query).select(left=left,orderby=orderby,*fields)

On Jul 22, 11:58 pm, weheh  wrote:
> OK, I lied. I really want to do this
>
> db(query).select(*fields,left=left,orderby=orderby)
>
> where left and orderby are also variables.
>
> db(query).select(*fields) works OK.
>
> However,
>
> db(query).select(*fields,left=left,orderby=orderby)
>
> gives a syntax error just before the left clause:
>
>     left=left,
>        ^
> SyntaxError: invalid syntax.
>
> When I spell out the fields in the select clause, the left clause
> doesn't give the syntax error.


[web2py] Re: Why am I getting logged out automatically? [Closed but smells fishy]

2010-07-22 Thread mdipierro
What is the name of the app? That affects the name of the cookies.

On Jul 22, 11:46 pm, weheh  wrote:
> Sorry, Massimo, but I don't understand your question.


[web2py] Re: rocket performance issues

2010-07-22 Thread mdipierro
This is now in 1.81.5

On Jul 22, 11:18 pm, Phyo Arkar  wrote:
> Thats very good news. I will be trying out soon!
>
> On 7/22/10, Timbo  wrote:
>
> > OK, so it's a thread-starvation issue.  Let this be the interim fix
> > for web2py.  I've got several busy days ahead of me so I'll put out a
> > real fix for Rocket in the coming days.
>
> > -tim
>
> > On Jul 22, 11:39 am, Michael Ellis  wrote:
> >> Much improved with suggested change.  Latencies for .js/.css files reduced
> >> to 100-150 msec.  Thanks Tim!
>
> >> Cheers,
> >> Mike
>
> >> On Thu, Jul 22, 2010 at 12:27 PM, Timbo  wrote:
> >> > Try one quick change for me please...rocket is constructed around line
> >> > 655 in main.py
>
> >> > Add a parameter to the constructor call(s):  max_threads=0
>
> >> > Please let me know if that affects the problem.
>
> >> > -tim
>
> >> > On Jul 22, 10:34 am, mdipierro  wrote:
> >> > > I can reproduce the problem. I did on localhost with two different
> >> > > browsers.
> >> > > Using firebug I can see it takes 25seconds to download base.css (the
> >> > > problem is not always with the same file).
> >> > > While I did the test, I also monitored httpserver.log and I find that
> >> > > it NEVER takes more than 1.2ms serve base.css.
> >> > > This is what the log shows:
>
> >> > > 
> >> > > 127.0.0.1, 2010-07-22 10:16:38, GET, /michealellistest/static/images/
> >> > > header.png, HTTP/1.1, 304, 0.000563
> >> > > 127.0.0.1, 2010-07-22 10:16:38, GET, /favicon.ico, HTTP/1.1, 400,
> >> > > 0.000631
> >> > > 127.0.0.1, 2010-07-22 10:16:55, GET, /michealellistest/static/
> >> > > base.css, HTTP/1.1, 304, 0.000791    locks firefox for 25secs
> >> > > 
> >> > > 127.0.0.1, 2010-07-22 10:22:42, GET, /michealellistest/static/
> >> > > jquery.timers-1.2.js, HTTP/1.1, 304, 0.000552
> >> > > 127.0.0.1, 2010-07-22 10:22:42, GET, /favicon.ico, HTTP/1.1, 400,
> >> > > 0.000497
> >> > > 127.0.0.1, 2010-07-22 10:23:02, GET, /michealellistest/static/
> >> > > superfish.js, HTTP/1.1, 304, 0.000914    locks chrome for 25secs
>
> >> > > Do you see the time gaps?
>
> >> > > There is a clear pattern. Under heavy load a request that results in a
> >> > > HTTP 400 error locks Rocket.
>
> >> > > Notice that the logging is done by a wsgi application that calls
> >> > > web2py wsgibase, i.e it time how long it takes web2py to receive the
> >> > > request and send the response. The extra time must be spent inside the
> >> > > web server.
>
> >> > > It is also important that the times showed in the logs are the actual
> >> > > time when the data is being written in the logs. You can see firefox
> >> > > waiting for base.css, the server waiting to log base.css and nothing
> >> > > else is being printed during the wait, signifying that web2py is not
> >> > > running any request.
>
> >> > > We need Tim! This is a problem.
>
> >> > > Massimo
>
> >> > > On Jul 22, 9:22 am, Michael Ellis  wrote:
>
> >> > > > I've isolated the problem but absolutely do not understand it.  I
> >> > > > can
> >> > > > reproduce it with a two-line change to web2py_ajax.html.   Will
> >> > > > someone
> >> > with
> >> > > > the time and equipment please attempt to replicate  this as a sanity
> >> > check?
>
> >> > > > Here's how:
>
> >> > > > In the welcome app's web2py_ajax.html, insert the following after
> >> > > > line
> >> > 3.
>
> >> > response.files.insert(3,URL(r=request,c='static',f='jquery.sparkline.js'))
>
> >> > response.files.insert(4,URL(r=request,c='static',f='jquery.timers-1.2.js'))
>
> >> > > > Copy the attached js files into welcome/static.  They should be the
> >> > same as
> >> > > > the versions available online.
>
> >> > > > To reproduce the problem, serve web2py on your LAN.  Open the
> >> > > > welcome
> >> > home
> >> > > > page on two different machines.  One of them can be on the server.
> >> >  Briskly
> >> > > > reload the page 10 or more times on either machine then try to
> >> > > > reload
> >> > on the
> >> > > > other.  In my setup, the delay is reliably 25 seconds from the time
> >> > > > I
> >> > make
> >> > > > the last click on the first machine.
>
> >> > > > I'm able to reproduce this in FF, Chrome, and Safari using the
> >> > > > latest
> >> > web2py
> >> > > > from trunk.  Haven't tried any other browsers yet.  As noted
> >> > > > previously
> >> > both
> >> > > > machines are MacBooks running Snow Leopard.
>
> >> > > > Mike
>
> >> > > >  jquery.timers-1.2.js
> >> > > > 4KViewDownload
>
> >> > > >  jquery.sparkline.js
> >> > > > 62KViewDownload


[web2py] Re: exercise of the day

2010-07-22 Thread mdipierro
+1

On Jul 22, 7:08 pm, "mr.freeze"  wrote:
> Assuming you meant:
> r.y.y.y.t
> It works because db.a.y is a self referencing field. Inserting into
> db.a doesn't return an int, but a Reference, which has a __getattr__
> that returns the record it references. Any number of y's should work:
> r.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.t
> 't' is the virtual field which returns the length of the computed
> field, which in turn is 3*x. 'x' in this case is 'hello', so t is 15.
> You could also do:
> r.y.y.y.y.z
> to get the computed field which should return:
> hellohellohello
>
> On Jul 22, 6:50 pm, "mr.freeze"  wrote:
>
> > It shouldn't. It should throw an error at the print statement because
> > 'a' is not defined.
>
> > On Jul 22, 6:33 pm, mdipierro  wrote:
>
> > > The following code uses:
> > > 1) a computed field
> > > 2) a self reference
> > > 3) a virtual field
>
> > > >>> db.define_table('a',Field('x'),Field('y','reference 
> > > >>> a'),Field('z',compute=lambda row: row['x']*3))
> > > >>> class A:
> > > >>>      def t(self): return len(self.a.z)
> > > >>> db.a.virtualfields.append(A())
> > > >>> r=db.a.insert(x='hello')
> > > >>> r.update_record(x=r.x,y=r)
> > > >>> print a.y.y.y.y.t
>
> > > 15
>
> > > Can you explain how it works?


[web2py] Re: MENU() redefine defaults for _class, ul_class, li_class

2010-07-22 Thread mdipierro
LOL. We all are somedays

On Jul 22, 6:40 pm, Andrew Thompson  wrote:
>   On 7/22/2010 7:37 PM, Andrew Thompson wrote:
>
> >  Is it possible to redefine the defaults for  _class, ul_class, and
> > li_class on a per app basis?
>
> Nevermind, I'm an idiot.
>
> --
> Andrew Thompsonhttp://aktzero.com/


Re: [web2py] Re: XML sanitizer question

2010-07-22 Thread Jonathan Lundell
On Jul 22, 2010, at 10:07 PM, mr.freeze wrote:

> That works. Thanks.

I think perhaps sanitizer could use some work. A bare  is harmless enough. 
And  ought to be OK.

> 
> On Jul 22, 11:23 pm, Jonathan Lundell  wrote:
>> On Jul 22, 2010, at 7:41 PM, mr.freeze wrote:
>> 
>>> Negative, it sanitizes those too:
>> XML('test',sanitize=True,permitted_tags = 
>> ['a']).xml()
>>> 'test'
>> 
>> Only absolute URLs are acceptable. Tryhttp://web2py.com.
>> 
>> 
>> 
>>> On Jul 22, 9:38 pm, Jonathan Lundell  wrote:
 On Jul 22, 2010, at 7:04 PM, mr.freeze wrote:
>> 
 XML('test',sanitize=True,permitted_tags = ['b']).xml()
> 'test'
 XML('test',sanitize=True,permitted_tags = ['a']).xml()
> 'test'
>> 
> Why does the 'a' element get sanitized?
>> 
 At first glance, it looks like it might require an attribute from 
 allowed_attributes. Does it work if you give it an href or a title?
>> 
 Turning off allowed_attributes won't fix it, I think, because of this:
>> 
 if bt == '>>> return
>> 
 Seems unfortunate to have those tags hard-coded.




[web2py] Trouble creating session variable

2010-07-22 Thread weheh
I want to create a session variable session.orderby so that later on,
I can do

db(query).select(db.table.ALL,orderby=session.orderby)

Problem is, when I set

session.orderby=db.table.field

I get a ticket:

Traceback (most recent call last):
  File "C:\web2py\gluon\main.py", line 407, in wsgibase
session._try_store_on_disk(request, response)
  File "C:\web2py\gluon\globals.py", line 378, in _try_store_on_disk
cPickle.dump(dict(self), response.session_file)
  File "C:\Program Files\Python25\Lib\copy_reg.py", line 73, in
_reduce_ex
getstate = self.__getstate__
  File "C:\web2py\gluon\sql.py", line 1611, in __getattr__
return dict.__getitem__(self,key)
KeyError: '__getstate__'

What am I doing wrong?


[web2py] Re: XML sanitizer question

2010-07-22 Thread mr.freeze
That works. Thanks.

On Jul 22, 11:23 pm, Jonathan Lundell  wrote:
> On Jul 22, 2010, at 7:41 PM, mr.freeze wrote:
>
> > Negative, it sanitizes those too:
>  XML('test',sanitize=True,permitted_tags = 
>  ['a']).xml()
> > 'test'
>
> Only absolute URLs are acceptable. Tryhttp://web2py.com.
>
>
>
> > On Jul 22, 9:38 pm, Jonathan Lundell  wrote:
> >> On Jul 22, 2010, at 7:04 PM, mr.freeze wrote:
>
> >> XML('test',sanitize=True,permitted_tags = ['b']).xml()
> >>> 'test'
> >> XML('test',sanitize=True,permitted_tags = ['a']).xml()
> >>> 'test'
>
> >>> Why does the 'a' element get sanitized?
>
> >> At first glance, it looks like it might require an attribute from 
> >> allowed_attributes. Does it work if you give it an href or a title?
>
> >> Turning off allowed_attributes won't fix it, I think, because of this:
>
> >>             if bt == ' >>                 return
>
> >> Seems unfortunate to have those tags hard-coded.


[web2py] Re: How to pass field list to select() clause?

2010-07-22 Thread weheh
OK, I lied. I really want to do this

db(query).select(*fields,left=left,orderby=orderby)

where left and orderby are also variables.

db(query).select(*fields) works OK.

However,

db(query).select(*fields,left=left,orderby=orderby)

gives a syntax error just before the left clause:

left=left,
   ^
SyntaxError: invalid syntax.

When I spell out the fields in the select clause, the left clause
doesn't give the syntax error.


[web2py] Re: How to pass field list to select() clause?

2010-07-22 Thread weheh
I'd already tried that and it didn't seem to work. I'll try again.


[web2py] Re: Why am I getting logged out automatically? [Closed but smells fishy]

2010-07-22 Thread weheh
Sorry, Massimo, but I don't understand your question.


[web2py] Re: LEFT JOIN query as object?

2010-07-22 Thread mwolfe02
Thanks.  I'll make that work.

On Jul 22, 6:08 pm, Thadeus Burgess  wrote:
> It is kinda possible. Save both queries as objects. Left is just a query
> that tells web2py which fields in the tables should be linked together.
>
> For example,
>
> lefton = (db.friend.dog_id == db.dog.id)
> where = db(db.friend.name == "fred")
> ... continue and do some stuff with the "where" query object
> results = where.select(db.friend.ALL, left = lefton)
>
> --
> Thadeus
>
> On Thu, Jul 22, 2010 at 4:10 PM, mwolfe02 
> wrote:
>
>
>
> > It turns out the error I got it was for a different syntactical
> > mistake I'd made.  The relevant error is slightly different:
>
> > TypeError: 'Rows' object is not callable
>
> > I assume this is because the .select() method returns a 'Rows' object?
>
> > On Jul 22, 4:09 pm, Michael Wolfe 
> > wrote:
> > > I'm still learning web2py, so bear with me.  I am trying to write a
> > > somewhat complex query and would like to build it as a series of
> > > smaller, easier to understand queries.  web2py seems to support this
> > > beautifully for INNER JOINs and WHERE clauses as explained here:
> >http://www.thadeusb.com/weblog/2010/3/19/increase_productivity_by_usi...
>
> > > However, it appears that LEFT JOINs are not supported in the same way,
> > > because they are only available from within the .select() method.  I
> > > tried doing this and received the following error:
>
> > > TypeError: 'SQLJoin' object is not callable
>
> > > Is there any sort of workaround or am I stuck creating my left joins
> > > when I call .select()?
>
> > > Thanks,
> > > Mike


Re: [web2py] chunks

2010-07-22 Thread Jonathan Lundell
On Jul 22, 2010, at 9:32 PM, Phyo Arkar wrote:

> You mean ajax?
> You can do this using Ajax.
> In Jquery:
> $(#div_id).load(Path_To_Your_Page)

No, I meant just serving a regular (dynamic) page. I'm not using Ajax.

> 
> On 7/23/10, Jonathan Lundell  wrote:
>> It'd be nice to be able to return a dynamic page in (controlled) chunks. I
>> have no idea how the interface to something like that might work




Re: [web2py] chunks

2010-07-22 Thread Phyo Arkar
You mean ajax?
You can do this using Ajax.
In Jquery:
$(#div_id).load(Path_To_Your_Page)

On 7/23/10, Jonathan Lundell  wrote:
> It'd be nice to be able to return a dynamic page in (controlled) chunks. I
> have no idea how the interface to something like that might work


[web2py] Serving Static files with Space under /static/?

2010-07-22 Thread Phyo Arkar
Hello Web2py!

Here i am having this problem. As web2py do not allow Space in paths ,
trying this having problem "Invalid Request".

i am trying to serve files which are extracted from archives under
web2py /static/ folder. They may or May not include space in extracted
file name or Directory names.

Any way to Serve Static files over web2py , which name have space?


Re: [web2py] Re: XML sanitizer question

2010-07-22 Thread Jonathan Lundell
On Jul 22, 2010, at 7:41 PM, mr.freeze wrote:

> Negative, it sanitizes those too:
 XML('test',sanitize=True,permitted_tags = 
 ['a']).xml()
> 'test'

Only absolute URLs are acceptable. Try http://web2py.com.

> 
> On Jul 22, 9:38 pm, Jonathan Lundell  wrote:
>> On Jul 22, 2010, at 7:04 PM, mr.freeze wrote:
>> 
>> XML('test',sanitize=True,permitted_tags = ['b']).xml()
>>> 'test'
>> XML('test',sanitize=True,permitted_tags = ['a']).xml()
>>> 'test'
>> 
>>> Why does the 'a' element get sanitized?
>> 
>> At first glance, it looks like it might require an attribute from 
>> allowed_attributes. Does it work if you give it an href or a title?
>> 
>> Turning off allowed_attributes won't fix it, I think, because of this:
>> 
>> if bt == '> return
>> 
>> Seems unfortunate to have those tags hard-coded.




Re: [web2py] Re: rocket performance issues

2010-07-22 Thread Phyo Arkar
Thats very good news. I will be trying out soon!

On 7/22/10, Timbo  wrote:
> OK, so it's a thread-starvation issue.  Let this be the interim fix
> for web2py.  I've got several busy days ahead of me so I'll put out a
> real fix for Rocket in the coming days.
>
> -tim
>
> On Jul 22, 11:39 am, Michael Ellis  wrote:
>> Much improved with suggested change.  Latencies for .js/.css files reduced
>> to 100-150 msec.  Thanks Tim!
>>
>> Cheers,
>> Mike
>>
>>
>>
>> On Thu, Jul 22, 2010 at 12:27 PM, Timbo  wrote:
>> > Try one quick change for me please...rocket is constructed around line
>> > 655 in main.py
>>
>> > Add a parameter to the constructor call(s):  max_threads=0
>>
>> > Please let me know if that affects the problem.
>>
>> > -tim
>>
>> > On Jul 22, 10:34 am, mdipierro  wrote:
>> > > I can reproduce the problem. I did on localhost with two different
>> > > browsers.
>> > > Using firebug I can see it takes 25seconds to download base.css (the
>> > > problem is not always with the same file).
>> > > While I did the test, I also monitored httpserver.log and I find that
>> > > it NEVER takes more than 1.2ms serve base.css.
>> > > This is what the log shows:
>>
>> > > 
>> > > 127.0.0.1, 2010-07-22 10:16:38, GET, /michealellistest/static/images/
>> > > header.png, HTTP/1.1, 304, 0.000563
>> > > 127.0.0.1, 2010-07-22 10:16:38, GET, /favicon.ico, HTTP/1.1, 400,
>> > > 0.000631
>> > > 127.0.0.1, 2010-07-22 10:16:55, GET, /michealellistest/static/
>> > > base.css, HTTP/1.1, 304, 0.000791    locks firefox for 25secs
>> > > 
>> > > 127.0.0.1, 2010-07-22 10:22:42, GET, /michealellistest/static/
>> > > jquery.timers-1.2.js, HTTP/1.1, 304, 0.000552
>> > > 127.0.0.1, 2010-07-22 10:22:42, GET, /favicon.ico, HTTP/1.1, 400,
>> > > 0.000497
>> > > 127.0.0.1, 2010-07-22 10:23:02, GET, /michealellistest/static/
>> > > superfish.js, HTTP/1.1, 304, 0.000914    locks chrome for 25secs
>>
>> > > Do you see the time gaps?
>>
>> > > There is a clear pattern. Under heavy load a request that results in a
>> > > HTTP 400 error locks Rocket.
>>
>> > > Notice that the logging is done by a wsgi application that calls
>> > > web2py wsgibase, i.e it time how long it takes web2py to receive the
>> > > request and send the response. The extra time must be spent inside the
>> > > web server.
>>
>> > > It is also important that the times showed in the logs are the actual
>> > > time when the data is being written in the logs. You can see firefox
>> > > waiting for base.css, the server waiting to log base.css and nothing
>> > > else is being printed during the wait, signifying that web2py is not
>> > > running any request.
>>
>> > > We need Tim! This is a problem.
>>
>> > > Massimo
>>
>> > > On Jul 22, 9:22 am, Michael Ellis  wrote:
>>
>> > > > I've isolated the problem but absolutely do not understand it.  I
>> > > > can
>> > > > reproduce it with a two-line change to web2py_ajax.html.   Will
>> > > > someone
>> > with
>> > > > the time and equipment please attempt to replicate  this as a sanity
>> > check?
>>
>> > > > Here's how:
>>
>> > > > In the welcome app's web2py_ajax.html, insert the following after
>> > > > line
>> > 3.
>>
>> > response.files.insert(3,URL(r=request,c='static',f='jquery.sparkline.js'))
>>
>> > response.files.insert(4,URL(r=request,c='static',f='jquery.timers-1.2.js'))
>>
>> > > > Copy the attached js files into welcome/static.  They should be the
>> > same as
>> > > > the versions available online.
>>
>> > > > To reproduce the problem, serve web2py on your LAN.  Open the
>> > > > welcome
>> > home
>> > > > page on two different machines.  One of them can be on the server.
>> >  Briskly
>> > > > reload the page 10 or more times on either machine then try to
>> > > > reload
>> > on the
>> > > > other.  In my setup, the delay is reliably 25 seconds from the time
>> > > > I
>> > make
>> > > > the last click on the first machine.
>>
>> > > > I'm able to reproduce this in FF, Chrome, and Safari using the
>> > > > latest
>> > web2py
>> > > > from trunk.  Haven't tried any other browsers yet.  As noted
>> > > > previously
>> > both
>> > > > machines are MacBooks running Snow Leopard.
>>
>> > > > Mike
>>
>> > > >  jquery.timers-1.2.js
>> > > > 4KViewDownload
>>
>> > > >  jquery.sparkline.js
>> > > > 62KViewDownload


[web2py] chunks

2010-07-22 Thread Jonathan Lundell
It'd be nice to be able to return a dynamic page in (controlled) chunks. I have 
no idea how the interface to something like that might work

[web2py] Re: XML sanitizer question

2010-07-22 Thread mr.freeze
Negative, it sanitizes those too:
>>> XML('test',sanitize=True,permitted_tags = 
>>> ['a']).xml()
'test'

On Jul 22, 9:38 pm, Jonathan Lundell  wrote:
> On Jul 22, 2010, at 7:04 PM, mr.freeze wrote:
>
>  XML('test',sanitize=True,permitted_tags = ['b']).xml()
> > 'test'
>  XML('test',sanitize=True,permitted_tags = ['a']).xml()
> > 'test'
>
> > Why does the 'a' element get sanitized?
>
> At first glance, it looks like it might require an attribute from 
> allowed_attributes. Does it work if you give it an href or a title?
>
> Turning off allowed_attributes won't fix it, I think, because of this:
>
>             if bt == '                 return
>
> Seems unfortunate to have those tags hard-coded.


Re: [web2py] XML sanitizer question

2010-07-22 Thread Jonathan Lundell
On Jul 22, 2010, at 7:04 PM, mr.freeze wrote:

 XML('test',sanitize=True,permitted_tags = ['b']).xml()
> 'test'
 XML('test',sanitize=True,permitted_tags = ['a']).xml()
> 'test'
> 
> Why does the 'a' element get sanitized?

At first glance, it looks like it might require an attribute from 
allowed_attributes. Does it work if you give it an href or a title?

Turning off allowed_attributes won't fix it, I think, because of this:

if bt == '

[web2py] XML sanitizer question

2010-07-22 Thread mr.freeze
>>> XML('test',sanitize=True,permitted_tags = ['b']).xml()
'test'
>>> XML('test',sanitize=True,permitted_tags = ['a']).xml()
'test'

Why does the 'a' element get sanitized?


[web2py] Re: exercise of the day

2010-07-22 Thread mr.freeze
Assuming you meant:
r.y.y.y.t
It works because db.a.y is a self referencing field. Inserting into
db.a doesn't return an int, but a Reference, which has a __getattr__
that returns the record it references. Any number of y's should work:
r.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.t
't' is the virtual field which returns the length of the computed
field, which in turn is 3*x. 'x' in this case is 'hello', so t is 15.
You could also do:
r.y.y.y.y.z
to get the computed field which should return:
hellohellohello


On Jul 22, 6:50 pm, "mr.freeze"  wrote:
> It shouldn't. It should throw an error at the print statement because
> 'a' is not defined.
>
> On Jul 22, 6:33 pm, mdipierro  wrote:
>
> > The following code uses:
> > 1) a computed field
> > 2) a self reference
> > 3) a virtual field
>
> > >>> db.define_table('a',Field('x'),Field('y','reference 
> > >>> a'),Field('z',compute=lambda row: row['x']*3))
> > >>> class A:
> > >>>      def t(self): return len(self.a.z)
> > >>> db.a.virtualfields.append(A())
> > >>> r=db.a.insert(x='hello')
> > >>> r.update_record(x=r.x,y=r)
> > >>> print a.y.y.y.y.t
>
> > 15
>
> > Can you explain how it works?


[web2py] Re: exercise of the day

2010-07-22 Thread mr.freeze
It shouldn't. It should throw an error at the print statement because
'a' is not defined.

On Jul 22, 6:33 pm, mdipierro  wrote:
> The following code uses:
> 1) a computed field
> 2) a self reference
> 3) a virtual field
>
> >>> db.define_table('a',Field('x'),Field('y','reference 
> >>> a'),Field('z',compute=lambda row: row['x']*3))
> >>> class A:
> >>>      def t(self): return len(self.a.z)
> >>> db.a.virtualfields.append(A())
> >>> r=db.a.insert(x='hello')
> >>> r.update_record(x=r.x,y=r)
> >>> print a.y.y.y.y.t
>
> 15
>
> Can you explain how it works?


Re: [web2py] MENU() redefine defaults for _class, ul_class, li_class

2010-07-22 Thread Andrew Thompson

 On 7/22/2010 7:37 PM, Andrew Thompson wrote:
 Is it possible to redefine the defaults for  _class, ul_class, and 
li_class on a per app basis?




Nevermind, I'm an idiot.

--
Andrew Thompson
http://aktzero.com/



[web2py] MENU() redefine defaults for _class, ul_class, li_class

2010-07-22 Thread Andrew Thompson
 Is it possible to redefine the defaults for  _class, ul_class, and 
li_class on a per app basis?


--
Andrew Thompson
http://aktzero.com/



[web2py] How to submit a custom form

2010-07-22 Thread elfuego1
Hi,

I had made my custom form, but adding {{=form.custom.submit}} doesn't
let me send the form.
How should I add submit button to the page, so I would get a default
fields validation and form submit functionallity?

Best regards.


[web2py] Re: Why am I getting logged out automatically? [Closed but smells fishy]

2010-07-22 Thread mdipierro
How is the app called?

On Jul 22, 6:30 pm, weheh  wrote:
> After further muddling about, I'm now wondering if this might be a
> cookie corruption issue, if such a thing is possible. Subsequent to
> this problem report, the UI tab cookie stopped working properly. I
> ultimately gave up trying to find a problem in my code and wiped the
> cookie clean. Now, everything seems to work OK. I'm using
> jQuery("#mytabs").tabs({ cookie: { expires:1} })  and yet I'm not
> getting logged out any more. Go figure. Case closed for now.


[web2py] exercise of the day

2010-07-22 Thread mdipierro
The following code uses:
1) a computed field
2) a self reference
3) a virtual field

>>> db.define_table('a',Field('x'),Field('y','reference 
>>> a'),Field('z',compute=lambda row: row['x']*3))
>>> class A:
>>>  def t(self): return len(self.a.z)
>>> db.a.virtualfields.append(A())
>>> r=db.a.insert(x='hello')
>>> r.update_record(x=r.x,y=r)
>>> print a.y.y.y.y.t
15

Can you explain how it works?


[web2py] Re: Why am I getting logged out automatically? [Closed but smells fishy]

2010-07-22 Thread weheh
After further muddling about, I'm now wondering if this might be a
cookie corruption issue, if such a thing is possible. Subsequent to
this problem report, the UI tab cookie stopped working properly. I
ultimately gave up trying to find a problem in my code and wiped the
cookie clean. Now, everything seems to work OK. I'm using
jQuery("#mytabs").tabs({ cookie: { expires:1} })  and yet I'm not
getting logged out any more. Go figure. Case closed for now.


[web2py] 1.81.5 is OUT

2010-07-22 Thread mdipierro
it contains mostly bug fixes. Most of the fixes are obscure except to
important ones:
1) Scott fixed memcache that broke a few versions ago
2) Mike and Tim found and fixed a process starvation issue with the
built-in web server. This caused occasionally slow response time on
high traffic. The fix is temporary but seems to be effective.

Please check it and report any problems.

Massimo


[web2py] Re: How to pass field list to select() clause?

2010-07-22 Thread mr.freeze
Yes, you just need to unpack the list:
db(query).select(*fields)

On Jul 22, 5:44 pm, weheh  wrote:
> Is there a way to make a list of db fields:
>
> fields=[db.table1.id, db.table2.name, etc.]
>
> and then use that list in a query, e.g.
>
> db(query).select(fields)
>
> ?
>
> I've tried various things but they don't work. I suppose I'd have to
> inspect the code to figure it out.


[web2py] Re: WOW!!

2010-07-22 Thread mdipierro
Thanks

you can do this. register a domain like mydomain.com and access it as

http://mycommunty.mydomain.com

in the model file you can do:

   community = request.env.host_name.split('.')[0]
   db=DAL('sqlite://storage.%s.sqlite' % community)

and that should be all you need.




On Jul 22, 1:58 pm, "david.waldrop"  wrote:
> All, I just discovered this amazing framework and am immediately
> switching to it (from adobe) for a current project I am working on.
> It is quite different from the way I have built solutions in the
> past.  Here is the basic structure of how I need to approach the
> problem:
>
> 1) I want a user to log in and create a community based topic.
>
> 2) This community topic should have a separate URL and database.  I
> desire this for scaleability and privacy.  I asume the url will be
> either the community topic name (or a GUID of some type, and am OK
> with this)  suffixed to my domain.
>
> 3) The organizer can freely share the url with others in their
> neighborhood.
>
> 4) All users will be required to register and login in.
>
> 5) Users can participate in multiple community topics.  I think this
> means there is a central database storing community topics and
> participating users, thereby allowing the user to see a list of
> community topics in which they are participating when they log in.
> When they select a community topic (ideally represented by a URL to
> aid in easily sharing) the app must somehow switch the underlying
> database.
>
> I am getting the hang of implementing the functionality within a
> community, but have no real idea how to fulfill the above
> requirements.  Any thoughts or suggestions would be greatly
> appreciated.  Again, WOW, I cannot believe I have been unaware of
> web2py!


[web2py] WOW!!

2010-07-22 Thread david.waldrop
All, I just discovered this amazing framework and am immediately
switching to it (from adobe) for a current project I am working on.
It is quite different from the way I have built solutions in the
past.  Here is the basic structure of how I need to approach the
problem:

1) I want a user to log in and create a community based topic.

2) This community topic should have a separate URL and database.  I
desire this for scaleability and privacy.  I asume the url will be
either the community topic name (or a GUID of some type, and am OK
with this)  suffixed to my domain.

3) The organizer can freely share the url with others in their
neighborhood.

4) All users will be required to register and login in.

5) Users can participate in multiple community topics.  I think this
means there is a central database storing community topics and
participating users, thereby allowing the user to see a list of
community topics in which they are participating when they log in.
When they select a community topic (ideally represented by a URL to
aid in easily sharing) the app must somehow switch the underlying
database.

I am getting the hang of implementing the functionality within a
community, but have no real idea how to fulfill the above
requirements.  Any thoughts or suggestions would be greatly
appreciated.  Again, WOW, I cannot believe I have been unaware of
web2py!



[web2py] How to pass field list to select() clause?

2010-07-22 Thread weheh
Is there a way to make a list of db fields:

fields=[db.table1.id, db.table2.name, etc.]

and then use that list in a query, e.g.

db(query).select(fields)

?

I've tried various things but they don't work. I suppose I'd have to
inspect the code to figure it out.


[web2py] Re: cPickle large object causes web2py to crash

2010-07-22 Thread mdipierro
How big is the pickled file?

On Jul 22, 5:08 pm, "topher.baron"  wrote:
> web2py community,
>
> I'm currently implementing a web application on localhost running OS
> 10.6.4.  When I cPickle.dump a large object to the /tmp directory,
> web2py crashes.  The same operations work with smaller objects.
>
> Does this mean I need to increase the heap?  If so, how do I do this?
> If not, any suggestions?
>
> Thanks in advance.


[web2py] Re: Problem with TH html helpers

2010-07-22 Thread mdipierro
good catch. Thanks for letting us know.

On Jul 22, 4:16 pm, marcelielapointe 
wrote:
> I finally find the problem!!
>
> I am doing some import in a models, in particular:
>
> from pylab import *
>
> if I comment this line everything works fine
>
> So It's look like it's not a good idea to import module in model or
> only not doing: from module import *
>
> ...
>
> On Jul 22, 5:03 pm, marcelielapointe 
> wrote:
>
> > If I try something like:
>
> > print type(TH)
>
> > it prints:
>
> > 
>
> > where it could have been defined???
>
> > On Jul 22, 4:53 pm, marcelielapointe 
> > wrote:
>
> > > I think I find something..
>
> > > in dateutil/rrule.py "MO", "TU", "WE", "TH", "FR", "SA", "SU" are
> > > define. If I replace TH with either of them, the same ticket is
> > > issued. If I replace TH with another random string like TW or
> > > something else I got:
>
> > > NameError: global name 'Tdsd' is not defined
>
> > > so it seems that rrule overwrite the definition of TH of web2py, I
> > > don't know how this works and why this happen only in a particular
> > > app..
>
> > > If someone has a hint..?
>
> > > thanks
>
> > > On Jul 22, 2:22 pm, marcelielapointe 
> > > wrote:
>
> > > > no, I don't use id, I use a string.
>
> > > > I create a new application and everything works fine. So the problem
> > > > comes from my app, but where does it comes from? I create a test
> > > > controller:
>
> > > > # coding: utf8
> > > > # try something like
> > > > def index():
> > > >     table = TABLE(TR(TH('1'),TH('2')),TR(TD('un'),TD('deux')))
> > > >     return dict(table=table)
>
> > > > with his view:
>
> > > >  > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > > http://www.w3.org/1999/xhtml";
> > > > xml:lang="{{=T.accepted_language or 'fr'}}">
> > > >   
> > > >     
> > > >   
> > > >   
>
> > > > {{=table}}
>
> > > >   
> > > > 
>
> > > > and there is the ticket a a little bit different:
>
> > > > Traceback (most recent call last):
> > > >   File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
> > > > restricted
> > > >     exec ccode in environment
> > > >   File "/home/lapomarc/web2py/applications/meteocode2/views/testTable/
> > > > index.html", line 4, in 
> > > >     
> > > >   File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
> > > >     self.body.write(xmlescape(data))
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > > >     data = str(data)
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> > > >     return self.xml()
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> > > >     (fa, co) = self._xml()
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> > > >     self.components])
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > > >     data = str(data)
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> > > >     return self.xml()
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> > > >     (fa, co) = self._xml()
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> > > >     self.components])
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > > >     data = str(data)
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> > > >     return self.xml()
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> > > >     (fa, co) = self._xml()
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> > > >     self.components])
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > > >     data = str(data)
> > > >   File "/usr/lib/pymodules/python2.6/dateutil/rrule.py", line 78, in
> > > > __repr__
> > > >     return "%s(%+d)" % (s, self.n)
> > > > TypeError: %d format: a number is required, not str
>
> > > > Could the problem comes from my models or modules, I repeat, I tried
> > > > this controller/view in a fresh new app and it worked fine. The same
> > > > controller/view in my app send this ticket...
>
> > > > ???
>
> > > > On Jul 22, 11:40 am, mdipierro  wrote:
>
> > > > > I cannot reproduce the problem with this:
>
> > > > > TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
>
> > > > > It is possible that instead of a constant number you have the problem
> > > > > when you pass a record id? Mind that a record id is not an int, it
> > > > > only looks like an int. You have to do TH(str(id))
>
> > > > > On Jul 22, 9:58 am, marcelielapointe 
> > > > > wrote:
>
> > > > > > Hi,
>
> > > > > > I'm having problem producing a table with HTML helpers.. here is the
> > > > > > code:
>
> > > > > >  table = TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
> > > > > >  return dict(table=table)
>
> > > > > > The problem is with TH('1'), if I put a number in TH there is no
> > > > > > problem but I want to put a string. Here is the ticket:
>
> > > > > > Traceback (most re

Re: [web2py] Re: LEFT JOIN query as object?

2010-07-22 Thread Thadeus Burgess
It is kinda possible. Save both queries as objects. Left is just a query
that tells web2py which fields in the tables should be linked together.

For example,

lefton = (db.friend.dog_id == db.dog.id)
where = db(db.friend.name == "fred")
... continue and do some stuff with the "where" query object
results = where.select(db.friend.ALL, left = lefton)

--
Thadeus




On Thu, Jul 22, 2010 at 4:10 PM, mwolfe02 wrote:

> It turns out the error I got it was for a different syntactical
> mistake I'd made.  The relevant error is slightly different:
>
> TypeError: 'Rows' object is not callable
>
> I assume this is because the .select() method returns a 'Rows' object?
>
> On Jul 22, 4:09 pm, Michael Wolfe 
> wrote:
> > I'm still learning web2py, so bear with me.  I am trying to write a
> > somewhat complex query and would like to build it as a series of
> > smaller, easier to understand queries.  web2py seems to support this
> > beautifully for INNER JOINs and WHERE clauses as explained here:
> http://www.thadeusb.com/weblog/2010/3/19/increase_productivity_by_usi...
> >
> > However, it appears that LEFT JOINs are not supported in the same way,
> > because they are only available from within the .select() method.  I
> > tried doing this and received the following error:
> >
> > TypeError: 'SQLJoin' object is not callable
> >
> > Is there any sort of workaround or am I stuck creating my left joins
> > when I call .select()?
> >
> > Thanks,
> > Mike
>


[web2py] cPickle large object causes web2py to crash

2010-07-22 Thread topher.baron
web2py community,

I'm currently implementing a web application on localhost running OS
10.6.4.  When I cPickle.dump a large object to the /tmp directory,
web2py crashes.  The same operations work with smaller objects.

Does this mean I need to increase the heap?  If so, how do I do this?
If not, any suggestions?

Thanks in advance.


[web2py] Re: Problem with TH html helpers

2010-07-22 Thread marcelielapointe
I finally find the problem!!

I am doing some import in a models, in particular:

from pylab import *

if I comment this line everything works fine

So It's look like it's not a good idea to import module in model or
only not doing: from module import *

...

On Jul 22, 5:03 pm, marcelielapointe 
wrote:
> If I try something like:
>
> print type(TH)
>
> it prints:
>
> 
>
> where it could have been defined???
>
> On Jul 22, 4:53 pm, marcelielapointe 
> wrote:
>
>
>
> > I think I find something..
>
> > in dateutil/rrule.py "MO", "TU", "WE", "TH", "FR", "SA", "SU" are
> > define. If I replace TH with either of them, the same ticket is
> > issued. If I replace TH with another random string like TW or
> > something else I got:
>
> > NameError: global name 'Tdsd' is not defined
>
> > so it seems that rrule overwrite the definition of TH of web2py, I
> > don't know how this works and why this happen only in a particular
> > app..
>
> > If someone has a hint..?
>
> > thanks
>
> > On Jul 22, 2:22 pm, marcelielapointe 
> > wrote:
>
> > > no, I don't use id, I use a string.
>
> > > I create a new application and everything works fine. So the problem
> > > comes from my app, but where does it comes from? I create a test
> > > controller:
>
> > > # coding: utf8
> > > # try something like
> > > def index():
> > >     table = TABLE(TR(TH('1'),TH('2')),TR(TD('un'),TD('deux')))
> > >     return dict(table=table)
>
> > > with his view:
>
> > >  > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > http://www.w3.org/1999/xhtml";
> > > xml:lang="{{=T.accepted_language or 'fr'}}">
> > >   
> > >     
> > >   
> > >   
>
> > > {{=table}}
>
> > >   
> > > 
>
> > > and there is the ticket a a little bit different:
>
> > > Traceback (most recent call last):
> > >   File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
> > > restricted
> > >     exec ccode in environment
> > >   File "/home/lapomarc/web2py/applications/meteocode2/views/testTable/
> > > index.html", line 4, in 
> > >     
> > >   File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
> > >     self.body.write(xmlescape(data))
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > >     data = str(data)
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> > >     return self.xml()
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> > >     (fa, co) = self._xml()
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> > >     self.components])
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > >     data = str(data)
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> > >     return self.xml()
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> > >     (fa, co) = self._xml()
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> > >     self.components])
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > >     data = str(data)
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> > >     return self.xml()
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> > >     (fa, co) = self._xml()
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> > >     self.components])
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > >     data = str(data)
> > >   File "/usr/lib/pymodules/python2.6/dateutil/rrule.py", line 78, in
> > > __repr__
> > >     return "%s(%+d)" % (s, self.n)
> > > TypeError: %d format: a number is required, not str
>
> > > Could the problem comes from my models or modules, I repeat, I tried
> > > this controller/view in a fresh new app and it worked fine. The same
> > > controller/view in my app send this ticket...
>
> > > ???
>
> > > On Jul 22, 11:40 am, mdipierro  wrote:
>
> > > > I cannot reproduce the problem with this:
>
> > > > TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
>
> > > > It is possible that instead of a constant number you have the problem
> > > > when you pass a record id? Mind that a record id is not an int, it
> > > > only looks like an int. You have to do TH(str(id))
>
> > > > On Jul 22, 9:58 am, marcelielapointe 
> > > > wrote:
>
> > > > > Hi,
>
> > > > > I'm having problem producing a table with HTML helpers.. here is the
> > > > > code:
>
> > > > >  table = TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
> > > > >  return dict(table=table)
>
> > > > > The problem is with TH('1'), if I put a number in TH there is no
> > > > > problem but I want to put a string. Here is the ticket:
>
> > > > > Traceback (most recent call last):
> > > > >   File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
> > > > > restricted
> > > > >     exec ccode in environment
> > > > >   File "/home/lapomarc/web2py/applications/meteocode/views/list_table/
> > > > > main.html", line 60, in 
> > > > >   File "/home/lapomarc/web2py/g

[web2py] Re: LEFT JOIN query as object?

2010-07-22 Thread mwolfe02
It turns out the error I got it was for a different syntactical
mistake I'd made.  The relevant error is slightly different:

TypeError: 'Rows' object is not callable

I assume this is because the .select() method returns a 'Rows' object?

On Jul 22, 4:09 pm, Michael Wolfe 
wrote:
> I'm still learning web2py, so bear with me.  I am trying to write a
> somewhat complex query and would like to build it as a series of
> smaller, easier to understand queries.  web2py seems to support this
> beautifully for INNER JOINs and WHERE clauses as explained 
> here:http://www.thadeusb.com/weblog/2010/3/19/increase_productivity_by_usi...
>
> However, it appears that LEFT JOINs are not supported in the same way,
> because they are only available from within the .select() method.  I
> tried doing this and received the following error:
>
> TypeError: 'SQLJoin' object is not callable
>
> Is there any sort of workaround or am I stuck creating my left joins
> when I call .select()?
>
> Thanks,
> Mike


[web2py] Re: Problem with TH html helpers

2010-07-22 Thread marcelielapointe
If I try something like:

print type(TH)

it prints:



where it could have been defined???


On Jul 22, 4:53 pm, marcelielapointe 
wrote:
> I think I find something..
>
> in dateutil/rrule.py "MO", "TU", "WE", "TH", "FR", "SA", "SU" are
> define. If I replace TH with either of them, the same ticket is
> issued. If I replace TH with another random string like TW or
> something else I got:
>
> NameError: global name 'Tdsd' is not defined
>
> so it seems that rrule overwrite the definition of TH of web2py, I
> don't know how this works and why this happen only in a particular
> app..
>
> If someone has a hint..?
>
> thanks
>
> On Jul 22, 2:22 pm, marcelielapointe 
> wrote:
>
>
>
> > no, I don't use id, I use a string.
>
> > I create a new application and everything works fine. So the problem
> > comes from my app, but where does it comes from? I create a test
> > controller:
>
> > # coding: utf8
> > # try something like
> > def index():
> >     table = TABLE(TR(TH('1'),TH('2')),TR(TD('un'),TD('deux')))
> >     return dict(table=table)
>
> > with his view:
>
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > http://www.w3.org/1999/xhtml";
> > xml:lang="{{=T.accepted_language or 'fr'}}">
> >   
> >     
> >   
> >   
>
> > {{=table}}
>
> >   
> > 
>
> > and there is the ticket a a little bit different:
>
> > Traceback (most recent call last):
> >   File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
> > restricted
> >     exec ccode in environment
> >   File "/home/lapomarc/web2py/applications/meteocode2/views/testTable/
> > index.html", line 4, in 
> >     
> >   File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
> >     self.body.write(xmlescape(data))
> >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> >     data = str(data)
> >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> >     return self.xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> >     (fa, co) = self._xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> >     self.components])
> >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> >     data = str(data)
> >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> >     return self.xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> >     (fa, co) = self._xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> >     self.components])
> >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> >     data = str(data)
> >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> >     return self.xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> >     (fa, co) = self._xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> >     self.components])
> >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> >     data = str(data)
> >   File "/usr/lib/pymodules/python2.6/dateutil/rrule.py", line 78, in
> > __repr__
> >     return "%s(%+d)" % (s, self.n)
> > TypeError: %d format: a number is required, not str
>
> > Could the problem comes from my models or modules, I repeat, I tried
> > this controller/view in a fresh new app and it worked fine. The same
> > controller/view in my app send this ticket...
>
> > ???
>
> > On Jul 22, 11:40 am, mdipierro  wrote:
>
> > > I cannot reproduce the problem with this:
>
> > > TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
>
> > > It is possible that instead of a constant number you have the problem
> > > when you pass a record id? Mind that a record id is not an int, it
> > > only looks like an int. You have to do TH(str(id))
>
> > > On Jul 22, 9:58 am, marcelielapointe 
> > > wrote:
>
> > > > Hi,
>
> > > > I'm having problem producing a table with HTML helpers.. here is the
> > > > code:
>
> > > >  table = TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
> > > >  return dict(table=table)
>
> > > > The problem is with TH('1'), if I put a number in TH there is no
> > > > problem but I want to put a string. Here is the ticket:
>
> > > > Traceback (most recent call last):
> > > >   File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
> > > > restricted
> > > >     exec ccode in environment
> > > >   File "/home/lapomarc/web2py/applications/meteocode/views/list_table/
> > > > main.html", line 60, in 
> > > >   File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
> > > >     self.body.write(xmlescape(data))
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > > >     data = str(data)
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> > > >     return self.xml()
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> > > >     (fa, co) = self._xml()
> > > >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> > > >     self.components])
> > > >   File "/home/lapomarc/w

[web2py] Re: Problem with TH html helpers

2010-07-22 Thread marcelielapointe
I think I find something..

in dateutil/rrule.py "MO", "TU", "WE", "TH", "FR", "SA", "SU" are
define. If I replace TH with either of them, the same ticket is
issued. If I replace TH with another random string like TW or
something else I got:

NameError: global name 'Tdsd' is not defined

so it seems that rrule overwrite the definition of TH of web2py, I
don't know how this works and why this happen only in a particular
app..

If someone has a hint..?

thanks

On Jul 22, 2:22 pm, marcelielapointe 
wrote:
> no, I don't use id, I use a string.
>
> I create a new application and everything works fine. So the problem
> comes from my app, but where does it comes from? I create a test
> controller:
>
> # coding: utf8
> # try something like
> def index():
>     table = TABLE(TR(TH('1'),TH('2')),TR(TD('un'),TD('deux')))
>     return dict(table=table)
>
> with his view:
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";
> xml:lang="{{=T.accepted_language or 'fr'}}">
>   
>     
>   
>   
>
> {{=table}}
>
>   
> 
>
> and there is the ticket a a little bit different:
>
> Traceback (most recent call last):
>   File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
> restricted
>     exec ccode in environment
>   File "/home/lapomarc/web2py/applications/meteocode2/views/testTable/
> index.html", line 4, in 
>     
>   File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
>     self.body.write(xmlescape(data))
>   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
>     data = str(data)
>   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
>     return self.xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
>     (fa, co) = self._xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
>     self.components])
>   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
>     data = str(data)
>   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
>     return self.xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
>     (fa, co) = self._xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
>     self.components])
>   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
>     data = str(data)
>   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
>     return self.xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
>     (fa, co) = self._xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
>     self.components])
>   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
>     data = str(data)
>   File "/usr/lib/pymodules/python2.6/dateutil/rrule.py", line 78, in
> __repr__
>     return "%s(%+d)" % (s, self.n)
> TypeError: %d format: a number is required, not str
>
> Could the problem comes from my models or modules, I repeat, I tried
> this controller/view in a fresh new app and it worked fine. The same
> controller/view in my app send this ticket...
>
> ???
>
> On Jul 22, 11:40 am, mdipierro  wrote:
>
>
>
> > I cannot reproduce the problem with this:
>
> > TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
>
> > It is possible that instead of a constant number you have the problem
> > when you pass a record id? Mind that a record id is not an int, it
> > only looks like an int. You have to do TH(str(id))
>
> > On Jul 22, 9:58 am, marcelielapointe 
> > wrote:
>
> > > Hi,
>
> > > I'm having problem producing a table with HTML helpers.. here is the
> > > code:
>
> > >  table = TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
> > >  return dict(table=table)
>
> > > The problem is with TH('1'), if I put a number in TH there is no
> > > problem but I want to put a string. Here is the ticket:
>
> > > Traceback (most recent call last):
> > >   File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
> > > restricted
> > >     exec ccode in environment
> > >   File "/home/lapomarc/web2py/applications/meteocode/views/list_table/
> > > main.html", line 60, in 
> > >   File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
> > >     self.body.write(xmlescape(data))
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > >     data = str(data)
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> > >     return self.xml()
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> > >     (fa, co) = self._xml()
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> > >     self.components])
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> > >     data = str(data)
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> > >     return self.xml()
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> > >     (fa, co) = self._xml()
> > >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> > >     self.compone

[web2py] LEFT JOIN query as object?

2010-07-22 Thread Michael Wolfe
I'm still learning web2py, so bear with me.  I am trying to write a
somewhat complex query and would like to build it as a series of
smaller, easier to understand queries.  web2py seems to support this
beautifully for INNER JOINs and WHERE clauses as explained here:
http://www.thadeusb.com/weblog/2010/3/19/increase_productivity_by_using_parameterized_queries_with_web2py

However, it appears that LEFT JOINs are not supported in the same way,
because they are only available from within the .select() method.  I
tried doing this and received the following error:

TypeError: 'SQLJoin' object is not callable

Is there any sort of workaround or am I stuck creating my left joins
when I call .select()?

Thanks,
Mike


[web2py] Re: CakePHP-like recursive queries?

2010-07-22 Thread scausten
I'm an idiot. I actually hadn't tried the transaction.product.name
syntax, and lo-and-behold, it works.

web2py is awesome.

On Jul 22, 8:31 pm, scausten  wrote:
> There's a really cool feature in the CakePHP web framework whereby you
> can query a database recursively and have a query return not only the
> records of a given query, but also any other records they refer to,
> and I was wondering if there's anything similar in web2py. (There is a
> 'recursive' flag in the CakePHP 'find' function 0=don't return
> referenced records, 1=return referenced records, 2=return referenced
> records AND the the records they reference, etc.!)
>
> For example, say you have two tables, products and transactions:
>
> db.define_table('products', Field('name'), Field('Description')))
> db.define_table('transactions', Field('product', db.products))
>
> So, a query on 'transactions' returns something like:
>
> transaction:   id:               1
>                     product:   12
>
> then to get the data for product.id==12, you have to do
> db.products[transaction.product] or similar to get the product data.
>
> However, is it possible to make the query return, not the id of the
> referenced record, but the actual DALStorage object representing the
> object itself?:
>
> transaction:   id:               1
>                     product:       name:         "Product 1"
>                                        description: "This is a test
> product"
>
> Then I envisage being able to directly reference, for example,
> transaction.product.name
>
> In practise, I want to display to product name for a given transaction
> in multiple places in a page, and the only options I can see are
> separately storing the product data, or calling
> db.products[transaction.product] wherever I need it: the first seems a
> bit clunky and the second requires a separate call to the db every
> time. I could select the product data and cache it, I'd prefer not to.
>
> I would love to know if what I've described, above, is possible.
>
> Any ideas?
>
> Si


[web2py] CakePHP-like recursive queries?

2010-07-22 Thread scausten
There's a really cool feature in the CakePHP web framework whereby you
can query a database recursively and have a query return not only the
records of a given query, but also any other records they refer to,
and I was wondering if there's anything similar in web2py. (There is a
'recursive' flag in the CakePHP 'find' function 0=don't return
referenced records, 1=return referenced records, 2=return referenced
records AND the the records they reference, etc.!)

For example, say you have two tables, products and transactions:

db.define_table('products', Field('name'), Field('Description')))
db.define_table('transactions', Field('product', db.products))

So, a query on 'transactions' returns something like:

transaction:   id:   1
product:   12

then to get the data for product.id==12, you have to do
db.products[transaction.product] or similar to get the product data.

However, is it possible to make the query return, not the id of the
referenced record, but the actual DALStorage object representing the
object itself?:

transaction:   id:   1
product:   name: "Product 1"
   description: "This is a test
product"

Then I envisage being able to directly reference, for example,
transaction.product.name

In practise, I want to display to product name for a given transaction
in multiple places in a page, and the only options I can see are
separately storing the product data, or calling
db.products[transaction.product] wherever I need it: the first seems a
bit clunky and the second requires a separate call to the db every
time. I could select the product data and cache it, I'd prefer not to.

I would love to know if what I've described, above, is possible.

Any ideas?

Si


[web2py] Re: Problem with TH html helpers

2010-07-22 Thread marcelielapointe
no, I don't use id, I use a string.

I create a new application and everything works fine. So the problem
comes from my app, but where does it comes from? I create a test
controller:

# coding: utf8
# try something like
def index():
table = TABLE(TR(TH('1'),TH('2')),TR(TD('un'),TD('deux')))
return dict(table=table)

with his view:


http://www.w3.org/1999/xhtml";
xml:lang="{{=T.accepted_language or 'fr'}}">
  

  
  

{{=table}}

  



and there is the ticket a a little bit different:


Traceback (most recent call last):
  File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
restricted
exec ccode in environment
  File "/home/lapomarc/web2py/applications/meteocode2/views/testTable/
index.html", line 4, in 

  File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
self.body.write(xmlescape(data))
  File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
data = str(data)
  File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
return self.xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
(fa, co) = self._xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
self.components])
  File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
data = str(data)
  File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
return self.xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
(fa, co) = self._xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
self.components])
  File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
data = str(data)
  File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
return self.xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
(fa, co) = self._xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
self.components])
  File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
data = str(data)
  File "/usr/lib/pymodules/python2.6/dateutil/rrule.py", line 78, in
__repr__
return "%s(%+d)" % (s, self.n)
TypeError: %d format: a number is required, not str

Could the problem comes from my models or modules, I repeat, I tried
this controller/view in a fresh new app and it worked fine. The same
controller/view in my app send this ticket...

???

On Jul 22, 11:40 am, mdipierro  wrote:
> I cannot reproduce the problem with this:
>
> TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
>
> It is possible that instead of a constant number you have the problem
> when you pass a record id? Mind that a record id is not an int, it
> only looks like an int. You have to do TH(str(id))
>
> On Jul 22, 9:58 am, marcelielapointe 
> wrote:
>
>
>
> > Hi,
>
> > I'm having problem producing a table with HTML helpers.. here is the
> > code:
>
> >  table = TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
> >  return dict(table=table)
>
> > The problem is with TH('1'), if I put a number in TH there is no
> > problem but I want to put a string. Here is the ticket:
>
> > Traceback (most recent call last):
> >   File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
> > restricted
> >     exec ccode in environment
> >   File "/home/lapomarc/web2py/applications/meteocode/views/list_table/
> > main.html", line 60, in 
> >   File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
> >     self.body.write(xmlescape(data))
> >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> >     data = str(data)
> >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> >     return self.xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> >     (fa, co) = self._xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> >     self.components])
> >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> >     data = str(data)
> >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> >     return self.xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> >     (fa, co) = self._xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> >     self.components])
> >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> >     data = str(data)
> >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> >     return self.xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> >     (fa, co) = self._xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> >     self.components])
> >   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
> >     data = str(data)
> >   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
> >     return self.xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
> >     (fa, co) = self._xml()
> >   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
> >     self.components])
> >   

[web2py] Re: SQLite Logging

2010-07-22 Thread Yarin
Working on one now...

On Jul 22, 8:20 am, Massimo Di Pierro  wrote:
> This is useful. I suggest making a web2py slice about this.
>
> Massimo
>
> On Jul 21, 2010, at 9:37 PM, Iceberg wrote:
>
>
>
> > Just a quick thought. Since web2py itself already handles SQLite db  
> > well under multi-thread situation, so a quick tweak to your  
> > sqlitehandler.py may be putting the web2py db instance, rather than  
> > a filename, to initialize your SQLiteHandler() class.
>
> > Best regards,
> >                            Iceberg, 2010-Jul-22, 10:28(AM), Thu
>
> > --- Original Message ---
> > From:    Yarin 
> > To:      web2py-users 
> > Cc:      johann.scheibelho...@easytouch-edv.com, mdipie...@cs.depaul.edu
> > , iceb...@21cn.com
> > Date:    Wed, 21 Jul 2010 19:15:55 -0700 (PDT)
> > Subject: SQLite Logging
> > ---
>
> >> I'd like to elicit some help in putting together a SQLite-based
> >> logging solution for web2py.
>
> >> Logging to a file was covered earlier in this forum (See "Global
> >> logging to file"):
> >>http://groups.google.com/group/web2py/browse_thread/thread/e20d0bd2e5...
> >> log.py:
> >>https://sites.google.com/site/ykessler/main/log.py
>
> >> I've written a SQLite logging handler:
> >>https://sites.google.com/site/ykessler/main/sqlitehandler.py
>
> >> However, although the SQLite handler works great in normal Python
> >> environments, it errors out with the global logging solution because
> >> the logger emits on multiple threads, and SQLite objects are
> >> restricted to the thread they're created on.
>
> >> Any ideas on how to sync these two solutions?


[web2py] Re: rocket performance issues

2010-07-22 Thread Timbo
OK, so it's a thread-starvation issue.  Let this be the interim fix
for web2py.  I've got several busy days ahead of me so I'll put out a
real fix for Rocket in the coming days.

-tim

On Jul 22, 11:39 am, Michael Ellis  wrote:
> Much improved with suggested change.  Latencies for .js/.css files reduced
> to 100-150 msec.  Thanks Tim!
>
> Cheers,
> Mike
>
>
>
> On Thu, Jul 22, 2010 at 12:27 PM, Timbo  wrote:
> > Try one quick change for me please...rocket is constructed around line
> > 655 in main.py
>
> > Add a parameter to the constructor call(s):  max_threads=0
>
> > Please let me know if that affects the problem.
>
> > -tim
>
> > On Jul 22, 10:34 am, mdipierro  wrote:
> > > I can reproduce the problem. I did on localhost with two different
> > > browsers.
> > > Using firebug I can see it takes 25seconds to download base.css (the
> > > problem is not always with the same file).
> > > While I did the test, I also monitored httpserver.log and I find that
> > > it NEVER takes more than 1.2ms serve base.css.
> > > This is what the log shows:
>
> > > 
> > > 127.0.0.1, 2010-07-22 10:16:38, GET, /michealellistest/static/images/
> > > header.png, HTTP/1.1, 304, 0.000563
> > > 127.0.0.1, 2010-07-22 10:16:38, GET, /favicon.ico, HTTP/1.1, 400,
> > > 0.000631
> > > 127.0.0.1, 2010-07-22 10:16:55, GET, /michealellistest/static/
> > > base.css, HTTP/1.1, 304, 0.000791    locks firefox for 25secs
> > > 
> > > 127.0.0.1, 2010-07-22 10:22:42, GET, /michealellistest/static/
> > > jquery.timers-1.2.js, HTTP/1.1, 304, 0.000552
> > > 127.0.0.1, 2010-07-22 10:22:42, GET, /favicon.ico, HTTP/1.1, 400,
> > > 0.000497
> > > 127.0.0.1, 2010-07-22 10:23:02, GET, /michealellistest/static/
> > > superfish.js, HTTP/1.1, 304, 0.000914    locks chrome for 25secs
>
> > > Do you see the time gaps?
>
> > > There is a clear pattern. Under heavy load a request that results in a
> > > HTTP 400 error locks Rocket.
>
> > > Notice that the logging is done by a wsgi application that calls
> > > web2py wsgibase, i.e it time how long it takes web2py to receive the
> > > request and send the response. The extra time must be spent inside the
> > > web server.
>
> > > It is also important that the times showed in the logs are the actual
> > > time when the data is being written in the logs. You can see firefox
> > > waiting for base.css, the server waiting to log base.css and nothing
> > > else is being printed during the wait, signifying that web2py is not
> > > running any request.
>
> > > We need Tim! This is a problem.
>
> > > Massimo
>
> > > On Jul 22, 9:22 am, Michael Ellis  wrote:
>
> > > > I've isolated the problem but absolutely do not understand it.  I can
> > > > reproduce it with a two-line change to web2py_ajax.html.   Will someone
> > with
> > > > the time and equipment please attempt to replicate  this as a sanity
> > check?
>
> > > > Here's how:
>
> > > > In the welcome app's web2py_ajax.html, insert the following after line
> > 3.
>
> > response.files.insert(3,URL(r=request,c='static',f='jquery.sparkline.js'))
>
> > response.files.insert(4,URL(r=request,c='static',f='jquery.timers-1.2.js'))
>
> > > > Copy the attached js files into welcome/static.  They should be the
> > same as
> > > > the versions available online.
>
> > > > To reproduce the problem, serve web2py on your LAN.  Open the welcome
> > home
> > > > page on two different machines.  One of them can be on the server.
> >  Briskly
> > > > reload the page 10 or more times on either machine then try to reload
> > on the
> > > > other.  In my setup, the delay is reliably 25 seconds from the time I
> > make
> > > > the last click on the first machine.
>
> > > > I'm able to reproduce this in FF, Chrome, and Safari using the latest
> > web2py
> > > > from trunk.  Haven't tried any other browsers yet.  As noted previously
> > both
> > > > machines are MacBooks running Snow Leopard.
>
> > > > Mike
>
> > > >  jquery.timers-1.2.js
> > > > 4KViewDownload
>
> > > >  jquery.sparkline.js
> > > > 62KViewDownload


[web2py] Re: Is pyforum.org discontinued?

2010-07-22 Thread ionel
Thank you.


On Jul 22, 12:10 pm, Bruno Rocha  wrote:
> a copy is attached, I Don't know if  it is discontinued, but I am
> working to port Pyforum to run on GAE.
>
> 2010/7/22 ionel :
>
> > Hello,
>
> > Is pyforum a discontinued project?
>
> > I need a copy of pyforum but thehttp://www.pyforum.orgis always
> > down.
>
> > Thanks
>
> > i.a.
>
> --
>
> http://rochacbruno.com.br
>
>  pyforum_1-0-3.tgz
> 246KViewDownload


Re: [web2py] Re: rocket performance issues

2010-07-22 Thread Michael Ellis
Much improved with suggested change.  Latencies for .js/.css files reduced
to 100-150 msec.  Thanks Tim!

Cheers,
Mike


On Thu, Jul 22, 2010 at 12:27 PM, Timbo  wrote:

> Try one quick change for me please...rocket is constructed around line
> 655 in main.py
>
> Add a parameter to the constructor call(s):  max_threads=0
>
> Please let me know if that affects the problem.
>
> -tim
>
> On Jul 22, 10:34 am, mdipierro  wrote:
> > I can reproduce the problem. I did on localhost with two different
> > browsers.
> > Using firebug I can see it takes 25seconds to download base.css (the
> > problem is not always with the same file).
> > While I did the test, I also monitored httpserver.log and I find that
> > it NEVER takes more than 1.2ms serve base.css.
> > This is what the log shows:
> >
> > 
> > 127.0.0.1, 2010-07-22 10:16:38, GET, /michealellistest/static/images/
> > header.png, HTTP/1.1, 304, 0.000563
> > 127.0.0.1, 2010-07-22 10:16:38, GET, /favicon.ico, HTTP/1.1, 400,
> > 0.000631
> > 127.0.0.1, 2010-07-22 10:16:55, GET, /michealellistest/static/
> > base.css, HTTP/1.1, 304, 0.000791    locks firefox for 25secs
> > 
> > 127.0.0.1, 2010-07-22 10:22:42, GET, /michealellistest/static/
> > jquery.timers-1.2.js, HTTP/1.1, 304, 0.000552
> > 127.0.0.1, 2010-07-22 10:22:42, GET, /favicon.ico, HTTP/1.1, 400,
> > 0.000497
> > 127.0.0.1, 2010-07-22 10:23:02, GET, /michealellistest/static/
> > superfish.js, HTTP/1.1, 304, 0.000914    locks chrome for 25secs
> >
> > Do you see the time gaps?
> >
> > There is a clear pattern. Under heavy load a request that results in a
> > HTTP 400 error locks Rocket.
> >
> > Notice that the logging is done by a wsgi application that calls
> > web2py wsgibase, i.e it time how long it takes web2py to receive the
> > request and send the response. The extra time must be spent inside the
> > web server.
> >
> > It is also important that the times showed in the logs are the actual
> > time when the data is being written in the logs. You can see firefox
> > waiting for base.css, the server waiting to log base.css and nothing
> > else is being printed during the wait, signifying that web2py is not
> > running any request.
> >
> > We need Tim! This is a problem.
> >
> > Massimo
> >
> > On Jul 22, 9:22 am, Michael Ellis  wrote:
> >
> >
> >
> > > I've isolated the problem but absolutely do not understand it.  I can
> > > reproduce it with a two-line change to web2py_ajax.html.   Will someone
> with
> > > the time and equipment please attempt to replicate  this as a sanity
> check?
> >
> > > Here's how:
> >
> > > In the welcome app's web2py_ajax.html, insert the following after line
> 3.
> > >
> response.files.insert(3,URL(r=request,c='static',f='jquery.sparkline.js'))
> > >
> response.files.insert(4,URL(r=request,c='static',f='jquery.timers-1.2.js'))
> >
> > > Copy the attached js files into welcome/static.  They should be the
> same as
> > > the versions available online.
> >
> > > To reproduce the problem, serve web2py on your LAN.  Open the welcome
> home
> > > page on two different machines.  One of them can be on the server.
>  Briskly
> > > reload the page 10 or more times on either machine then try to reload
> on the
> > > other.  In my setup, the delay is reliably 25 seconds from the time I
> make
> > > the last click on the first machine.
> >
> > > I'm able to reproduce this in FF, Chrome, and Safari using the latest
> web2py
> > > from trunk.  Haven't tried any other browsers yet.  As noted previously
> both
> > > machines are MacBooks running Snow Leopard.
> >
> > > Mike
> >
> > >  jquery.timers-1.2.js
> > > 4KViewDownload
> >
> > >  jquery.sparkline.js
> > > 62KViewDownload
>


[web2py] Re: rocket performance issues

2010-07-22 Thread Timbo
Try one quick change for me please...rocket is constructed around line
655 in main.py

Add a parameter to the constructor call(s):  max_threads=0

Please let me know if that affects the problem.

-tim

On Jul 22, 10:34 am, mdipierro  wrote:
> I can reproduce the problem. I did on localhost with two different
> browsers.
> Using firebug I can see it takes 25seconds to download base.css (the
> problem is not always with the same file).
> While I did the test, I also monitored httpserver.log and I find that
> it NEVER takes more than 1.2ms serve base.css.
> This is what the log shows:
>
> 
> 127.0.0.1, 2010-07-22 10:16:38, GET, /michealellistest/static/images/
> header.png, HTTP/1.1, 304, 0.000563
> 127.0.0.1, 2010-07-22 10:16:38, GET, /favicon.ico, HTTP/1.1, 400,
> 0.000631
> 127.0.0.1, 2010-07-22 10:16:55, GET, /michealellistest/static/
> base.css, HTTP/1.1, 304, 0.000791    locks firefox for 25secs
> 
> 127.0.0.1, 2010-07-22 10:22:42, GET, /michealellistest/static/
> jquery.timers-1.2.js, HTTP/1.1, 304, 0.000552
> 127.0.0.1, 2010-07-22 10:22:42, GET, /favicon.ico, HTTP/1.1, 400,
> 0.000497
> 127.0.0.1, 2010-07-22 10:23:02, GET, /michealellistest/static/
> superfish.js, HTTP/1.1, 304, 0.000914    locks chrome for 25secs
>
> Do you see the time gaps?
>
> There is a clear pattern. Under heavy load a request that results in a
> HTTP 400 error locks Rocket.
>
> Notice that the logging is done by a wsgi application that calls
> web2py wsgibase, i.e it time how long it takes web2py to receive the
> request and send the response. The extra time must be spent inside the
> web server.
>
> It is also important that the times showed in the logs are the actual
> time when the data is being written in the logs. You can see firefox
> waiting for base.css, the server waiting to log base.css and nothing
> else is being printed during the wait, signifying that web2py is not
> running any request.
>
> We need Tim! This is a problem.
>
> Massimo
>
> On Jul 22, 9:22 am, Michael Ellis  wrote:
>
>
>
> > I've isolated the problem but absolutely do not understand it.  I can
> > reproduce it with a two-line change to web2py_ajax.html.   Will someone with
> > the time and equipment please attempt to replicate  this as a sanity check?
>
> > Here's how:
>
> > In the welcome app's web2py_ajax.html, insert the following after line 3.
> > response.files.insert(3,URL(r=request,c='static',f='jquery.sparkline.js'))
> > response.files.insert(4,URL(r=request,c='static',f='jquery.timers-1.2.js'))
>
> > Copy the attached js files into welcome/static.  They should be the same as
> > the versions available online.
>
> > To reproduce the problem, serve web2py on your LAN.  Open the welcome home
> > page on two different machines.  One of them can be on the server.  Briskly
> > reload the page 10 or more times on either machine then try to reload on the
> > other.  In my setup, the delay is reliably 25 seconds from the time I make
> > the last click on the first machine.
>
> > I'm able to reproduce this in FF, Chrome, and Safari using the latest web2py
> > from trunk.  Haven't tried any other browsers yet.  As noted previously both
> > machines are MacBooks running Snow Leopard.
>
> > Mike
>
> >  jquery.timers-1.2.js
> > 4KViewDownload
>
> >  jquery.sparkline.js
> > 62KViewDownload


[web2py] Re: web2py performance issue or rather my fault?

2010-07-22 Thread mdipierro
One more thing... in your tests, you may want to save the
httpserver.log. If you still have problems, it will be useful to
compare cherokee logs vs httpserver logs.

Massimo

On Jul 21, 4:33 pm, Thadeus Burgess  wrote:
> I try.
>
> I have several copies of web2py core that I have modified in attempt to fix
> these issues, attempting to narrow down the cause, to no avail yet. I want
> to do two more tests. The first one, make flask use the web2py DAL so we can
> compare core to core. Make sure web2py has all of the fancy optimizations in
> place.
>
> The second thing I want to do is develop a very minimalistic WSGI
> application that is not based on any framework. I want to execute the
> controllers in two different ways, I want to test a import based controller,
> and then an execfile based controller. Very simple, no templates, no
> database. This small test will verify if it is an issue that can be fixed
> (such as too much overhead processing the request), or if it is an issue
> that cannot be fixed (ie: a design flaw in using execfile).
>
> Once the question of execfile vs import on performance is answered will
> depend on what should be tested next to figure out what is causing these
> issues.
>
> --
> Thadeus
>
> On Wed, Jul 21, 2010 at 9:59 AM, mdipierro  wrote:
> > Thank you Thadeus for your help with these tests.
>
> > I did not see a open_session(request) in your Flask code.
>
> > Where does Flask save sessions? filesystem or client? If they are
> > saved on the client that is closer to session.forget() in web2py since
> > filling the filesystem with one question file for every http request
> > when running ab may cause problems.
>
> > Massimo
>
> > On Jul 21, 9:44 am, Thadeus Burgess  wrote:
> > > I will make said changes, and add my Flask-DAL extension to the flask
> > app,
> > > so at least the database layer will be the exact same.
>
> > > Flask handles sessions too. I shouldn't disable web2py sessions while
> > > letting flask use sessions, that would be an unfair test too.
>
> > > The good news is, that even with migrate=True the DAL still outperforms
> > > sqlalchemy (yay). So using sqlalchemy would result in a slightly slower
> > > flask.
>
> > > --
> > > Thadeus
>
> > > On Wed, Jul 21, 2010 at 9:02 AM, mdipierro 
> > wrote:
> > > > I agree with your assessment. The problem you,  Iceberg, Rahul, and
> > > > MikeEllis are having with Rocket appears distinct from the problem
> > > > Thadeus is having uwsgi+cherokee.
>
> > > > In my previous email I tried to suggest changes in Thadeus code to
> > > > isolate the cause of his problem.
>
> > > > Going back to your problem. I am still suspicious that this is a cron
> > > > issue. Can you try change cron=True into cron=False in web2py.py?
>
> > > > Massimo
>
> > > > On Jul 21, 8:41 am, Kuba Kucharski  wrote:
> > > > > > You said: "I moved to apache/WSGI from Rocket. For me the problem
> > > > > > disappears." therefore your problem is not the same that some other
> > > > > > problems experienced with apache/WSGI.
>
> > > > > look at Iceberg, Rahul, MikeEllis in this thread
>
> > > > > >You also said you cache.ram all
> > > > > > requests. Can you try remove the caching? Any improvement?
>
> > > > > I think there are two or more problems. One is Thadeus having. The
> > > > > second was described by me. They can be the same but they seem not to
> > > > > be. As I investigated in this thread people talking about "my kind of
> > > > > the problem" report using rocket/cherrypy. Removing caching gives no
> > > > > improvement.


[web2py] Re: Problem with TH html helpers

2010-07-22 Thread mdipierro
I cannot reproduce the problem with this:

TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))

It is possible that instead of a constant number you have the problem
when you pass a record id? Mind that a record id is not an int, it
only looks like an int. You have to do TH(str(id))

On Jul 22, 9:58 am, marcelielapointe 
wrote:
> Hi,
>
> I'm having problem producing a table with HTML helpers.. here is the
> code:
>
>  table = TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
>  return dict(table=table)
>
> The problem is with TH('1'), if I put a number in TH there is no
> problem but I want to put a string. Here is the ticket:
>
> Traceback (most recent call last):
>   File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
> restricted
>     exec ccode in environment
>   File "/home/lapomarc/web2py/applications/meteocode/views/list_table/
> main.html", line 60, in 
>   File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
>     self.body.write(xmlescape(data))
>   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
>     data = str(data)
>   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
>     return self.xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
>     (fa, co) = self._xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
>     self.components])
>   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
>     data = str(data)
>   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
>     return self.xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
>     (fa, co) = self._xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
>     self.components])
>   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
>     data = str(data)
>   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
>     return self.xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
>     (fa, co) = self._xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
>     self.components])
>   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
>     data = str(data)
>   File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
>     return self.xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
>     (fa, co) = self._xml()
>   File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
>     self.components])
>   File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
>     data = str(data)
>   File "/usr/lib/pymodules/python2.6/dateutil/rrule.py", line 78, in
> __repr__
>     return "%s(%+d)" % (s, self.n)
> TypeError: %d format: a number is required, not str
>
> That error doesn't show if I replace '1' by a number. It is very
> strange that str(data) is making a call to rrule.py of dateutil. It is
> like if my data was a date???
>
> If I put only numbers in TH it replace TH(1) by +1
>
> Also this problem does not appear with TD.
>
> I'm lost!??
>
> Marc-Élie


[web2py] Problem with TH html helpers

2010-07-22 Thread marcelielapointe
Hi,

I'm having problem producing a table with HTML helpers.. here is the
code:

 table = TABLE(TR(TH('1'),TH(2)),TR(TD('un'),TD('deux')))
 return dict(table=table)

The problem is with TH('1'), if I put a number in TH there is no
problem but I want to put a string. Here is the ticket:

Traceback (most recent call last):
  File "/home/lapomarc/web2py/gluon/restricted.py", line 178, in
restricted
exec ccode in environment
  File "/home/lapomarc/web2py/applications/meteocode/views/list_table/
main.html", line 60, in 
  File "/home/lapomarc/web2py/gluon/globals.py", line 105, in write
self.body.write(xmlescape(data))
  File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
data = str(data)
  File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
return self.xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
(fa, co) = self._xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
self.components])
  File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
data = str(data)
  File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
return self.xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
(fa, co) = self._xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
self.components])
  File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
data = str(data)
  File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
return self.xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
(fa, co) = self._xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
self.components])
  File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
data = str(data)
  File "/home/lapomarc/web2py/gluon/html.py", line 574, in __str__
return self.xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 557, in xml
(fa, co) = self._xml()
  File "/home/lapomarc/web2py/gluon/html.py", line 548, in _xml
self.components])
  File "/home/lapomarc/web2py/gluon/html.py", line 114, in xmlescape
data = str(data)
  File "/usr/lib/pymodules/python2.6/dateutil/rrule.py", line 78, in
__repr__
return "%s(%+d)" % (s, self.n)
TypeError: %d format: a number is required, not str

That error doesn't show if I replace '1' by a number. It is very
strange that str(data) is making a call to rrule.py of dateutil. It is
like if my data was a date???

If I put only numbers in TH it replace TH(1) by +1

Also this problem does not appear with TD.

I'm lost!??

Marc-Élie


[web2py] Re: rocket performance issues

2010-07-22 Thread mdipierro
I can reproduce the problem. I did on localhost with two different
browsers.
Using firebug I can see it takes 25seconds to download base.css (the
problem is not always with the same file).
While I did the test, I also monitored httpserver.log and I find that
it NEVER takes more than 1.2ms serve base.css.
This is what the log shows:


127.0.0.1, 2010-07-22 10:16:38, GET, /michealellistest/static/images/
header.png, HTTP/1.1, 304, 0.000563
127.0.0.1, 2010-07-22 10:16:38, GET, /favicon.ico, HTTP/1.1, 400,
0.000631
127.0.0.1, 2010-07-22 10:16:55, GET, /michealellistest/static/
base.css, HTTP/1.1, 304, 0.000791    locks firefox for 25secs

127.0.0.1, 2010-07-22 10:22:42, GET, /michealellistest/static/
jquery.timers-1.2.js, HTTP/1.1, 304, 0.000552
127.0.0.1, 2010-07-22 10:22:42, GET, /favicon.ico, HTTP/1.1, 400,
0.000497
127.0.0.1, 2010-07-22 10:23:02, GET, /michealellistest/static/
superfish.js, HTTP/1.1, 304, 0.000914    locks chrome for 25secs

Do you see the time gaps?

There is a clear pattern. Under heavy load a request that results in a
HTTP 400 error locks Rocket.

Notice that the logging is done by a wsgi application that calls
web2py wsgibase, i.e it time how long it takes web2py to receive the
request and send the response. The extra time must be spent inside the
web server.

It is also important that the times showed in the logs are the actual
time when the data is being written in the logs. You can see firefox
waiting for base.css, the server waiting to log base.css and nothing
else is being printed during the wait, signifying that web2py is not
running any request.

We need Tim! This is a problem.

Massimo



On Jul 22, 9:22 am, Michael Ellis  wrote:
> I've isolated the problem but absolutely do not understand it.  I can
> reproduce it with a two-line change to web2py_ajax.html.   Will someone with
> the time and equipment please attempt to replicate  this as a sanity check?
>
> Here's how:
>
> In the welcome app's web2py_ajax.html, insert the following after line 3.
> response.files.insert(3,URL(r=request,c='static',f='jquery.sparkline.js'))
> response.files.insert(4,URL(r=request,c='static',f='jquery.timers-1.2.js'))
>
> Copy the attached js files into welcome/static.  They should be the same as
> the versions available online.
>
> To reproduce the problem, serve web2py on your LAN.  Open the welcome home
> page on two different machines.  One of them can be on the server.  Briskly
> reload the page 10 or more times on either machine then try to reload on the
> other.  In my setup, the delay is reliably 25 seconds from the time I make
> the last click on the first machine.
>
> I'm able to reproduce this in FF, Chrome, and Safari using the latest web2py
> from trunk.  Haven't tried any other browsers yet.  As noted previously both
> machines are MacBooks running Snow Leopard.
>
> Mike
>
>  jquery.timers-1.2.js
> 4KViewDownload
>
>  jquery.sparkline.js
> 62KViewDownload


[web2py] Last Week for WAE ( Web2py Application Exhibition )

2010-07-22 Thread NetAdmin
Web2py Application Exhibition

Do you have a Web2py app that you'd like to show the world?
If so, you may be interested in the Web2py Application Exhibition.

The WAE is a way to...
1. Demonstrate what can be done with Web2py.
2. Share and learn about useful web2py, python, Javascript, jQuery
etc. techniques.
3. Earn some money toward that new  you've been craving.

Projects will be judged in the following areas.

Ease of use
Usefulness
Visual Appeal

The Rules
1. Applications must be submitted no later than July 30, 2010

2. Source must be included with your submissions.

3. If the application is written by a team, Massimo can NOT be
part of the team.

4. After a 2 week review period, on August 15, 2010, the
winners will be announced on the web2py-users list.

5. The 1st place winner will receive $100 US Dollars,
2nd place will receive $50

6. You must enjoy using Web2py!

Massimo is not affiliated with this exhibition, ( maybe he'll help
judge if I can twist his arm ) so, if you have any questions or
comments, I can be contacted on this forum or via gmail



mr.netadmin


[web2py] Is pyforum.org discontinued?

2010-07-22 Thread ionel
Hello,

Is pyforum a discontinued project?

I need a copy of pyforum but the http://www.pyforum.org is always
down.

Thanks

i.a.


[web2py] Re: Executing applications from web2py

2010-07-22 Thread mdipierro
http://bazaar.launchpad.net/~qcdvis/qcdvis/trunk/files/head:/plugin_pbs/

On Jul 22, 8:51 am, Hector Oron  wrote:
> Hi,
>
> 2010/7/21 mdipierro :
>
> > Welcome Hector,
>
> Thanks
>
> > using os.system is fine if the the commands are short and independent.
> > I would recommend creating a database table of tasks to be executed
>
> > db.define_table('task_queue',Field('status'),Field('command'))
>
> > The web app would queue commands (status=queued) and a web2py shell
> > script would monitor the task queue, pop a command (status=running),
> > execute it, and change the status (=completed or =error).
>
> Looks like a nice idea. I'll give it a go.
> I also hit PyAMF (I am not much into Python - as you might notice)
> with might be also useful to transfer binaries from buildserver to
> programming station, what do you think?
>
> > Have a plugin PBS that does this and interfaces with the PBS qsub/
> > qstat/qdel but it may be more complex than you need.
>
> I was unable to find such plugin, do you mind a pointer?
>
> --
>  Héctor Orón
>
> "Our Sun unleashes tremendous flares expelling hot gas into the Solar
> System, which one day will disconnect us."


[web2py] questions on groups

2010-07-22 Thread Frank
I get a problem, after I created a fresh new app,I only add following into 
db.py,
if not auth.id_group("Human Resource"): 
group_id11=auth.add_group(role="Human Resource", description="can access the
admin action")
auth.add_permission(group_id11, 'access to manage')

when I run this app, it seem that it run ok for first time, but if run second
time, I got error as followings,

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 178, in restricted
exec ccode in environment
  File "C:/web2py/applications/test/models/db.py", line 78, in 
auth.add_permission(group_id11, 'access to manage')
NameError: name 'group_id11' is not defined

I do not understand, group_id11 should get the value in first run, why it lost
in second run.

please advise,thanks,

Frank




Re: [web2py] Re: rocket performance issues

2010-07-22 Thread Jonathan Lundell
On Jul 22, 2010, at 6:55 AM, MikeEllis wrote:

> Doesn't fix the symptom

Ah. Well, negative results are still results. 

> 
> On Jul 21, 8:54 pm, Jonathan Lundell  wrote:
>> On Jul 21, 2010, at 2:03 PM, mdipierro wrote:
>> 
>>> The fact that you are having the problem with static files is giving
>>> me an idea for a test.
>>> Can you please try the web2py I just posted in trunk?
>> 
>> That seems like a nice optimization, but (assuming it fixes the symptom) 
>> does it explain the 20-25-second stalls?
>> 
>> 
>> 
>> 
>> 
>>> Massimo
>> 
>>> On Jul 21, 2:08 pm, MikeEllis  wrote:
 One more detail.  As you would hope, it's generally not the case that
 both browsers stall at the same time.  While stalled on either laptop
 I can keep reloading on the other.
>> 
 On Jul 21, 3:03 pm, MikeEllis  wrote:
>> 
> I tried changing to cron=False in web2py.py.  No impact on problem.
> Same two-laptop setup as described previous.  Happens even on  pages
> that contain very little.  Chrome DevTools shows same problem as
> before:  One or more the .js/.css/.png files are delayed by 20 to 25
> seconds latency.
>> 
> The problem is also unaffected by whether I run web2py under winpdb or
> directly from the command line.   If I interrupt during the latency
> while running under winpdb,  I typically see
>> 
> * MainThread in rocket.py start() on line 301
> * Thread1 in threading.py wait() called by Queue.py get() called by
> rocket.py run() line 405
> * Remaining 10 threads all in socket.py readline() called by rocket.py
> read_request_line() line 825
>> 
> I'd send you the full stack traces but winpdb doesn't seem to support
> copying selections. (argggh!)
>> 
> Hope this is useful.
> Mike
>> 
> On Jul 21, 1:01 pm, Kuba Kucharski  wrote:
>> 
>> yes, but I am on the GPRS connection now, I am not able to test it so
>> the results be reliable, I will try to do that asap




[web2py] Re: rocket performance issues

2010-07-22 Thread MikeEllis
Doesn't fix the symptom

On Jul 21, 8:54 pm, Jonathan Lundell  wrote:
> On Jul 21, 2010, at 2:03 PM, mdipierro wrote:
>
> > The fact that you are having the problem with static files is giving
> > me an idea for a test.
> > Can you please try the web2py I just posted in trunk?
>
> That seems like a nice optimization, but (assuming it fixes the symptom) does 
> it explain the 20-25-second stalls?
>
>
>
>
>
> > Massimo
>
> > On Jul 21, 2:08 pm, MikeEllis  wrote:
> >> One more detail.  As you would hope, it's generally not the case that
> >> both browsers stall at the same time.  While stalled on either laptop
> >> I can keep reloading on the other.
>
> >> On Jul 21, 3:03 pm, MikeEllis  wrote:
>
> >>> I tried changing to cron=False in web2py.py.  No impact on problem.
> >>> Same two-laptop setup as described previous.  Happens even on  pages
> >>> that contain very little.  Chrome DevTools shows same problem as
> >>> before:  One or more the .js/.css/.png files are delayed by 20 to 25
> >>> seconds latency.
>
> >>> The problem is also unaffected by whether I run web2py under winpdb or
> >>> directly from the command line.   If I interrupt during the latency
> >>> while running under winpdb,  I typically see
>
> >>> * MainThread in rocket.py start() on line 301
> >>> * Thread1 in threading.py wait() called by Queue.py get() called by
> >>> rocket.py run() line 405
> >>> * Remaining 10 threads all in socket.py readline() called by rocket.py
> >>> read_request_line() line 825
>
> >>> I'd send you the full stack traces but winpdb doesn't seem to support
> >>> copying selections. (argggh!)
>
> >>> Hope this is useful.
> >>> Mike
>
> >>> On Jul 21, 1:01 pm, Kuba Kucharski  wrote:
>
>  yes, but I am on the GPRS connection now, I am not able to test it so
>  the results be reliable, I will try to do that asap


Re: [web2py] Re: Executing applications from web2py

2010-07-22 Thread Hector Oron
Hi,

2010/7/21 mdipierro :
> Welcome Hector,

Thanks

> using os.system is fine if the the commands are short and independent.
> I would recommend creating a database table of tasks to be executed
>
> db.define_table('task_queue',Field('status'),Field('command'))
>
> The web app would queue commands (status=queued) and a web2py shell
> script would monitor the task queue, pop a command (status=running),
> execute it, and change the status (=completed or =error).

Looks like a nice idea. I'll give it a go.
I also hit PyAMF (I am not much into Python - as you might notice)
with might be also useful to transfer binaries from buildserver to
programming station, what do you think?

> Have a plugin PBS that does this and interfaces with the PBS qsub/
> qstat/qdel but it may be more complex than you need.

I was unable to find such plugin, do you mind a pointer?


-- 
 Héctor Orón

"Our Sun unleashes tremendous flares expelling hot gas into the Solar
System, which one day will disconnect us."


[web2py] Re: Can web2py be used as a node in a P2P app or store data in a DHT?

2010-07-22 Thread Luis Díaz
yo tengo tiempo pensando en algo como una red para móviles, donde cada uno
de ellos funcione como nodo de conexión descentralizado, para asi ampliar la
cobertura y escalar el servicio.
y con plataformas libres como androi.. el camino lo veo poco empinado.


bueno... yo salgo de vacaciones para el 15 de agosto.
espero ponerme al corriente con un blog que monte (web2pyfacil) que ni lo he
mirado :s

y estoy a la disposición para el proyecto de red descentralizada para web2py
y la de los móviles.

también empezare un proyecto personal (pequeño) de comercio electrónico.

saludos y estamos en contacto

-- 
Díaz Luis
TSU Analisis de Sistemas
Universidad de Carabobo

--- google traductor -
sinceyear time thinking I have something like a mobile network, where each
connection node functions as a decentralized, thus extending the coverage
and scale the service.
and free platforms like androi .. the way I see little steep.


well ... I go on vacation for 15 August.
I hope to catch up with a blog that mountain (web2pyfacil) I have not even
looked at: s

and I am now available for the project web2py decentralized network and the
mobile.

also I will start a personal project (small) e-commerce.

and are in contact greetings

-
Luis Diaz
TSU Systems Analysis
University of Carabobo


[web2py] Re: plugin_wiki

2010-07-22 Thread mdipierro
We need to write a draft a roadmap. Alvaro has been saying this for
some time.
For me the priority is to strengthen web2py code and improve
documentation.

plugin_wiki is usable but we need more people to start using it before
we can finalize the its specs and until that is done I am not ready to
guarantee its backward compatibility.

T2,T3,etc. are all dead because they did not use any of the
gluon.tools stuff. plugin_wiki leverages on those insetad. It gets
installed at the app level so if will not broken by web2py upgrades.
It may be broken with plugin upgrades until we freeze the specs.

If I were you I'd use plugin_wiki by emebdding widgets in views with
{{=plugin_wiki.widget(name,**attributes)}}. Even if the syntax may
change a little the functionality is here to stay.

massimo



On Jul 21, 4:16 pm, Tim Michelsen  wrote:
> > What does the roadmap look like for
> > the future?
>
> Yes, that's exactly my question at the moment.
>
> I mean there were a numbert of attempts:
> t1, t2, c9, cube2py and now just plugin_wiki.
>
> How much is the core team dedicated to make this more that just a demo
> project?
>
> Web development at my company is shaping again as decisions seem to be made.
>
> So before I invest another bunch of hours in yet the next show-off tool?
>
> I tried to convert my self-programmed site into T9 now it tuens out to
> be a senseless effort.
>
> So a clear statement is needed.
>
> Because the video is definately HOT STUFF that deserves to be used.
> But for production employment I need a statement that ensures future
> upgradability just like web2py development ensures backward compatibility.
>
> Thanks and regards,
> Timmie


[web2py] Re: SQLite Logging

2010-07-22 Thread Massimo Di Pierro

This is useful. I suggest making a web2py slice about this.

Massimo

On Jul 21, 2010, at 9:37 PM, Iceberg wrote:

Just a quick thought. Since web2py itself already handles SQLite db  
well under multi-thread situation, so a quick tweak to your  
sqlitehandler.py may be putting the web2py db instance, rather than  
a filename, to initialize your SQLiteHandler() class.


Best regards,
   Iceberg, 2010-Jul-22, 10:28(AM), Thu



--- Original Message ---
From:Yarin 
To:  web2py-users 
Cc:  johann.scheibelho...@easytouch-edv.com, mdipie...@cs.depaul.edu 
, iceb...@21cn.com

Date:Wed, 21 Jul 2010 19:15:55 -0700 (PDT)
Subject: SQLite Logging
---


I'd like to elicit some help in putting together a SQLite-based
logging solution for web2py.

Logging to a file was covered earlier in this forum (See "Global
logging to file"):
http://groups.google.com/group/web2py/browse_thread/thread/e20d0bd2e542aa14/e248314770225225
log.py:
https://sites.google.com/site/ykessler/main/log.py

I've written a SQLite logging handler:
https://sites.google.com/site/ykessler/main/sqlitehandler.py

However, although the SQLite handler works great in normal Python
environments, it errors out with the global logging solution because
the logger emits on multiple threads, and SQLite objects are
restricted to the thread they're created on.

Any ideas on how to sync these two solutions?






[web2py] Re: Error in trunk?

2010-07-22 Thread mdipierro
please try again

On Jul 22, 1:43 am, David Marko  wrote:
> Applying latest trunk I'm getting following error on console when
> navigating the first page e.g.http://localhost:8000
>
> ERROR:root:Traceback (most recent call last):
>   File "c:\java\google_appengine\web2py\gluon\main.py", line 384, in
> wsgibase
>     if static_file:
> UnboundLocalError: local variable 'static_file' referenced before
> assignment


Re: [web2py] Mail function not working

2010-07-22 Thread Vasile Ermicioi
>
>
> mail.settings.server= '192.168.200.43:25'
>
>
 add port


[web2py] Re: web2py and tomcat on same server possible?

2010-07-22 Thread Andrew Buchan
Ok, thanks, I had it in my head that that was the case for some reson.
The Tomcat will be set to run on 8080 and web2py is on 80 so shouldn't
be a problem,  just thought I'd check first in case of major panic
later...

On Jul 21, 12:49 pm, mdipierro  wrote:
> Why would IIS be disabled when running web2py? There are conflicts
> only if two servers use the same port. The best setting if you need to
> run apps that need incompatible servers is to run both on different
> ports and have one proxy the other.
>
> On Jul 21, 6:00 am,AndrewBuchan wrote:
>
>
>
> > Hi all,
>
> > We've got someone coming next week to install a tool which requires
> > tomcat, and the plan is to put that on the same (Windows 2003) server
> > where web2py is currently running as a service. I know that IIS should
> > be disabled when running web2py, and was wondering whether there were
> > any similar issues with tomcat, or can I have both running on the same
> > server?
>
> > Thanks.


[web2py] Is there anyone who did something with web2py and couchdb?

2010-07-22 Thread David Marko
Is there anyone who did something with web2py and couchdb? Can you
share your experience?

David


[web2py] Re: request.post_vars

2010-07-22 Thread web2py noob
On 20 jul, 02:54, mdipierro  wrote:

> because the crud.create does accept inside therefore the form is
> processed before you set form.vars.ficha. You can do insetad:
>
> controller1:
>
> form=crud.create(db.familia)
> if form.accepts(request.vars,session):
>     session.ficha=request.post_vars.ficha
>     redirect(URL(r=request,f='persona'))
>
> controller 2:
>
> def persona():
>     db.persona.ficha=session.ficha
>     form=crud.create(db.persona)

Well, just for the record, I the code in persona() should be:

def persona():
form=crud.create(db.persona)
form.vars.ficha=session.ficha

now works :D

thanks


[web2py] Change select options depending on other form variable

2010-07-22 Thread Serbitar
Thanks to the manual I know how I can hide a form widget depending on
other form variables with jquery.
However I have no Idea how to change other form properties, for
example the options that can be selected in a drop down menu,
depending on, for example, the selection in a second drop down menu.

Could somebody point me in the right direction?


[web2py] Mail function not working

2010-07-22 Thread Andrew Buchan
Hello,

I can't get the web2py mail function to work despite trying a
multitude of settings (in fact I used a 'brute-force' attack to try
all the possible combinations I could think of), here's the latest in
my db.py:

mail=Mail()
mail.settings.server= '192.168.200.43'
mail.settings.sender= 'the...@h**a.com'
auth.settings.mailer = mail
mail.settings.login= None


However, in a module I have the following, which works fine:

-
import smtplib

def
msg_body = "\r\n".join([
"From: %s" % FROM,
"To: %s" % to,
"Subject: %s" % subject,
"",
message])
server = smtplib.SMTP('192.168.200.43')
server.sendmail(FROM, [to], msg_body )
server.quit()
-

This has done me until now, but now I need to enable
"auth.settings.registration_requires_verification = True", and the
password reset functions. So I either need to get web2py's mail to
work, or make web2py use the smtplib method as above, preferably the
former.
Its a windows server with web2py running as a service and the python
service is allowed to send emails.

Any suggestions?
Thanks.


[web2py] Re: Having problem accessing admin thru ssh tunneling

2010-07-22 Thread Narendran
Sorry, not version, instance.

On Jul 22, 12:19 pm, Narendran  wrote:
> Ok. understood the problem.
> I had to run another version of web2py in the remote (prod) server
> on  different port in fact.
>
> On Jul 22, 10:13 am, Narendran  wrote:
>
>
>
> > Hi,
> > As widely recommended,
> > 1. I have removed the  parameters_*.py on my prod server.
> > 2. Established an ssh connection to my prod server from my local host
> > on my_port.
> > 3. Started web2py locally on that port with -a ' option.
> > 4. Now, if I try to accesshttp://localhost:my_port/admin, I get this
> > message:
> > admin disabled because unable to access password file
>
> > Am I missing something here?
>
> > --
> > Thanks
> > Narendran


[web2py] Re: Having problem accessing admin thru ssh tunneling

2010-07-22 Thread Narendran
Ok. understood the problem.
I had to run another version of web2py in the remote (prod) server
on  different port in fact.

On Jul 22, 10:13 am, Narendran  wrote:
> Hi,
> As widely recommended,
> 1. I have removed the  parameters_*.py on my prod server.
> 2. Established an ssh connection to my prod server from my local host
> on my_port.
> 3. Started web2py locally on that port with -a ' option.
> 4. Now, if I try to accesshttp://localhost:my_port/admin, I get this
> message:
> admin disabled because unable to access password file
>
> Am I missing something here?
>
> --
> Thanks
> Narendran


[web2py] Re: Access other middleware and business logic from web2py

2010-07-22 Thread ron_m
You could run web2py in a Jython environment which can then interface
to Java libraries. You would still have to get into the JEE container
held part of the application but my JEE knowledge is now dated and I
never used JBoss so am not sure what would be involved there.

Ron