[web2py] Re: social network idea

2011-01-18 Thread mart
A bit late, but thought I'd put my 2 cents worth anyways (and besides,
you did ask ;),

I think what your proposing is great, there's no doubt there :) I took
your comment as "We need to think of something different..." and went
with that, and not to find an alternative to your proposal (because I
really do like it and I would be a user ;) ).

I was thinking the discussion is about 'different', and once we do
that, it will most likely boil down to a question of choice... I
think.

Why should the social network handle content? Because the social
network is already handling content. In fact, it is leading the
discussions. It has an environment (color, layout, adds (which is what
turned me off), forms (i.e. to create a profile)), it has rules and it
does have preset content where 'friends' can annoy everyone until our
eyes fall out with their enjoyment of 24 horoscope predictions daily.
Sure, we can kick them to the curb and hide them, but that does defeat
the purpose, doesn't?

Anyways, my point was simply that, for me, the perfect social
networking is where I get to take control of my space and decide what,
to a greater degree, the content of my space and, what kind of
information I want to use to be social... Maybe I don't have any
interest in catching up with old college buddies or being suggested
that "you ave worked with these people" is a good way to add to my
collection of friends. I would rather control my search criteria (Eg.
only search for people who like pre-classical non tempered violin
duos ;) - no, I wouldn't really have that in my criteria). And,
ideally, the people make the top 10 search results have the choice to
say "yeah, ok let this guy look at my information" (because I would
appreciate that as well).

Anyways, before I stop typing (yes, I can do that ;) ) Id like to add
that I do not necessarily disagree with your opening analysis:

"It seems to me the main problem to me is that a lot of people are
alone they because do not necessarily share interests with their
colleagues and family members."

Its just that I think its an assumption, like you said... I don't
think its about not sharing any interests, i rather think its about
not knowing how to share interests (specially with family, i would
think)...

Ok, I'm done typing :)

Mart :)



On Jan 18, 10:29 am, Massimo Di Pierro 
wrote:
> I found diigo is a really good bookmarking site. It has some social
> features, although not the ability to find people with same bookmarks
> nearby.
>
> On Jan 18, 8:44 am, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > At a second look...
>
> >http://pinboard.in/thisis very close to what I proposed. The fee is
> > a one-time sign up fee. Their business model is very interesting but
> > will prevent growth (the more users the more it costs to join -
> > clearly not designed by an economist! - reminiscent of the social
> > security business model).
>
> > On Jan 18, 8:30 am, Massimo Di Pierro 
> > wrote:
>
> > > $9.19? They got the business model wrong.
>
> > > On Jan 18, 12:12 am, Tom Atkins  wrote:
>
> > > >http://pinboard.ingivesmealist of people to check out based on their
> > > > bookmarking history.  I don't know the details of the algorithm and 
> > > > there's
> > > > no flexibility in refining the recommendations but I've found some
> > > > interesting people to add to my 'network'. You can only see the 
> > > > username of
> > > > the person. The ability to find out more about people and then contact 
> > > > them
> > > > as Massimo suggests would be a good feature.
>
> > > > The Facebook feature that lets you create 'lists' of friends so you can
> > > > share things with sub-groups of your friends is not subtle enough - as 
> > > > far
> > > > as I can tell it only allows you to send 'messages' to people in a list 
> > > > -
> > > > this can be intrusive as it ends up in their 'inbox' and also usually
> > > > emailed.  It would be better if you could also do 'wall' posts that can 
> > > > only
> > > > be seen by a sub group of friends (e.g. rude joke for my friends to see 
> > > > but
> > > > not family).


Re: [web2py] Re: Long-running controllers

2011-01-18 Thread Jonathan Lundell
On Jan 18, 2011, at 6:50 PM, ae wrote:
> 
> On Jan 18, 9:17 pm, Jonathan Lundell  wrote:
>> On Jan 18, 2011, at 5:41 PM, ae wrote:
>> 
>> 
>> 
>>> On Jan 18, 11:22 am, Jonathan Lundell  wrote:
>> 
 When you say "anyone associated with the thread", do you mean other 
 requests using some shared, locked resource (like the session)? Or 
 something else?
>> 
>>> Browser sessions seem to get associated to a thread.  As long as that
>>> thread is busy the user won't (and anyone else who's session is
>>> assocated to that thread won't) be able to do anything else.  This
>>> mostly seems like a security precaution and is good.
>> 
>> Each request runs in its own thread. Users don't share sessions, so session 
>> serialization won't block other users. Database serialization could, though.
>> 
>> On the whole, I think you're better off using JavaScript to make this kind 
>> of thing asynchronous. Better user experience, too.
> 
> Yeah.  I didn't ever think that users share sessions, but I believe
> that a browser cookie is set and that cookie is associated to a
> thread. (one thread, many sessions).  

No, a cookie is associated with a session.

For all practical purposes, each request gets its own thread (in practice, 
threads are recycled through a thread pool, but that's just for efficiency). 
Threads themselves don't retain any meaningful identity from one request to the 
next.

> When a thread is busy for a
> while, all users associated to that thread will block on that thread.

When a request is busy for a while, all other requests with the same session 
will block on that session (unless the busy thread does a 
session.forget(response)).

> (note that I'm using an old version that uses CherryPy, but I would be
> surprised if it's different with Rocket)
> 
> Try creating a file like this default.py:
> 
> 
> def blockme():
>import time
>time.sleep(30)
> 
> 
> def sayjunk():
>return "Junkjunk html>"
> 
> 
> 
> Then hit the blockme function from your browser and before the end of
> that 30 seconds see if you can access sayjunk.
> 
> I have a few controllers that occasionally take longer than expected.
> When that happens I have reports of multiple users not being able to
> access the application for until they 1) wait a while or 2) restart
> their browser.
> 
> Again, I just wanted to see if anyone had thought of a simpler
> solution than I did.
> 
> --Todd
> 




Re: [web2py] Re: Long-running controllers

2011-01-18 Thread Jonathan Lundell
On Jan 18, 2011, at 7:58 PM, Massimo Di Pierro wrote:
> 
> Your code does not block the server. Only blocks the session
> associated to your browser to guarantee integrity of the data in your
> session. If you know that the block function takes time and it does
> not need to save session, you can do:
> 
> def blockme():
>session.forget()
>import time
>time.sleep(30)
> 
> def sayjunk():
>return "Junkjunk html>"

Actually, there's a bug in the documentation (or else in Session). You have to 
say:

session.forget(response)

or else the session doesn't get unlocked.

[web2py] Shell & controllers & views

2011-01-18 Thread walter
Question about a shell. Can I interact to controllers and views as
easy as a DB? If it is true, how?


[web2py] Re: Use the source, Luca

2011-01-18 Thread cjrh
On Jan 19, 2:59 am, Anthony  wrote:
> These are great thoughts. One comment below...
>
> On Tuesday, January 18, 2011 7:21:05 PM UTC-5, cjrh wrote:
> > documentation.   Epydoc provides a space for writing module-level
> > comments, and my gut feel is that the higher-level description of the
> > source code itself should appear here.  Perhaps a link from the book
> > chapter to the Epydoc page for that module?
>

> that may not always be as easy to gleen from module/class/function
> docstrings. For example, Jonathan's "Installation and Deployment" section
> refers to more than one module, so that kind of thing needs to be handled at
> a higher level than just a module docstring.

There was a malfunction on my link to the module-level documentation
that I was referring to (curse you Frames): first go here:

http://www.web2py.com/examples/static/epydoc/index.html

And then click on web2py.gluon.dal on the left. You will see module-
level documentation on the right, which is already prose-like and
descriptive.  This is what I was referring to as a suggested location
for the "tour guide to the source code".

> He also explains installation
> and startup scripts, which are probably not covered in the API documentation
> at all.

That should definitely go into the book, no question.


[web2py] Re: form / subform / adding row (field)...

2011-01-18 Thread mart
Hey, es-tu de Montreal?

On Jan 18, 7:08 pm, Richard Vézina 
wrote:
> I forgot to paste :
>
> def register():
>     form=SQLFORM.factory(db.client, db.address, formstyle = 'divs') #,
> table_name='dummy_name')
>     if form.accepts(request.vars):
>         id = db.client.insert(**db.client._filter_fields(form.vars))
>         form.vars.client=id
>         id = db.address.insert(**db.address._filter_fields(form.vars))
>         response.flash='Thanks for filling the form'
>     return dict(form=form)
>
> What to do for what in red?
>
> I think _filter_fields is the key of the problem...
>
> I didn't have a look to it actually...
>
> Richard
>
> On Tue, Jan 18, 2011 at 7:00 PM, Richard Vézina 
>
>
>
>
>
>
> > wrote:
> > Hello Massimo,
>
> > I am trying to insert data in 2 tables from one form... I would like to be
> > able to insert any number of rows or records in the subtable.
>
> > I build this test app (see attach)... All the work I did is mostly in
> > /default/register.html where there is jQuery script that allow adding new
> > city input and delete new city input...
>
> > I built it from scratch for Web2py inspired by :
> >http://charlie.griefer.com/blog/index.cfm/2009/9/17/jQuery--Dynamical...
>
> > What should I do in register to allow the function to insert all the filled
> > city clone field??
>
> > Next step will be adapted my script that it manage all the subform columns
> > instead of only one.
>
> > Thanks.
>
> > Richard


[web2py] Re: form / subform / adding row (field)...

2011-01-18 Thread mart
I'm going to try this :) sorry, I mean to try your code from
yesterday. I think sub-forms would be an awesome addition. Anyways, if
it helps, I'll test and provide what i can :)

Mart

On Jan 18, 7:08 pm, Richard Vézina 
wrote:
> I forgot to paste :
>
> def register():
>     form=SQLFORM.factory(db.client, db.address, formstyle = 'divs') #,
> table_name='dummy_name')
>     if form.accepts(request.vars):
>         id = db.client.insert(**db.client._filter_fields(form.vars))
>         form.vars.client=id
>         id = db.address.insert(**db.address._filter_fields(form.vars))
>         response.flash='Thanks for filling the form'
>     return dict(form=form)
>
> What to do for what in red?
>
> I think _filter_fields is the key of the problem...
>
> I didn't have a look to it actually...
>
> Richard
>
> On Tue, Jan 18, 2011 at 7:00 PM, Richard Vézina 
>
>
>
>
>
>
> > wrote:
> > Hello Massimo,
>
> > I am trying to insert data in 2 tables from one form... I would like to be
> > able to insert any number of rows or records in the subtable.
>
> > I build this test app (see attach)... All the work I did is mostly in
> > /default/register.html where there is jQuery script that allow adding new
> > city input and delete new city input...
>
> > I built it from scratch for Web2py inspired by :
> >http://charlie.griefer.com/blog/index.cfm/2009/9/17/jQuery--Dynamical...
>
> > What should I do in register to allow the function to insert all the filled
> > city clone field??
>
> > Next step will be adapted my script that it manage all the subform columns
> > instead of only one.
>
> > Thanks.
>
> > Richard


[web2py] Re: Long-running controllers

2011-01-18 Thread Anthony
I tried this (the session.forget() version), and sayjunk is still being 
blocked for 30 seconds while waiting for blockme to finish (only when in the 
same browser -- I can load sayjunk in a different browser, which starts a 
different session). Am I missing something?

On Tuesday, January 18, 2011 10:58:09 PM UTC-5, Massimo Di Pierro wrote:

> Your code does not block the server. Only blocks the session 
> associated to your browser to guarantee integrity of the data in your 
> session. If you know that the block function takes time and it does 
> not need to save session, you can do: 
>
> def blockme(): 
> session.forget() 
> import time 
> time.sleep(30) 
>
> def sayjunk(): 
> return "Junkjunk html>" 
>
>
>
> On Jan 18, 8:50 pm, ae  wrote: 
> > On Jan 18, 9:17 pm, Jonathan Lundell  wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > On Jan 18, 2011, at 5:41 PM, ae wrote: 
> > 
> > > > On Jan 18, 11:22 am, Jonathan Lundell  wrote: 
> > 
> > > >> When you say "anyone associated with the thread", do you mean other 
> requests using some shared, locked resource (like the session)? Or something 
> else? 
> > 
> > > > Browser sessions seem to get associated to a thread.  As long as that 
>
> > > > thread is busy the user won't (and anyone else who's session is 
> > > > assocated to that thread won't) be able to do anything else.  This 
> > > > mostly seems like a security precaution and is good. 
> > 
> > > Each request runs in its own thread. Users don't share sessions, so 
> session serialization won't block other users. Database serialization could, 
> though. 
> > 
> > > On the whole, I think you're better off using JavaScript to make this 
> kind of thing asynchronous. Better user experience, too. 
> > 
> > Yeah.  I didn't ever think that users share sessions, but I believe 
> > that a browser cookie is set and that cookie is associated to a 
> > thread. (one thread, many sessions).  When a thread is busy for a 
> > while, all users associated to that thread will block on that thread. 
> > (note that I'm using an old version that uses CherryPy, but I would be 
> > surprised if it's different with Rocket) 
> > 
> > Try creating a file like this default.py: 
> > 
> > def blockme(): 
> > import time 
> > time.sleep(30) 
> > 
> > def sayjunk(): 
> > return "Junkjunk > html>" 
> > 
> > Then hit the blockme function from your browser and before the end of 
> > that 30 seconds see if you can access sayjunk. 
> > 
> > I have a few controllers that occasionally take longer than expected. 
> > When that happens I have reports of multiple users not being able to 
> > access the application for until they 1) wait a while or 2) restart 
> > their browser. 
> > 
> > Again, I just wanted to see if anyone had thought of a simpler 
> > solution than I did. 
> > 
> > --Todd



Re: [web2py] Re: [off-topic] - Jquery Panels/dashboard Plugin

2011-01-18 Thread Anthony
On Tuesday, January 18, 2011 10:38:03 PM UTC-5, rochacbruno wrote: 
>
> It has a 2.0 version http://www.trilancer.com/jpolite2/
>
 
Yeah, the version at http://www.web2py.com/jpolite is actually a port of the 
older JPolite to web2py, but it probably makes sense to work with the newer 
version (though development doesn't appear to be very active).


[web2py] WARNING:root:failure to stat applications

2011-01-18 Thread Rupesh Pradhan
My Computer Configuration:
CPU: Intel
Motheboard: ASUS
OS: Windows XP Profession, SP2

Web2Py version: 1.91.4 (2010-12-22)

Why am I getting this error?

WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
f6f76cfb-49b1-4b04-af6b-f0fae01c7d5d: expected a character buffer
object


When I leave the application alone for sometime i.e. when I am not
actively using it, the dialog box reporting that an error has occurred
pops up.


The complete error log since epoch is given below for reference:
-
ERROR:Rocket.Errors.ThreadPool:Socket 192.168.0.1:8000 in use by other
process and it won't share.
CRITICAL:Rocket.Errors.ThreadPool:No interfaces to listen
on...closing.
ERROR:Rocket.Errors.ThreadPool:Socket 192.168.0.1:8000 in use by other
process and it won't share.
CRITICAL:Rocket.Errors.ThreadPool:No interfaces to listen
on...closing.
ERROR:Rocket.Errors.ThreadPool:Socket 192.168.0.1:8000 in use by other
process and it won't share.
CRITICAL:Rocket.Errors.ThreadPool:No interfaces to listen
on...closing.
WARNING:root:failure to stat applications\admin\sessions
\127-0-0-1-9591bf07-ecb6-415b-a56b-d9fbc9a115b1: expected a character
buffer object
WARNING:root:failure to stat applications\admin\sessions\127-0-0-1-
b25a988f-9df3-4451-9bf6-8cefdbec438b: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions
\127.0.0.1-4028ed2f-4e8b-4d89-a428-060c3f4d4624: expected a character
buffer object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
a7eeb5c4-ac61-4cbd-b2f6-5c9b348f5052: expected a character buffer
object
Unhandled exception in thread started by >
Traceback (most recent call last):
  File "gluon/main.py", line 727, in start
  File "gluon/rocket.py", line 419, in start
  File "gluon/rocket.py", line 431, in stop
  File "gluon/rocket.py", line 712, in stop
RuntimeError: Set changed size during iteration
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
a14eda27-98c2-47cd-940f-975564236afd: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
a7eeb5c4-ac61-4cbd-b2f6-5c9b348f5052: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
a9476b99-b737-42eb-8220-d5afe539117c: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
dd2af7f2-5851-4ab9-bb5b-b280f73fe1b7: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
f6f76cfb-49b1-4b04-af6b-f0fae01c7d5d: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
a14eda27-98c2-47cd-940f-975564236afd: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
a7eeb5c4-ac61-4cbd-b2f6-5c9b348f5052: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
a9476b99-b737-42eb-8220-d5afe539117c: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
d4843b6d-dffb-40e8-a3bd-5f527212e890: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
dd2af7f2-5851-4ab9-bb5b-b280f73fe1b7: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
f6f76cfb-49b1-4b04-af6b-f0fae01c7d5d: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
a14eda27-98c2-47cd-940f-975564236afd: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
a7eeb5c4-ac61-4cbd-b2f6-5c9b348f5052: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
a9476b99-b737-42eb-8220-d5afe539117c: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
d4843b6d-dffb-40e8-a3bd-5f527212e890: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
dd2af7f2-5851-4ab9-bb5b-b280f73fe1b7: expected a character buffer
object
WARNING:root:failure to stat applications\admin\sessions\127.0.0.1-
f6f76cfb-49b1-4b04-af6b-f0fae01c7d5d: expected a character buffer
object
-


[web2py] Re: Long-running controllers

2011-01-18 Thread Massimo Di Pierro
Your code does not block the server. Only blocks the session
associated to your browser to guarantee integrity of the data in your
session. If you know that the block function takes time and it does
not need to save session, you can do:

def blockme():
session.forget()
import time
time.sleep(30)

def sayjunk():
return "Junkjunk"



On Jan 18, 8:50 pm, ae  wrote:
> On Jan 18, 9:17 pm, Jonathan Lundell  wrote:
>
>
>
>
>
>
>
>
>
> > On Jan 18, 2011, at 5:41 PM, ae wrote:
>
> > > On Jan 18, 11:22 am, Jonathan Lundell  wrote:
>
> > >> When you say "anyone associated with the thread", do you mean other 
> > >> requests using some shared, locked resource (like the session)? Or 
> > >> something else?
>
> > > Browser sessions seem to get associated to a thread.  As long as that
> > > thread is busy the user won't (and anyone else who's session is
> > > assocated to that thread won't) be able to do anything else.  This
> > > mostly seems like a security precaution and is good.
>
> > Each request runs in its own thread. Users don't share sessions, so session 
> > serialization won't block other users. Database serialization could, though.
>
> > On the whole, I think you're better off using JavaScript to make this kind 
> > of thing asynchronous. Better user experience, too.
>
> Yeah.  I didn't ever think that users share sessions, but I believe
> that a browser cookie is set and that cookie is associated to a
> thread. (one thread, many sessions).  When a thread is busy for a
> while, all users associated to that thread will block on that thread.
> (note that I'm using an old version that uses CherryPy, but I would be
> surprised if it's different with Rocket)
>
> Try creating a file like this default.py:
>
> def blockme():
>     import time
>     time.sleep(30)
>
> def sayjunk():
>     return "Junkjunk html>"
>
> Then hit the blockme function from your browser and before the end of
> that 30 seconds see if you can access sayjunk.
>
> I have a few controllers that occasionally take longer than expected.
> When that happens I have reports of multiple users not being able to
> access the application for until they 1) wait a while or 2) restart
> their browser.
>
> Again, I just wanted to see if anyone had thought of a simpler
> solution than I did.
>
> --Todd


[web2py] Re: Using mysqldb instead of pymysql

2011-01-18 Thread Massimo Di Pierro
I just included the latest pymysql in trunk. Does it make things
better?

On Jan 18, 6:05 pm, drayco  wrote:
> Hi, I do this revert, thank's
>
> try:
>     import MySQLdb
>     drivers.append('MySQL')
> except ImportError:
>     logger.debug('no MySQLdb driver')
>
> And
>
>         self.pool_connection(lambda db=db,
>                              user=credential_decoder(user),
>                              password=credential_decoder(password),
>                              host=host,
>                              port=port,
>                              charset=charset:
> MySQLdb.Connection(db=db,
>
> user=user,
>
> passwd=password,
>
> host=host,
>
> port=port,
>
> charset=charset,
>                                                               ))
> In dal.py
> However, the error is still appear
>
> Traceback (most recent call last):
>   File "/home/drayco/web2py/gluon/restricted.py", line 188, in
> restricted
>     exec ccode in environment
>   File "/home/drayco/web2py/applications/iscada/models/cfedb.py", line
> 16, in 
>     migrate = False)
>   File "/home/drayco/web2py/gluon/dal.py", line 3457, in define_table
>     sequence_name=sequence_name))
>   File "/home/drayco/web2py/gluon/dal.py", line 3741, in __init__
>     "primarykey must be a list of fields from table '%s " % tablename
> SyntaxError: primarykey must be a list of fields from table
> 'med_dnpmst_4
>
> Well I think this is a problem with compatibility.
>
> Do you have any suggestions?
>
> On Jan 14, 6:36 pm, Luther Goh Lu Feng  wrote:
>
>
>
>
>
>
>
> > To test if the issue is with pymysql, you could edit the dal file to
> > use mysqldb
>
> >http://code.google.com/p/web2py/source/diff?spec=svnfc75444ca55590835...
>
> > On Jan 13, 11:31 am, drayco  wrote:
>
> > > I need that some of you guys check this, in my case, Pymysql have some
> > > issues with legacy databases (First, I think this issue is of new dal,
> > > but I'm not sure)
> > > However mysqldb, my application work well
>
> > > this is my report:
>
> > >http://groups.google.com/group/web2py/browse_thread/thread/72e91e281e...
>
> > > On Jan 12, 11:46 am, Vasile Ermicioi  wrote:
>
> > > > hi,
>
> > > > Massimo, there is a new  version of pymysql
>
> > > > I think pymysql has a few advantages
> > > > - being pure Python, PyMySQL is easily patched by gevent and the likes 
> > > > to
> > > > make it cooperative
>
> > > >http://code.google.com/p/pymysql/wiki/WhyPyMySQL
>
> > > > I use it with web2py and works fine


[web2py] Re: [off-topic] - Jquery Panels/dashboard Plugin

2011-01-18 Thread ron_m
Have a look at this one

http://net.tutsplus.com/tutorials/javascript-ajax/inettuts/



Re: [web2py] Re: [off-topic] - Jquery Panels/dashboard Plugin

2011-01-18 Thread Bruno Rocha
It has a 2.0 version http://www.trilancer.com/jpolite2/


[web2py] Re: Long-running controllers

2011-01-18 Thread ae
On Jan 18, 9:17 pm, Jonathan Lundell  wrote:
> On Jan 18, 2011, at 5:41 PM, ae wrote:
>
>
>
> > On Jan 18, 11:22 am, Jonathan Lundell  wrote:
>
> >> When you say "anyone associated with the thread", do you mean other 
> >> requests using some shared, locked resource (like the session)? Or 
> >> something else?
>
> > Browser sessions seem to get associated to a thread.  As long as that
> > thread is busy the user won't (and anyone else who's session is
> > assocated to that thread won't) be able to do anything else.  This
> > mostly seems like a security precaution and is good.
>
> Each request runs in its own thread. Users don't share sessions, so session 
> serialization won't block other users. Database serialization could, though.
>
> On the whole, I think you're better off using JavaScript to make this kind of 
> thing asynchronous. Better user experience, too.

Yeah.  I didn't ever think that users share sessions, but I believe
that a browser cookie is set and that cookie is associated to a
thread. (one thread, many sessions).  When a thread is busy for a
while, all users associated to that thread will block on that thread.
(note that I'm using an old version that uses CherryPy, but I would be
surprised if it's different with Rocket)

Try creating a file like this default.py:


def blockme():
import time
time.sleep(30)


def sayjunk():
return "Junkjunk"



Then hit the blockme function from your browser and before the end of
that 30 seconds see if you can access sayjunk.

I have a few controllers that occasionally take longer than expected.
When that happens I have reports of multiple users not being able to
access the application for until they 1) wait a while or 2) restart
their browser.

Again, I just wanted to see if anyone had thought of a simpler
solution than I did.

--Todd



[web2py] xmlrpc book sample question

2011-01-18 Thread mikech
When I run the sample I'm getting:
Traceback (most recent call last):
  File "", line 2, in 
print item.created_on, item.title
AttributeError: 'dict' object has no attribute 'created_on'

Here is the code:
>>> import xmlrpclib
>>> server = xmlrpclib.ServerProxy(
'http://127.0.0.1:8000/mywiki/default/call/xmlrpc')
>>> for item in server.find_by('wiki'):
print item.created_on, item.title

Item looks like this:
>>> print item
{'body': 'blah', 'created_on': '2011-01-17 21:27:59', 'id': 3, 'created_by': 
1, 'title': 'My Wiki Page'}


This is in Python 2.7.1 


[web2py] Re: web2pyslices migration

2011-01-18 Thread Anthony
This sounds amazing. Looking forward to it.

On Tuesday, January 18, 2011 8:16:35 PM UTC-5, rochacbruno wrote:

> Hello everyone.
>
> web2pyslices server is being migrated from Nathan server for 
> my server, so the site can be down for a while, I'll try to put it 
> to work as quickly as possible. Max tomorrow evening the site will 
> be back and running on my new server, no change and keeping the same 
> data and users.
>
> Me and Martin have begun work on a new site for web2pyslices, we plan this 
> to bea sort of central resource for developers working with 
> web2py, and a kind of social network of 
> programmers that will contain recipes, plugins, applications, 
> tips, videos, tutorials and people for sharing information about web2py. (we 
> have some other secret ideas for the site)
>
> We will try to integrate the most from the book, from the official site, 
> the group and the most used social networking(facebook, twitter, bitbucket, 
> github, etc).
>
> But this is a hard work and certainly take 
> us a bit of time, web2pyslices continue working until when we're 
> ready to migrate all the existing content to the new site.
>
> For now we are working to establish the foundations of this new 
> application and any hint, suggestion, idea will be thoroughly evaluated.
>
> Thanks and sorry if it goes off for some time.
>
> ---
> Bruno Rocha
> http://about.me/rochacbruno/bio
>


Re: [web2py] Re: DRY conception

2011-01-18 Thread Bruno Rocha
2011/1/19 pbreit 

> For starters, I wouldn't get so hung up on DRY. Are the pages you are
> creating very nearly identical but with different data sets?
>
> Jonathan's suggestion sounds good:
> http://app/default/show/t rips
> http://app/default/show/p ersons
>

*So a little change on the code I proposed.*

def show():
allowedtables = ['table1','table2']
tablename = request.args(0)
if tablename in allowedtables:
rows = db(db[tablename]).select()
else:
rows = 'You can't access this table'

return dict(rows=rows)


http://myapp/default/show/ 


Re: [web2py] Re: DRY conception

2011-01-18 Thread pbreit
For starters, I wouldn't get so hung up on DRY. Are the pages you are 
creating very nearly identical but with different data sets?

Jonathan's suggestion sounds good:
http://app/default/show/t rips
http://app/default/show/p ersons


Re: [web2py] Re: Long-running controllers

2011-01-18 Thread Jonathan Lundell
On Jan 18, 2011, at 5:41 PM, ae wrote:
> 
> On Jan 18, 11:22 am, Jonathan Lundell  wrote:
> 
>> When you say "anyone associated with the thread", do you mean other requests 
>> using some shared, locked resource (like the session)? Or something else?
> 
> Browser sessions seem to get associated to a thread.  As long as that
> thread is busy the user won't (and anyone else who's session is
> assocated to that thread won't) be able to do anything else.  This
> mostly seems like a security precaution and is good.

Each request runs in its own thread. Users don't share sessions, so session 
serialization won't block other users. Database serialization could, though.

On the whole, I think you're better off using JavaScript to make this kind of 
thing asynchronous. Better user experience, too.

[web2py] Re: Use the source, Luca

2011-01-18 Thread pbreit
I hate to say it but I think the biggest problem is the Book. Don't get me 
wrong, the Book is very well written and has excellent content. But it's too 
much like a book and too little like online documentation.

I also think the Overview might benefit from being the creation of one 
simple app, like a blog. The current Hello World, image blog and wiki can be 
a bit confusing.


[web2py] Re: reply-to setting in Mail()

2011-01-18 Thread blackthorne
Concerning my question:
I actually tried reply_to in mail.send() without success. now that
someone confirmed that is actually there and supposed to work, I gave
it a second try and it worked.

The reason not to work before is probably related to the web2py
version I was using in production on that system with version 1.73
if reply_to != None:
payload['Reply-To'] = reply_to.encode(ecoding)
the "ecoding" vs "enconding" was broken...

Good thing it works now :)

On Jan 18, 10:45 pm, Anthony  wrote:
> On Tuesday, January 18, 2011 4:55:29 PM UTC-5, cjrh wrote:
>
> > On Jan 18, 7:37 pm, blackthorne  wrote:
> > > Maybe, this should be documented in the book.
>
> > Done.  I included it in the example, but I also added a description of
> > the full signature of the mail.send() command.  I am hesitant to do
> > too much of that, because the docs inside the source code should
> > contain the details of all the settings, whereas the book should
> > contain many examples and overviews of design patterns and framework
> > workflow.
>
> Then we should make it as easy as possible for users to find what they need
> in the source code. Luckily, it appears that Jonathan is now on the case 
> (https://groups.google.com/d/topic/web2py/6cP4LZMzmQE/discussion). Maybe we
> should also provide more prominent links to the Epydoc contents (maybe from
> the book and/or the admin interface). Also, rather than label it "Epydoc"
> (which is actually the name of the tool used to generate it), maybe call it
> something more descriptive, like "API Documentation" or "Source Code
> Documentation".
>
> Anthony


[web2py] Re: Long-running controllers

2011-01-18 Thread ae


On Jan 18, 5:06 pm, cjrh  wrote:
>
> I suggest you present some code to this group that shows how laborious
> it is, and ask for simplifications.  I am not a javascript guru, but
> some do lurk here and that would be the best way to make it less
> laborious.  web2py itself does have some helpers that make setting up
> the javascript a little easier, such as the URL function and whatnot.
> There may be more tricks that we could learn.

I have some stuff that already does this.  Laborious is probably not
fair; I should say laborious in the company of 'regular' web2py stuff.

Mostly I just wanted to make sure I wasn't overlooking some obvious
solution.


[web2py] Re: Long-running controllers

2011-01-18 Thread ae
On Jan 18, 11:22 am, Jonathan Lundell  wrote:

>
> When you say "anyone associated with the thread", do you mean other requests 
> using some shared, locked resource (like the session)? Or something else?


Browser sessions seem to get associated to a thread.  As long as that
thread is busy the user won't (and anyone else who's session is
assocated to that thread won't) be able to do anything else.  This
mostly seems like a security precaution and is good.



[web2py] Re: web2pyslices migration

2011-01-18 Thread Bruno Rocha
Just for curiosity, and to highlight the benefit of being backwards
compatible.

Nathan was running a different version of web2py (I think an old stable
one), I simply grabbed the .w2p package and deployed to the latest version
of web2py, everything running well out of the box :)

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

>


[web2py] Re: web2pyslices migration

2011-01-18 Thread mr.freeze
I am excited to see web2pyslices 2.0 (or whatever you guys decide to
call it).  Thanks Bruno and Martin!

On Jan 18, 7:16 pm, Bruno Rocha  wrote:
> Hello everyone.
>
> web2pyslices server is being migrated from Nathan server for
> my server, so the site can be down for a while, I'll try to put it
> to work as quickly as possible. Max tomorrow evening the site will
> be back and running on my new server, no change and keeping the same
> data and users.
>
> Me and Martin have begun work on a new site for web2pyslices, we plan this
> to bea sort of central resource for developers working with
> web2py, and a kind of social network of
> programmers that will contain recipes, plugins, applications,
> tips, videos, tutorials and people for sharing information about web2py. (we
> have some other secret ideas for the site)
>
> We will try to integrate the most from the book, from the official site, the
> group and the most used social networking(facebook, twitter, bitbucket,
> github, etc).
>
> But this is a hard work and certainly take
> us a bit of time, web2pyslices continue working until when we're
> ready to migrate all the existing content to the new site.
>
> For now we are working to establish the foundations of this new
> application and any hint, suggestion, idea will be thoroughly evaluated.
>
> Thanks and sorry if it goes off for some time.
>
> ---
> Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: web2pyslices migration

2011-01-18 Thread Bruno Rocha
Eventually, until it is offline, you can access with this temporary domain
http://slices.blouweb.com/main/default/index

Thanks

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


[web2py] web2pyslices migration

2011-01-18 Thread Bruno Rocha
Hello everyone.

web2pyslices server is being migrated from Nathan server for
my server, so the site can be down for a while, I'll try to put it
to work as quickly as possible. Max tomorrow evening the site will
be back and running on my new server, no change and keeping the same
data and users.

Me and Martin have begun work on a new site for web2pyslices, we plan this
to bea sort of central resource for developers working with
web2py, and a kind of social network of
programmers that will contain recipes, plugins, applications,
tips, videos, tutorials and people for sharing information about web2py. (we
have some other secret ideas for the site)

We will try to integrate the most from the book, from the official site, the
group and the most used social networking(facebook, twitter, bitbucket,
github, etc).

But this is a hard work and certainly take
us a bit of time, web2pyslices continue working until when we're
ready to migrate all the existing content to the new site.

For now we are working to establish the foundations of this new
application and any hint, suggestion, idea will be thoroughly evaluated.

Thanks and sorry if it goes off for some time.

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


[web2py] Re: Use the source, Luca

2011-01-18 Thread Anthony
These are great thoughts. One comment below...

On Tuesday, January 18, 2011 7:21:05 PM UTC-5, cjrh wrote:

> I think I am in favour of your suggestion of putting references to 
> source units inside the book itself.  I would probably suggest that 
> the format of that inclusion be little more than a list of applicable 
> source files per section, rather than the level of additional detail 
> you demonstrate.  To add further discussion would create more 
> maintenance work for the documentation, and would detract, I feel, 
> from the purpose (and quality, assuming no duplication) of the API 
> documentation.   Epydoc provides a space for writing module-level 
> comments, and my gut feel is that the higher-level description of the 
> source code itself should appear here.  Perhaps a link from the book 
> chapter to the Epydoc page for that module?

 
I don't have a strong opinion on where it should live, but I don't want to 
discourage the kind of explanation Jonathan has provided in his example. 
It's helpful to get a higher-level view of how the system really works, and 
that may not always be as easy to gleen from module/class/function 
docstrings. For example, Jonathan's "Installation and Deployment" section 
refers to more than one module, so that kind of thing needs to be handled at 
a higher level than just a module docstring. He also explains installation 
and startup scripts, which are probably not covered in the API documentation 
at all. So, yes, we should put as much as we can in the docstrings, but 
there may still be some room for additional guidance and explanation. Of 
course, it would be great if we can get it all into a single interface 
(i.e., the Epydoc interface, or some alternative if Epydoc isn't flexible 
enough for the additional material we might want to add -- some other 
options are listed here: http://wiki.python.org/moin/DocumentationTools).
 
Anthony


Re: [web2py] Re: [off-topic] - Jquery Panels/dashboard Plugin

2011-01-18 Thread Bruno Rocha
WOW, Exactly what I need, downloading the source!

I never knew about it. Thank you

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


[web2py] Re: Url for References in the Spanish book

2011-01-18 Thread Anthony
And for anyone who's interested, here is the automated (Google) translation 
plugin: http://web2py.com/plugins/default/translate. The web2py book 
application is also available: http://web2py.com/appliances/default/show/59.

On Tuesday, January 18, 2011 2:22:52 PM UTC-5, Anthony wrote:

> Note, I think the Spanish (and German, French, and Russian) translations 
> available at http://web2py.com/book/ are actually automated Google 
> Translate translations (via plugin_translate). I think the Spanish 
> translation at http://www.latinuxpress.com/books/drafts/web2py/index.html, 
> on the other hand, is actually a human translation (at least, it's not the 
> same as the Google Translate version), so probably preferable to the version 
> at web2py.com.
>  
> Anthony
>  
>


[web2py] Re: Use the source, Luca

2011-01-18 Thread cjrh
On Jan 18, 10:15 pm, Jonathan Lundell  wrote:
> I've been working a little on a proposal for some new cookbook sections, one 
> per chapter, that provide a roadmap to the web2py source that's relevant to 
> the chapter.

There are two dangers in documentation:

1) Too little

2) Too much

"Too much" can be bad for at least two reasons: it is a lot of work to
maintain (need many people), and; it becomes difficult to maintain a
cohesive document design in a collaborative environment.  Ironically,
even though the web2py project has been accused of "too little
documentation", in truth we already suffer from the symptoms of "too
much".  There is gold buried in the web2pyslices.com site, things that
should already be in the book, but are not because the sites are
separate, and it requires significant effort to merge information into
something useful.  The solution is not to create more, but to first
improve what we have.

However, having said that, I do think you make a valuable point about
improving the knowledge transfer of the web2py source code itself.
That job can only be properly performed by someone such as yourself,
who knows the code well.  There are not *that* many of you, but the
numbers could grow if you write such a document.

I guess the point I am making is that we must be careful to try to
make the greatest impact with the least amount of work.

There are three forms of documentation that emerge (I am including a
lot of extra detail for other readers of this post that may pass by):

a) The book, often called the "Developer's Guide" in other development
tools; this is for the person new to web2py that wants to learn how to
get stuff done in the fastest possible way.  It won't carry the full
API, and nor should it, because of (b)

("The book", here: web2py.com/book)

b) The programming API, often called the "Programmer's Guide" in other
development tools, which would presumably be made up of docstrings
harvested directly from the source code

(Epydoc, here: http://www.web2py.com/examples/static/epydoc/index.html).

c) Tutorials, Cookbooks and Howtos

(web2pyslices, here: http://web2pyslices.com/main/default/index)

I really like your suggestion about a guide to the web2py source code,
because it seems that dramatic leverage is available through that
route to get a lot more hands on deck for the development work.  I am
less keen on calling that a cookbook.  Calling it a tour guide would
be better, if I understand what you're aiming for, and you could break
the hegemony that the cookbook metaphor holds over the programming
space.  Enough cooking already!  Let's do sights and sounds!

I don't know what the quality of the API documentation is like ([b] in
my list above), because I spend most of my time on (a), and frankly,
the book has been enough for me in the vast majority of situations
(dir() for everything I need more information about!).  The web2py
book is a great landmark in the project (not "ingredient"!).

I think I am in favour of your suggestion of putting references to
source units inside the book itself.  I would probably suggest that
the format of that inclusion be little more than a list of applicable
source files per section, rather than the level of additional detail
you demonstrate.  To add further discussion would create more
maintenance work for the documentation, and would detract, I feel,
from the purpose (and quality, assuming no duplication) of the API
documentation.   Epydoc provides a space for writing module-level
comments, and my gut feel is that the higher-level description of the
source code itself should appear here.  Perhaps a link from the book
chapter to the Epydoc page for that module?   For instance, for the
DAL chapter, we can link immediately to the module-level Epydoc API
documentation right at the start of chapter:

http://www.web2py.com/examples/static/epydoc/toc-web2py.gluon.dal-module.html

And then you and the other core developers could attack the in-source,
docstring documentation, and in particular the module-level docstrings
with expanded explanation and discussion. If you go to the link above,
you'll see the module-level text that is there already; it's a good
start, but room for the very improvement you have demonstrated in your
post.

My ZAR0.02 :)


[web2py] Re: [off-topic] - Jquery Panels/dashboard Plugin

2011-01-18 Thread Anthony
Probably not quite what you're looking for, but maybe this could help: 
http://www.web2py.com/jpolite

On Tuesday, January 18, 2011 6:52:31 PM UTC-5, rochacbruno wrote:

> Hi, 
>
> I am looking for a panel plugin for Jquery.
>
> I need to build a page with panels like that http://diogobaeder.com.br/ and 
> like the one we see in htp://google.com/ig
>
> Is there anybody who knows a good jquery plugin for doing that?
>
>  (I tried Jquery Dashboard plugin, but it is JSon based, I need to use 
> LOAD() to load the content for each panel)
>
>
> --
> Bruno Rocha
> http://about.me/rochacbruno/bio
>


[web2py] Re: Janrain Basic limited to 2500 users

2011-01-18 Thread Plumo
I find that after a webpage loads the Janrain login takes up to 5 seconds to 
display, which is confusing. That is a deal breaker for me.

[web2py] Re: Can any help me with new dal in trunk?

2011-01-18 Thread drayco
Hi, When we have available that change?

And Can you give us a little example?

Because, I'm testing my application on the trunk version and I keep
getting the same error.

On Jan 8, 4:40 pm, Massimo Di Pierro 
wrote:
> We should have a flag to change this behavior DAL(...,lowercase=True).
> I would take a patch.
>
> On Jan 8, 2:58 pm, Thadeus Burgess  wrote:
>
> >  All I know is that tables are issued as lowercase, but you can still access
> > your table as an uppercase attribute.
>
> > There is an inconsistency in the DAL somewhere because of this... Somewhere
> > it is forgetting to convert to lower case. I don't know why converting table
> > names to lower case is forced in web2py and I disagree with it.
>
> > for example:
>
> > db = DAL()
> > db.define_table('TableA', Field('Superman'))
> > # CREATE TABLE tablea WITH FIELDS superman
> > db(db.TableA.Superman == "clark").select().first().Superman
> > # SELECT * FROM tablea WHERE superman="clark"
>
> > --
> > Thadeus
>
> > On Sat, Jan 8, 2011 at 1:17 AM, mart  wrote:
> > > really? I didn't know, thanks for pointing that out...
>
> > > just out of curiosity
>
> > > in
>
> > > in __getitem__
> > >    return dict.__getitem__(self, str(key))
> > > KeyError: 'tecnogradua'
>
> > > don't the attribute lookups get done by python ultimately?  Just
> > > trying to understand...
> > > how could this have worked if doing x.__getitem__ ? Even if dal does a
> > > string.lower() or something, once the table is named and created,
> > > would something (outside of migrate) not catch that error and set off
> > > the alarm even before any change need to happen?
>
> > > Thanks,
> > > Mart :)
>
> > > On Jan 8, 1:44 am, Thadeus Burgess  wrote:
> > > > I can also confirm this is a bug with the new DAL.
>
> > > > It is only caused when using upper case characters in the table or field
> > > > names. It seems that web2py converts all of the tablenames to lower case
> > > > when issuing the SQL (so your actual tables are lower regardless of what
> > > you
> > > > specify in the python). There is something in the migrations that cause
> > > this
> > > > to come up, because it will work just fine one run and crash on another
> > > run
> > > > after changing some unrelated tables.
>
> > > > I don't think the DAL should force the tables to lowercase.
>
> > > > --
> > > > Thadeus
>
> > > > On Sat, Jan 8, 2011 at 12:38 AM, mart  wrote:
> > > > > no, this is python...
>
> > > > > not sure how it could have worked before, but the key (technogradua)
> > > > > in .keys() is not being picked up... dal is simply pointing that out
> > > > > with the exception being thrown. I did notice when I made the switch
> > > > > that a few more of my mistakes got picked up (or it could be that I
> > > > > forgot that I changed something), but regardless... since switching to
> > > > > the latest DAL release and fixing my mistakes that it quickly picked
> > > > > up, I have had no problems (except those that I cause). I would simply
> > > > > take those exceptions for cash, change the case and enjoy one less
> > > > > exception ;)
>
> > > > > Mart :)
>
> > > > > On Jan 8, 1:19 am, drayco  wrote:
> > > > > > Ok, I understand your point.
>
> > > > > > But this is a issue of DAL or what?
>
> > > > > > because I only update web2py to trunk version
>
> > > > > > On Jan 8, 12:15 am, mart  wrote:
>
> > > > > > > Probably just being unhappy with the case :)
>
> > > > > > > tecnoGradua != tecnogradua
>
> > > > > > > Mart :)
>
> > > > > > > Field("tecnoGradua", 'string',
>
> > > > > > > On Jan 8, 12:57 am, drayco  wrote:
>
> > > > > > > > Hi, this code works with web2py 1.89.5 with mysql
>
> > > > > > > > but with web2py in trunk and mysql it dosent works.
>
> > > > > > > > db.define_table("lentes",
> > > > > > > >     audit,
> > > > > > > >     Field("tecnoGradua", 'string',
>
> > > requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label="Num.
> > > > > > > > de Graduaciones"),
> > > > > > > >     Field("material", "string", requires=IS_IN_SET(['MICA
> > > > > CR-39','ORMA
> > > > > > > > 1.50','HIGH INDEX','THIN & LITE 1.67
> > > > > > > > ASFÉRICA','POLICARBONATO','CRISTAL'])),
> > > > > > > >     Field("tipo", "string",requires=IS_NULL_OR(IS_IN_SET(['FLAT
> > > > > > > > TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX 
> > > > > > > > COMFORT
> > > > > > > > NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT
> > > SHORT']))),
> > > > > > > >     Field("tecnoVisual",
>
> > > 'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label=
> > > > > "Tecnologia
> > > > > > > > de Visualización"),
> > > > > > > >     Field("tratamiento",
> > > "string",requires=IS_NULL_OR(IS_IN_SET(['CON
> > > > > > > > ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))),
> > > > > > > >     Field('limitup','double', writable=False, readable=False),
> > > > > > > >     Field('limitdown','double', writable=False, readable=False),
> > > > > > > >     Field("promo", "double",
> > > r

[web2py] Re: form / subform / adding row (field)...

2011-01-18 Thread Richard Vézina
I forgot to paste :

def register():
form=SQLFORM.factory(db.client, db.address, formstyle = 'divs') #,
table_name='dummy_name')
if form.accepts(request.vars):
id = db.client.insert(**db.client._filter_fields(form.vars))
form.vars.client=id
id = db.address.insert(**db.address._filter_fields(form.vars))
response.flash='Thanks for filling the form'
return dict(form=form)

What to do for what in red?

I think _filter_fields is the key of the problem...

I didn't have a look to it actually...

Richard


On Tue, Jan 18, 2011 at 7:00 PM, Richard Vézina  wrote:

> Hello Massimo,
>
> I am trying to insert data in 2 tables from one form... I would like to be
> able to insert any number of rows or records in the subtable.
>
> I build this test app (see attach)... All the work I did is mostly in
> /default/register.html where there is jQuery script that allow adding new
> city input and delete new city input...
>
> I built it from scratch for Web2py inspired by :
> http://charlie.griefer.com/blog/index.cfm/2009/9/17/jQuery--Dynamically-Adding-Form-Elements
>
> What should I do in register to allow the function to insert all the filled
> city clone field??
>
> Next step will be adapted my script that it manage all the subform columns
> instead of only one.
>
> Thanks.
>
> Richard
>


[web2py] Re: Using mysqldb instead of pymysql

2011-01-18 Thread drayco
Hi, I do this revert, thank's

try:
import MySQLdb
drivers.append('MySQL')
except ImportError:
logger.debug('no MySQLdb driver')

And

self.pool_connection(lambda db=db,
 user=credential_decoder(user),
 password=credential_decoder(password),
 host=host,
 port=port,
 charset=charset:
MySQLdb.Connection(db=db,
 
user=user,
 
passwd=password,
 
host=host,
 
port=port,
 
charset=charset,
  ))
In dal.py
However, the error is still appear

Traceback (most recent call last):
  File "/home/drayco/web2py/gluon/restricted.py", line 188, in
restricted
exec ccode in environment
  File "/home/drayco/web2py/applications/iscada/models/cfedb.py", line
16, in 
migrate = False)
  File "/home/drayco/web2py/gluon/dal.py", line 3457, in define_table
sequence_name=sequence_name))
  File "/home/drayco/web2py/gluon/dal.py", line 3741, in __init__
"primarykey must be a list of fields from table '%s " % tablename
SyntaxError: primarykey must be a list of fields from table
'med_dnpmst_4

Well I think this is a problem with compatibility.

Do you have any suggestions?

On Jan 14, 6:36 pm, Luther Goh Lu Feng  wrote:
> To test if the issue is with pymysql, you could edit the dal file to
> use mysqldb
>
> http://code.google.com/p/web2py/source/diff?spec=svnfc75444ca55590835...
>
> On Jan 13, 11:31 am, drayco  wrote:
>
> > I need that some of you guys check this, in my case, Pymysql have some
> > issues with legacy databases (First, I think this issue is of new dal,
> > but I'm not sure)
> > However mysqldb, my application work well
>
> > this is my report:
>
> >http://groups.google.com/group/web2py/browse_thread/thread/72e91e281e...
>
> > On Jan 12, 11:46 am, Vasile Ermicioi  wrote:
>
> > > hi,
>
> > > Massimo, there is a new  version of pymysql
>
> > > I think pymysql has a few advantages
> > > - being pure Python, PyMySQL is easily patched by gevent and the likes to
> > > make it cooperative
>
> > >http://code.google.com/p/pymysql/wiki/WhyPyMySQL
>
> > > I use it with web2py and works fine
>
>


[web2py] [off-topic] - Jquery Panels/dashboard Plugin

2011-01-18 Thread Bruno Rocha
Hi,

I am looking for a panel plugin for Jquery.

I need to build a page with panels like that http://diogobaeder.com.br/ and
like the one we see in htp://google.com/ig

Is there anybody who knows a good jquery plugin for doing that?

 (I tried Jquery Dashboard plugin, but it is JSon based, I need to use
LOAD() to load the content for each panel)


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


[web2py] Re: rows.find doesn't find anything

2011-01-18 Thread Massimo Di Pierro
The DAL should throw an exception in this case. I will add a check.

On Jan 18, 4:49 pm, Lorin Rivers  wrote:
> Right!
>
> Hey, it might be good to have an example in The Book that uses a different 
> construction than the one I mistakenly tried to use.
>
> On Jan 18, 2011, at 15:30 , Massimo Di Pierro wrote:
>
>
>
>
>
>
>
>
>
>
>
> >    for row in semaphore_rows.find(lambda row:
> > row.table_name[0]=='data_table'):
> >        print row
>
> > should be
>
> >    for row in semaphore_rows.find(lambda row:
> > row.table_name=='data_table'):
> >        print row
>
> > else you compare only the first char with 'date_table'
>
> > On Jan 18, 1:05 pm, Lorin Rivers  wrote:
> >>     semaphore_query = db4.rollup_semaphore.id > 0
> >>     semaphore_set = db4(semaphore_query)
> >>     semaphore_rows = semaphore_set.select()
> >>     for row in semaphore_rows.find(lambda row: 
> >> row.table_name[0]=='data_table'):
> >>         print row
>
> >> returns nothing. While:
> >>     print db4(db4.rollup_semaphore.table_name=='data_table').select()
>
> >> Returns:
> >> rollup_semaphore.id,rollup_semaphore.table_name,rollup_semaphore.rollup_sta
> >>  tus
> >> 1,data_table,False
>
> >> Which is what I expect the first to return.
>
> >> What am I doing wrong?
>
> >> --
> >> Lorin Rivers
> >> Mosasaur: Killer Technical Marketing 
> >> 
> >> 512/203.3198 (m)
>
> --
> Lorin Rivers
> Mosasaur: Killer Technical Marketing 
> 
> 512/203.3198 (m)


Re: [web2py] Re: rows.find doesn't find anything

2011-01-18 Thread Lorin Rivers
Right!

Hey, it might be good to have an example in The Book that uses a different 
construction than the one I mistakenly tried to use.


On Jan 18, 2011, at 15:30 , Massimo Di Pierro wrote:

> 
>for row in semaphore_rows.find(lambda row:
> row.table_name[0]=='data_table'):
>print row
> 
> should be
> 
>for row in semaphore_rows.find(lambda row:
> row.table_name=='data_table'):
>print row
> 
> else you compare only the first char with 'date_table'
> 
> On Jan 18, 1:05 pm, Lorin Rivers  wrote:
>> semaphore_query = db4.rollup_semaphore.id > 0
>> semaphore_set = db4(semaphore_query)
>> semaphore_rows = semaphore_set.select()
>> for row in semaphore_rows.find(lambda row: 
>> row.table_name[0]=='data_table'):
>> print row
>> 
>> returns nothing. While:
>> print db4(db4.rollup_semaphore.table_name=='data_table').select()
>> 
>> Returns:
>> rollup_semaphore.id,rollup_semaphore.table_name,rollup_semaphore.rollup_sta 
>> tus
>> 1,data_table,False
>> 
>> Which is what I expect the first to return.
>> 
>> What am I doing wrong?
>> 
>> --
>> Lorin Rivers
>> Mosasaur: Killer Technical Marketing 
>> 
>> 512/203.3198 (m)

-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing 

512/203.3198 (m)




[web2py] Re: reply-to setting in Mail()

2011-01-18 Thread Anthony
On Tuesday, January 18, 2011 4:55:29 PM UTC-5, cjrh wrote: 
>
> On Jan 18, 7:37 pm, blackthorne  wrote: 
> > Maybe, this should be documented in the book. 
>
> Done.  I included it in the example, but I also added a description of 
> the full signature of the mail.send() command.  I am hesitant to do 
> too much of that, because the docs inside the source code should 
> contain the details of all the settings, whereas the book should 
> contain many examples and overviews of design patterns and framework 
> workflow.

 
Then we should make it as easy as possible for users to find what they need 
in the source code. Luckily, it appears that Jonathan is now on the case (
https://groups.google.com/d/topic/web2py/6cP4LZMzmQE/discussion). Maybe we 
should also provide more prominent links to the Epydoc contents (maybe from 
the book and/or the admin interface). Also, rather than label it "Epydoc" 
(which is actually the name of the tool used to generate it), maybe call it 
something more descriptive, like "API Documentation" or "Source Code 
Documentation".
 
Anthony
 


[web2py] Re: Use the source, Luca

2011-01-18 Thread Anthony
 This is great. Personally, I find this kind of thing very helpful.
 
I like the idea of having this stuff in one central location, though it 
would also be helpful if the online book chapters (or even sections within 
chapters) could link to the relevant parts.
 
Thanks.
 
Anthony

On Tuesday, January 18, 2011 3:15:18 PM UTC-5, Jonathan Lundell wrote:

> I've been working a little on a proposal for some new cookbook sections, 
> one per chapter, that provide a roadmap to the web2py source that's relevant 
> to the chapter. 
>
> My motivation, mentioned below in the Introduction section, is that the 
> full-stack nature of web2py is one of its important features, and can be 
> used to advantage by developers. But the source is intimidating for 
> newcomers, and even for experienced web2py developer's, it's not alway 
> obvious where one should be looking.
>
> US cookbooks often have a chapter or two that talk about ingredients and 
> techniques rather than recipes per se; the standard cookbook *Joy of 
> Cooking* calls this chapter "Know Your Ingredients", and I've borrowed the 
> name. My tentative decision is to distribute this material across the 
> existing chapters, as the last section in each chapter. However, and 
> argument could be made for making it a separate chapter. I'm ambivalent on 
> the question.
>
> If you guys are agreeable, I'll proceed with the idea. Below are an 
> introduction and the Use the Source section for Chapter 1.
>
>
>
>  *K**NOW** Y**OUR** I**NGREDIENTS*
>
> *Introduction*
>
> One of the less visible features of web2py is that it’s a fully integrated 
> framework with a compact and readable source that’s part of your 
> installation. When you have a question that isn’t answered in the web2py 
> book, and isn’t directly addressed by one of these recipes, the answer can 
> generally be found in the source.
>
> Each chapter in this book concludes with a *Know Your Ingredients*section, 
> that serves as a guide to the portions of the source that make up 
> the subject matter of the chapter. These sections are not detailed 
> descriptions of the source, but are rather high-level roadmaps to assist 
> your own navigation.
>
> *Installation and Deployment*
>
> Every incoming request to web2py is sent from the web server to 
> gluon.main.wsgibase, which, as the name suggests, supports the WSGI 
> application API. The means by which the request gets from the server to 
> wsgibase is a function of the kind of deployment being used. Different paths 
> require different startup or handler files by which web2py is run.
>
> We can divide the deployment methods into three categories:
>
>1. CGI deployment requires web2py to be run as a new process for each 
>request. The CGI handler is cgihandler, which uses the wsgiref module’s 
>CGIHandler to pass the request to wsgibase. This is a pattern that you’ll 
>see repeated in many of the handlers: an API such as CGI is translated to 
> a 
>WSGI call and sent to wsgibase. The Google App Engine is CGI-like, in that 
>web2py runs once for each request. GAE is configured via app.yaml to run 
>gaehandler, which in turn uses standard Google libraries to configure the 
>environment before invoking CGIHandler.py, or else running wsgiref 
> directly 
>if logging is enabled. Notice the configuration parameters near the 
>beginning of gaehandler, and the environment variable SERVER_SOFTWARE a 
>little farther on. 
>2. web2py includes Rocket, a built-in pure-Python WSGI-compatible 
>server that can directly handle web server duties, or act as the back-end 
>server for a proxy such as Apache’s mod_proxy. When using Rocket, web2py 
> is 
>started with the web2py.py script, which simply calls gluon.widget.start 
> to 
>handle command-line options and optionally present the operator with a 
>minimal Tk GUI. Once running, Rocket receives HTTP requests and passes 
> them 
>to Rocket. See gluon.main.HttpServer for the invocation of Rocket. 
>3. Finally, web2py can run continuously and field requests from an 
>external web server though the WSGI API (wsgihandler), the FastCGI API 
>(fcgihandler) or mod_python (modpythonhandler). The WSGI handler is the 
>simplest, because web2py is a native WSGI application. modpythonhandler 
>wraps a mod_python interface around the call to wsgibase with help from 
>mod_python.apache, while fcgihandler uses gluon.contrib.gateways.fcgi, a 
>contributed module, to convert from FastCGI to WSGI, eventually calling 
>wsgibase.
>
> But wait, there’s one more. A recent addition to web2py, the anyserver 
> script, inspired by Bottle’s similar functionality, supports a long list of 
> web servers—just about any server that supports the WSGI API. The list is 
> too long to repeat here, but if you have a favorite server you’d prefer to 
> use, be sure to browse anyserver to see if it’s on the list.
>
> *Installation & Startup Scripts*
>
> 

Re: [web2py] Re: Use the source, Luca

2011-01-18 Thread Offray Vladimir Luna Cárdenas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

El 18/01/11 16:12, Jonathan Lundell escribió:
> I could also be persuaded that the cookbook should have a briefer section on 
> source browsing--just pointers to where to look--and the more detailed 
> roadmap should be a more dynamic online document.
> 
> That way it'd be easier to keep the source roadmap up to date (and add new 
> material), and the roadmap itself wouldn't get tied up in the book's 
> copyright.
> 
> 

I like most this option. As a newbie, I find your contribution to
documentation really valuable and a good reading once I get more
understanding about the basics.

Cheers,

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

iQEcBAEBAgAGBQJNNhOTAAoJEGiex2828ICw0AYH/3MxvfFXmRrWARsn8J92hLn4
hXYQa37z5//JN9102IAcXY47ELiwDdxvGQhxOmfD/ZdiogAdq0kDpBjLcrqerUfS
8QzeMX6vRzz84alp3EUv7t60WQ/ejRhaQTzxrLM6exxPtBSPmwtRRYts5uIfwcPa
Kk/lAIIfNBXECV5cTb0jK5Vs8Ve8YnEgDpM/K0bAgPW3ekQGfZYd8VCpCIy4T6gP
+j/lhna+7lzkKMeqy4YOcbUJu7cFPNYuUJsMibt+gcGX08EPrfQUz/EtGxzr4VUo
9iAJFq/zkwy3WJhi3WwLMbHMGnFaCUvWpZwYiDwjcSA+hCFflyGA7lGAQuTvAHQ=
=JrPI
-END PGP SIGNATURE-


Re: [web2py] Re: DRY conception

2011-01-18 Thread Jonathan Lundell
On Jan 18, 2011, at 1:59 PM, walter wrote:
> 
>> but the problem is that you have two controllers. Perhaps you should have 
>> only one.
> 
> I have thought about it. Unfortunately, I need sometimes show all our
> customers but at the next time I need view all them trips. I would be
> glad to do merge two controllers into the one. But I cannot figure out
> how to determine which of the tables need use in that, or otherwise
> case?

One way:

http://app/default/show/tablename

...where show is the function, and tablename is args[0]. That is, make the 
function the action you're requesting, and the argument(s) the object you're 
going to do it to.


Or go ahead and repeat yourself; it's only a venial sin.

Re: [web2py] Re: DRY conception

2011-01-18 Thread Bruno Rocha
def sections():
allowedtables = ['table1','table2']
tablename = request.args(0)
if tablename in allowedtables:
rows = db(db[tablename]).select()
else:
rows = 'You can't access this table'

return dict(rows=rows)


http://myapp/default/sections/

Is that?


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


2011/1/18 walter 

> > but the problem is that you have two controllers. Perhaps you should have
> only one.
>
> I have thought about it. Unfortunately, I need sometimes show all our
> customers but at the next time I need view all them trips. I would be
> glad to do merge two controllers into the one. But I cannot figure out
> how to determine which of the tables need use in that, or otherwise
> case?


[web2py] Re: Long-running controllers

2011-01-18 Thread cjrh
On Jan 18, 5:39 pm, ae  wrote:
> How do people deal with controller functions that take a long time?

1) If you must do something that takes time, start it as a separate
process, and that process toggles a flag that says the job is
complete.  The user can be notified of the completion via email.  This
is only really worthwhile for longer jobs, say of the order of 5
minutes and longer.

2) If you must do something that takes time, but not so much time that
asking the user to go away and come back later would seem overkill,
then use an ajax function to poll the job status.  Yes, it is
laborious.  No, there isn't another way, unless that other way is to
use a library that simplifies doing this exact thing.

> In the past, I've handed requests off to another server (written on
> Twisted) and had javascript poll for status, but this is a bit
> laborious.

I suggest you present some code to this group that shows how laborious
it is, and ask for simplifications.  I am not a javascript guru, but
some do lurk here and that would be the best way to make it less
laborious.  web2py itself does have some helpers that make setting up
the javascript a little easier, such as the URL function and whatnot.
There may be more tricks that we could learn.


[web2py] Re: DRY conception

2011-01-18 Thread walter
> but the problem is that you have two controllers. Perhaps you should have 
> only one.

I have thought about it. Unfortunately, I need sometimes show all our
customers but at the next time I need view all them trips. I would be
glad to do merge two controllers into the one. But I cannot figure out
how to determine which of the tables need use in that, or otherwise
case?


[web2py] Re: Keys and GAE

2011-01-18 Thread Matt
Hi cfn,

Yes your suggestion would be preferable (and more workable).

This would be a great addition to the GAE support included with
web2py.

Matt

On Jan 14, 6:39 pm, howesc  wrote:
> Matt,
>
> given the arbitrary depth of the keys, perhaps it would be better to have
> the user construct the key, and then have some form of operator to indicate
> that you desire to run a key query?
>
> what are your thoughts on that?  would that be better or worse from your
> perspective?
>
> cfh


[web2py] Re: reply-to setting in Mail()

2011-01-18 Thread cjrh
On Jan 18, 7:37 pm, blackthorne  wrote:
> Maybe, this should be documented in the book.

Done.  I included it in the example, but I also added a description of
the full signature of the mail.send() command.  I am hesitant to do
too much of that, because the docs inside the source code should
contain the details of all the settings, whereas the book should
contain many examples and overviews of design patterns and framework
workflow.  At least, that's in my personal opinion, which has nothing
to do with anyone else's views and shouldn't be misconstrued as "the
webpy view" whatever that might mean.


Re: [web2py] Re: Url for References in the Spanish book

2011-01-18 Thread Offray Vladimir Luna Cárdenas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

Thanks Anthony and Kenneth for your answers. There is any way to
integrate the human translation of Latinux instead of the automatic
google translated one in the website of the book?

Cheers,

Offray

El 18/01/11 14:22, Anthony escribió:
> Note, I think the Spanish (and German, French, and Russian) translations 
> available at http://web2py.com/book/ are actually automated Google Translate 
> translations (via plugin_translate). I think the Spanish translation at 
> http://www.latinuxpress.com/books/drafts/web2py/index.html, on the other 
> hand, is actually a human translation (at least, it's not the same as the 
> Google Translate version), so probably preferable to the version at 
> web2py.com.
>  
> Anthony
> 
> On Tuesday, January 18, 2011 1:43:05 PM UTC-5, Offray Vladimir Luna Cárdenas 
> wrote:
> 
> Hi.
> 
> I would like to share some thought of web2py introduction via identi.ca.
> Quote something and add the short url of the on-line Book, Spanish
> edition. There is one Spanish version hosted by Latinux-Press but is not
> so nicely formated like the one you get when you enter o
> http://web2py.com/book and select "Spanish" from the drop down language
> menu. But when I made this, I don't get any change in the url showning
> the language, so, may be if I share the url via microblogs people will
> get the English version. There is any way to indicate the language in
> the url of the online book edition?
> 
> Cheers,
> 
> Offray
>>
>>

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

iQEcBAEBAgAGBQJNNgtyAAoJEGiex2828ICw+hIIAItM9bAIr1eDKZdtok/KV3EV
8UlK2YTMHR43kkNAfAY7cjRZVuKwZwP3Bj8p6AeaBlJx3ZiK6sIclIwaeXAIs6/W
xO6wU3ayb7qU9ExvYtKryyueRzwRgmzjhZFVZsit7xs63hQIoFNnljjOLq+cRWoN
ZIByuV058Hn8xi0u5JtUtrhATqplp/PELkKRYzkdl7LpVCOJ+7kZgNwjbTdWGYCJ
wxX8CwJT4rWc/2XFbQ5gEGPwMdH3gG1PnliZ4nx+4uk7xeOA07vtfipEqlKvVTJ3
XVioX5hP7S6SNMSo/7ul0szKnkptJogoaWPIL5flks8mOgZ5KY2RoGElAj1sQDw=
=vF4+
-END PGP SIGNATURE-


[web2py] Re: Unable to compile application with dynamic {{include ...}} directives

2011-01-18 Thread Massimo Di Pierro
Ok but this is slow.

On Jan 18, 3:05 pm, "anton.mue...@googlemail.com"
 wrote:
> On Jan 18, 8:57 am, cjrh  wrote:
>
>
>
>
>
>
>
>
>
> > On Jan 18, 2:13 am, Massimo Di Pierro 
> > wrote:
>
> > > this is not possible because includes and extends must be resolved
> > > before compilation, not at runtime
>
> > I have been thinking about this for a while.  In principle, it should
> > be possible to have the compiled version be able to read, at runtime,
> > the script to be included.  It really just means that the code works a
> > little differently, e.g. a regular python app that either has the name
> > of a data file hard-coded into source which then ends up inside the
> > pyc, compared to a slightly modified python app that has code to read
> > the name of the data file as a run-time input, in which case the name
> > of the data file is not included statically inside the pyc.
>
> > ...
>
> Thank you for your comments!
>
> For now the following workaround in the layout.html view allows for
> compilation and still fulfills the function that I wanted, but it
> feels a little bulky...
>
> {{if session.language!=None:}}
>         {{#need this construct for precompiling the app}}
>         {{if session.language == 'DE':}}
>                 {{include 'pageheader_DE.html'}}
>         {{elif ...:}}
>                 {{...}}
>         {{else:}}
>                 {{include 'pageheader_EN.html'}}
>         {{pass}}
> {{else:}}
>         {{if session.preferredLanguage == 'DE':}}
>                 {{include 'pageheader_DE.html'}}
>         {{elif ...:}}
>                 {{...}}
>         {{else:}}
>                 {{include 'pageheader_EN.html'}}
>         {{pass}}
> {{pass}}


[web2py] Re: DRY conception

2011-01-18 Thread Massimo Di Pierro
from a coding point of view

tablename=request.controller
rows = db(db[tablename]).select()
return dict(rows=rows)

but the problem is that you have two controllers. Perhaps you should
have only one.

On Jan 18, 2:59 pm, walter  wrote:
> I have two controllers which differ only a database table title. For
> example:
>
> default/persons/index
>     persons = db(db.person).select()
>     return dict(persons=persons)
>
> default/trips/index
>     trips = db(db.trip).select()
>     return dict(trips=trips)
>
> How implement DRY conception in this case? I think I need create an
> additional class and pass a table name to this class. All work must to
> be done in this class and a result should return to the corresponding
> method. But it only my opinion. How to do it right?


[web2py] Re: Dynamic Defaults, if that makes any sences...

2011-01-18 Thread Massimo Di Pierro
db.define_table('page',
 Field('page_name', 'string'),
 Field('url_name', 'string'),#Basically it takes the page name
and replaces spaces with _
 Field('conference_id',
'integer',writable=False,readable=False),
 Field('contents', 'text'),
 Field('creator', 'integer')
 )
#CONTROLLER
db.page.conference_id.default=session.conference_id
page_form = SQLFORM(db.page)



[web2py] Re: reply-to setting in Mail()

2011-01-18 Thread Massimo Di Pierro
You can post them on googlecode but it easier to plea one of the book
editors to fix it. ;-)

On Jan 18, 1:16 pm, pbreit  wrote:
> What's the best way to file doc bugs? reply-to should certainly be
> documented in the book. And mail should probably be covered elsewhere in the
> book. Access Control was not where I expected it to be discussed.


[web2py] Re: rows.find doesn't find anything

2011-01-18 Thread Massimo Di Pierro

for row in semaphore_rows.find(lambda row:
row.table_name[0]=='data_table'):
print row

should be

for row in semaphore_rows.find(lambda row:
row.table_name=='data_table'):
print row

else you compare only the first char with 'date_table'

On Jan 18, 1:05 pm, Lorin Rivers  wrote:
>     semaphore_query = db4.rollup_semaphore.id > 0
>     semaphore_set = db4(semaphore_query)
>     semaphore_rows = semaphore_set.select()
>     for row in semaphore_rows.find(lambda row: 
> row.table_name[0]=='data_table'):
>         print row
>
> returns nothing. While:
>     print db4(db4.rollup_semaphore.table_name=='data_table').select()
>
> Returns:
> rollup_semaphore.id,rollup_semaphore.table_name,rollup_semaphore.rollup_sta 
> tus
> 1,data_table,False
>
> Which is what I expect the first to return.
>
> What am I doing wrong?
>
> --
> Lorin Rivers
> Mosasaur: Killer Technical Marketing 
> 
> 512/203.3198 (m)


[web2py] Re: Bug? SQLFORM.factory and SQLFORM differ in handling of hidden form fields

2011-01-18 Thread Massimo Di Pierro
This is a bug. Would you please post your bug report email on
googlecode? I will fix it asap.

On Jan 18, 12:23 pm, Nathan VanHoudnos  wrote:
> Hi,
>
> A minimal example:
>     likertRightAnswer = ['Yes', 'No', 'Impossible to tell']
>
>     form = SQLFORM.factory(
>         Field('rightAnswer',
>               widget=horizontal_radios,
>               requires=IS_IN_SET(likertRightAnswer,
>                                  error_message=T('Please choose a
> response.'))),
>         hidden={'timestart':request.now.strftime('%Y-%m-%d %H:%M:%S')}
>         )
>
> In this case, BEAUTIFY(request.post_vars) will include, timestart and
> rightAnswer, but BEAUTIFY(form.vars) will only include rightAnswer.
>
> If we instead setup the appropriate db as db.ratings, and then do:
>     likertRightAnswer = ['Yes', 'No', 'Impossible to tell']
>
>     form = SQLFORM(db.ratings,
>         hidden={'timestart':request.now.strftime('%Y-%m-%d %H:%M:%S')}
>         )
>
> In this case, both BEAUTIFY(request.post_vars) and BEAUTIFY(form.vars) will
> both include timestart and rightAnswer.
>
> The second behavior is "more expected" at least to me.
>
> Right now, I'm using request.post_vars.timestart to access the value after
> the form.accepts call, but this feels like I'm hacking something together.
>
> And it essentially circumvents the security feature discussed in this
> thread:
>
> http://groups.google.com/group/web2py/browse_thread/thread/ab21d9d216...
>
> So is this a bug? Or should I be doing something different? (My application
> creates a bunch of little temporary forms and I don't want to bloat
> the data-store with them.)
>
> Cheers,
> --
> Nathan VanHoudnos
> |- Statistics & Public Policy PhD student
> |- Program for Interdisciplinary Education Research (PIER) Fellowship
> |- Carnegie Mellon University
> |-http://www.andrew.cmu.edu/user/nmv
>
> "Neglect of mathematics works injury to all knowledge,
>  since he who is ignorant of it cannot know the other
>  sciences or the things of this world." -- Roger Bacon


Re: [web2py] Re: Use the source, Luca

2011-01-18 Thread Jonathan Lundell
On Jan 18, 2011, at 1:09 PM, DenesL wrote:
> 
> One doubt, doesn't this sound strange:
> "Rocket receives HTTP requests and passes them to Rocket"?.

Ok, well, details...


[web2py] Re: Schema migration to GAE / Creating a Test Suite

2011-01-18 Thread howesc
Hello there,

I have written a bunch of stuff against google app engine over the past year 
and have played lots of data games.  let's see if i can provide a little 
insight.

 - first off, the CSV download functions only work while the tables are 
small (under a few thousand rows).  after that look at the google app engine 
bulkloader tools.  note that there is no automated way to download and 
restore data from the blobstore (that is on my todo list for this month 
though)
 - i don't know how you did your model, but if you just added new fields to 
existing tables then just deploy it!  no seriously, GAE gracefully will just 
add the new columns.  note that if you want to query old data using those 
columns in filters you will have to iterate through the old data and set 
defaults.
 - if you need defaults, you should consider using the taskqueue for this.  
it allows jobs to run up to 10 minutes now.  while not 100% safe i sort on 
ID and get batches of a rows at a time to work with.  (when the limit was 30 
seconds i found i could query and update about 100 rows in that time)
 - s, don't tell, but as far as i can tell the ID if autogenerated on 
GAE is unique to the database, not just the table/model, but please test my 
theory heavily before depending on it.

hopefully that helps a little.  feel free to ask more.

christian


Re: [web2py] Re: Use the source, Luca

2011-01-18 Thread Jonathan Lundell
I could also be persuaded that the cookbook should have a briefer section on 
source browsing--just pointers to where to look--and the more detailed roadmap 
should be a more dynamic online document.

That way it'd be easier to keep the source roadmap up to date (and add new 
material), and the roadmap itself wouldn't get tied up in the book's copyright.



[web2py] web2py and external editors

2011-01-18 Thread Mike Rans
Hi,

I am a web2py newbie.

I am using web2py with an external text editor. I made Pylint and
Winpdb plugins for this editor (Editra - which is written in Python)
and can successfully debug web2py from it.

The problem I have is with Pylint - web2py does some behind the scenes
importing. I don't want to turn warnings off as that defeats the
object of Pylint. I can modify the Pylint plugin to do things before
launching Pylint (and already do so with altering the PYTHONPATH), so
do you know of a way to tell Pylint about the imports web2py has
done?

Cheers,
Mike


[web2py] geo spatial GIS in web2py

2011-01-18 Thread KK
Dear all,

Can anyone comment on the level of support web2py has for geospatial 
applications in web2py.  Are there restrictions to integrating some 
geospatial code or packages in a web2py application?  Would be great if I 
could integrate mapbox or similar stuff into web2py.

Oh and can we do fancy UI in web2py, maybe using jQuery?  What about GWT 
integration, maybe using pyjamas?

Finally, since my project is going to need to present geospatial data, would 
geodjango be a better fit?  But I'm a little worried about database 
migrations with django vs web2py.  It seems like if we are going to change 
the database schema a lot web2py would be easier to work with than Django?

Thanks in advance.


[web2py] Re: Use the source, Luca

2011-01-18 Thread DenesL

Well done!.

One doubt, doesn't this sound strange:
"Rocket receives HTTP requests and passes them to Rocket"?.


On Jan 18, 3:15 pm, Jonathan Lundell  wrote:
> I've been working a little on a proposal for some new cookbook sections, one 
> per chapter, that provide a roadmap to the web2py source that's relevant to 
> the chapter.
>
> My motivation, mentioned below in the Introduction section, is that the 
> full-stack nature of web2py is one of its important features, and can be used 
> to advantage by developers. But the source is intimidating for newcomers, and 
> even for experienced web2py developer's, it's not alway obvious where one 
> should be looking.
>
> US cookbooks often have a chapter or two that talk about ingredients and 
> techniques rather than recipes per se; the standard cookbook Joy of Cooking 
> calls this chapter "Know Your Ingredients", and I've borrowed the name. My 
> tentative decision is to distribute this material across the existing 
> chapters, as the last section in each chapter. However, and argument could be 
> made for making it a separate chapter. I'm ambivalent on the question.
>
> If you guys are agreeable, I'll proceed with the idea. Below are an 
> introduction and the Use the Source section for Chapter 1.
>
> KNOW YOUR INGREDIENTS
> Introduction
> One of the less visible features of web2py is that it’s a fully integrated 
> framework with a compact and readable source that’s part of your 
> installation. When you have a question that isn’t answered in the web2py 
> book, and isn’t directly addressed by one of these recipes, the answer can 
> generally be found in the source.
> Each chapter in this book concludes with a Know Your Ingredients section, 
> that serves as a guide to the portions of the source that make up the subject 
> matter of the chapter. These sections are not detailed descriptions of the 
> source, but are rather high-level roadmaps to assist your own navigation.
> Installation and Deployment
> Every incoming request to web2py is sent from the web server to 
> gluon.main.wsgibase, which, as the name suggests, supports the WSGI 
> application API. The means by which the request gets from the server to 
> wsgibase is a function of the kind of deployment being used. Different paths 
> require different startup or handler files by which web2py is run.
> We can divide the deployment methods into three categories:
> CGI deployment requires web2py to be run as a new process for each request. 
> The CGI handler is cgihandler, which uses the wsgiref module’s CGIHandler to 
> pass the request to wsgibase. This is a pattern that you’ll see repeated in 
> many of the handlers: an API such as CGI is translated to a WSGI call and 
> sent to wsgibase. The Google App Engine is CGI-like, in that web2py runs once 
> for each request. GAE is configured via app.yaml to run gaehandler, which in 
> turn uses standard Google libraries to configure the environment before 
> invoking CGIHandler.py, or else running wsgiref directly if logging is 
> enabled. Notice the configuration parameters near the beginning of 
> gaehandler, and the environment variable SERVER_SOFTWARE a little farther on.
> web2py includes Rocket, a built-in pure-Python WSGI-compatible server that 
> can directly handle web server duties, or act as the back-end server for a 
> proxy such as Apache’s mod_proxy. When using Rocket, web2py is started with 
> the web2py.py script, which simply calls gluon.widget.start to handle 
> command-line options and optionally present the operator with a minimal Tk 
> GUI. Once running, Rocket receives HTTP requests and passes them to Rocket. 
> See gluon.main.HttpServer for the invocation of Rocket.
> Finally, web2py can run continuously and field requests from an external web 
> server though the WSGI API (wsgihandler), the FastCGI API (fcgihandler) or 
> mod_python (modpythonhandler). The WSGI handler is the simplest, because 
> web2py is a native WSGI application. modpythonhandler wraps a mod_python 
> interface around the call to wsgibase with help from mod_python.apache, while 
> fcgihandler uses gluon.contrib.gateways.fcgi, a contributed module, to 
> convert from FastCGI to WSGI, eventually calling wsgibase.
> But wait, there’s one more. A recent addition to web2py, the anyserver 
> script, inspired by Bottle’s similar functionality, supports a long list of 
> web servers—just about any server that supports the WSGI API. The list is too 
> long to repeat here, but if you have a favorite server you’d prefer to use, 
> be sure to browse anyserver to see if it’s on the list.
> Installation & Startup Scripts
> A few installation scripts can be found in the the scripts directory; look 
> for scripts named setup-*, such as setup-web2py-ubuntu.sh.
> Likewise, a few startup scripts designed for integration into a hosts 
> boot-time initialization method are found in the scripts directory: 
> web2py.archlinux.sh, web2py.fedora.sh, and web2py.ubuntu.sh.
> Dispatching a

[web2py] Re: Unable to compile application with dynamic {{include ...}} directives

2011-01-18 Thread anton.mue...@googlemail.com


On Jan 18, 8:57 am, cjrh  wrote:
> On Jan 18, 2:13 am, Massimo Di Pierro 
> wrote:
>
> > this is not possible because includes and extends must be resolved
> > before compilation, not at runtime
>
> I have been thinking about this for a while.  In principle, it should
> be possible to have the compiled version be able to read, at runtime,
> the script to be included.  It really just means that the code works a
> little differently, e.g. a regular python app that either has the name
> of a data file hard-coded into source which then ends up inside the
> pyc, compared to a slightly modified python app that has code to read
> the name of the data file as a run-time input, in which case the name
> of the data file is not included statically inside the pyc.
>
> ...

Thank you for your comments!

For now the following workaround in the layout.html view allows for
compilation and still fulfills the function that I wanted, but it
feels a little bulky...


{{if session.language!=None:}}
{{#need this construct for precompiling the app}}
{{if session.language == 'DE':}}
{{include 'pageheader_DE.html'}}
{{elif ...:}}
{{...}}
{{else:}}
{{include 'pageheader_EN.html'}}
{{pass}}
{{else:}}
{{if session.preferredLanguage == 'DE':}}
{{include 'pageheader_DE.html'}}
{{elif ...:}}
{{...}}
{{else:}}
{{include 'pageheader_EN.html'}}
{{pass}}
{{pass}}



[web2py] DRY conception

2011-01-18 Thread walter
I have two controllers which differ only a database table title. For
example:

default/persons/index
persons = db(db.person).select()
return dict(persons=persons)


default/trips/index
trips = db(db.trip).select()
return dict(trips=trips)

How implement DRY conception in this case? I think I need create an
additional class and pass a table name to this class. All work must to
be done in this class and a result should return to the corresponding
method. But it only my opinion. How to do it right?


Re: [web2py] Re: Use the source, Luca

2011-01-18 Thread Jonathan Lundell
On Jan 18, 2011, at 12:41 PM, pbreit wrote:
> Probably any additional documentation is a "good thing". I personally like 
> more practical information. My favorite framework documentation is probably 
> CodeIgniter.

Using the source is definitely a backup option, when the books and other docs 
don't work.

But using the source is particularly useful for web2py, for both a negative and 
a positive reason. 

The negative reason is that there's quite a bit of web2py that simply isn't 
fully documented anywhere: the source (or asking on the list) is sometimes the 
only place to find what you need to know.

The positive reason is that web2py is especially friendly to source inspection, 
because the source is compact and unified. It's a great resource.

Re: [web2py] Use the source, Luca

2011-01-18 Thread Kenneth Lundström
Sounds like an excellent idea. Both answers for your question sounds 
good. Would it be possible to distribute it across chapters but some how 
make it so that you can read it as an chapter. The source as to be same, 
it can't be like that you have to update two places when updating 
something.



Kenneth

I've been working a little on a proposal for some new cookbook 
sections, one per chapter, that provide a roadmap to the web2py source 
that's relevant to the chapter.


My motivation, mentioned below in the Introduction section, is that 
the full-stack nature of web2py is one of its important features, and 
can be used to advantage by developers. But the source is intimidating 
for newcomers, and even for experienced web2py developer's, it's not 
alway obvious where one should be looking.


US cookbooks often have a chapter or two that talk about ingredients 
and techniques rather than recipes per se; the standard cookbook /Joy 
of Cooking/ calls this chapter "Know Your Ingredients", and I've 
borrowed the name. My tentative decision is to distribute this 
material across the existing chapters, as the last section in each 
chapter. However, and argument could be made for making it a separate 
chapter. I'm ambivalent on the question.


If you guys are agreeable, I'll proceed with the idea. Below are an 
introduction and the Use the Source section for Chapter 1.




*K**NOW**Y**OUR**I**NGREDIENTS*

*Introduction*

One of the less visible features of web2py is that it’s a fully 
integrated framework with a compact and readable source that’s part of 
your installation. When you have a question that isn’t answered in the 
web2py book, and isn’t directly addressed by one of these recipes, the 
answer can generally be found in the source.


Each chapter in this book concludes with a /Know Your Ingredients/ 
section, that serves as a guide to the portions of the source that 
make up the subject matter of the chapter. These sections are not 
detailed descriptions of the source, but are rather high-level 
roadmaps to assist your own navigation.


*Installation and Deployment*

Every incoming request to web2py is sent from the web server to 
gluon.main.wsgibase, which, as the name suggests, supports the WSGI 
application API. The means by which the request gets from the server 
to wsgibase is a function of the kind of deployment being used. 
Different paths require different startup or handler files by which 
web2py is run.


We can divide the deployment methods into three categories:

   1. CGI deployment requires web2py to be run as a new process for
  each request. The CGI handler is cgihandler, which uses the
  wsgiref module’s CGIHandler to pass the request to wsgibase.
  This is a pattern that you’ll see repeated in many of the
  handlers: an API such as CGI is translated to a WSGI call and
  sent to wsgibase. The Google App Engine is CGI-like, in that
  web2py runs once for each request. GAE is configured via
  app.yaml to run gaehandler, which in turn uses standard Google
  libraries to configure the environment before invoking
  CGIHandler.py, or else running wsgiref directly if logging is
  enabled. Notice the configuration parameters near the beginning
  of gaehandler, and the environment variable SERVER_SOFTWARE a
  little farther on.
   2. web2py includes Rocket, a built-in pure-Python WSGI-compatible
  server that can directly handle web server duties, or act as the
  back-end server for a proxy such as Apache’s mod_proxy. When
  using Rocket, web2py is started with the web2py.py script, which
  simply calls gluon.widget.start to handle command-line options
  and optionally present the operator with a minimal Tk GUI. Once
  running, Rocket receives HTTP requests and passes them to
  Rocket. See gluon.main.HttpServer for the invocation of Rocket.
   3. Finally, web2py can run continuously and field requests from an
  external web server though the WSGI API (wsgihandler), the
  FastCGI API (fcgihandler) or mod_python (modpythonhandler). The
  WSGI handler is the simplest, because web2py is a native WSGI
  application. modpythonhandler wraps a mod_python interface
  around the call to wsgibase with help from mod_python.apache,
  while fcgihandler uses gluon.contrib.gateways.fcgi, a
  contributed module, to convert from FastCGI to WSGI, eventually
  calling wsgibase.

But wait, there’s one more. A recent addition to web2py, the anyserver 
script, inspired by Bottle’s similar functionality, supports a long 
list of web servers—just about any server that supports the WSGI API. 
The list is too long to repeat here, but if you have a favorite server 
you’d prefer to use, be sure to browse anyserver to see if it’s on the 
list.


*Installation & Startup Scripts*

A few installation scripts can be found in the the scripts directory; 
look for scripts named setup-*, such as setup-web2py-ubuntu.sh.


Likew

[web2py] Re: Use the source, Luca

2011-01-18 Thread pbreit
Probably any additional documentation is a "good thing". I personally like 
more practical information. My favorite framework documentation is probably 
CodeIgniter.

[web2py] Re: Dynamic Defaults, if that makes any sences...

2011-01-18 Thread dederocks
If I'm not off track, something like:

session.conference_id = form.vars.[fieldx] ?

Or the other way around, but then you need to use SQLFORM.factory, I
guess, and handle yourself the db insertion/update (see example in the
book §7.3, or better this link: 
http://groups.google.com/group/web2py/browse_thread/thread/cb560f5fddec2d07

On 18 jan, 19:50, Jason Brower  wrote:
> I am not so great with forms, but how do I set a particular value when
> they have completed the form...
>
> 
> #MODEL
> db.define_table('page',
>          Field('page_name', 'string'),
>          Field('url_name', 'string'),#Basically it takes the page name and 
> replaces spaces with _
>          Field('conference_id', 'integer'),
>          Field('contents', 'text'),
>          Field('creator', 'integer')
>          )
> #CONTROLLER
> page_form = SQLFORM(db.page)
> 
>
> And I want to set a field that is hidden in this form to
> session.conference_id.
> 
> Best Regards,
> Jason Brower


[web2py] Use the source, Luca

2011-01-18 Thread Jonathan Lundell
I've been working a little on a proposal for some new cookbook sections, one 
per chapter, that provide a roadmap to the web2py source that's relevant to the 
chapter.

My motivation, mentioned below in the Introduction section, is that the 
full-stack nature of web2py is one of its important features, and can be used 
to advantage by developers. But the source is intimidating for newcomers, and 
even for experienced web2py developer's, it's not alway obvious where one 
should be looking.

US cookbooks often have a chapter or two that talk about ingredients and 
techniques rather than recipes per se; the standard cookbook Joy of Cooking 
calls this chapter "Know Your Ingredients", and I've borrowed the name. My 
tentative decision is to distribute this material across the existing chapters, 
as the last section in each chapter. However, and argument could be made for 
making it a separate chapter. I'm ambivalent on the question.

If you guys are agreeable, I'll proceed with the idea. Below are an 
introduction and the Use the Source section for Chapter 1.



KNOW YOUR INGREDIENTS
Introduction
One of the less visible features of web2py is that it’s a fully integrated 
framework with a compact and readable source that’s part of your installation. 
When you have a question that isn’t answered in the web2py book, and isn’t 
directly addressed by one of these recipes, the answer can generally be found 
in the source.
Each chapter in this book concludes with a Know Your Ingredients section, that 
serves as a guide to the portions of the source that make up the subject matter 
of the chapter. These sections are not detailed descriptions of the source, but 
are rather high-level roadmaps to assist your own navigation.
Installation and Deployment
Every incoming request to web2py is sent from the web server to 
gluon.main.wsgibase, which, as the name suggests, supports the WSGI application 
API. The means by which the request gets from the server to wsgibase is a 
function of the kind of deployment being used. Different paths require 
different startup or handler files by which web2py is run.
We can divide the deployment methods into three categories:
CGI deployment requires web2py to be run as a new process for each request. The 
CGI handler is cgihandler, which uses the wsgiref module’s CGIHandler to pass 
the request to wsgibase. This is a pattern that you’ll see repeated in many of 
the handlers: an API such as CGI is translated to a WSGI call and sent to 
wsgibase. The Google App Engine is CGI-like, in that web2py runs once for each 
request. GAE is configured via app.yaml to run gaehandler, which in turn uses 
standard Google libraries to configure the environment before invoking 
CGIHandler.py, or else running wsgiref directly if logging is enabled. Notice 
the configuration parameters near the beginning of gaehandler, and the 
environment variable SERVER_SOFTWARE a little farther on.
web2py includes Rocket, a built-in pure-Python WSGI-compatible server that can 
directly handle web server duties, or act as the back-end server for a proxy 
such as Apache’s mod_proxy. When using Rocket, web2py is started with the 
web2py.py script, which simply calls gluon.widget.start to handle command-line 
options and optionally present the operator with a minimal Tk GUI. Once 
running, Rocket receives HTTP requests and passes them to Rocket. See 
gluon.main.HttpServer for the invocation of Rocket.
Finally, web2py can run continuously and field requests from an external web 
server though the WSGI API (wsgihandler), the FastCGI API (fcgihandler) or 
mod_python (modpythonhandler). The WSGI handler is the simplest, because web2py 
is a native WSGI application. modpythonhandler wraps a mod_python interface 
around the call to wsgibase with help from mod_python.apache, while fcgihandler 
uses gluon.contrib.gateways.fcgi, a contributed module, to convert from FastCGI 
to WSGI, eventually calling wsgibase.
But wait, there’s one more. A recent addition to web2py, the anyserver script, 
inspired by Bottle’s similar functionality, supports a long list of web 
servers—just about any server that supports the WSGI API. The list is too long 
to repeat here, but if you have a favorite server you’d prefer to use, be sure 
to browse anyserver to see if it’s on the list.
Installation & Startup Scripts
A few installation scripts can be found in the the scripts directory; look for 
scripts named setup-*, such as setup-web2py-ubuntu.sh.
Likewise, a few startup scripts designed for integration into a hosts boot-time 
initialization method are found in the scripts directory: web2py.archlinux.sh, 
web2py.fedora.sh, and web2py.ubuntu.sh.
Dispatching a Request
The web2py request dispatcher, gluon.main.wsgibase, is where each incoming HTTP 
request ends up once it makes its way through whichever handler is being used. 
Here’s we’ll briefly describe the top-level flow of a request.
main.wsgibase 
Initialize request-scope globals (request, response, e

[web2py] Re: account for each user

2011-01-18 Thread pbreit
I would suggest starting over from scratch and using Web2py's Access Control 
features as they come by default as much as possible. Once you are 
comfortable with how they work, you can think about customizing them.

I think your code should be something like this:

==model== 
db.define_table('day', 
   Field('thedate','date'), 
   Field('value', 'integer'))
   Field('created_by', db.auth_user, default=auth.user_id))

==controller== 
@auth.requires_login() 
def create(): 
 form = SQLFORM(db.day)
 if form.accepts(request.vars, session):
 redirect(URL('default', 'day', args=form.vars.id))
 return dict(form=form)

def day():
 day = db(db.day.id==request.args(0)).select().first()
 if day.created_by==auth.user_id
 return dict(day=day)



[web2py] Re: Url for References in the Spanish book

2011-01-18 Thread Anthony
Note, I think the Spanish (and German, French, and Russian) translations 
available at http://web2py.com/book/ are actually automated Google Translate 
translations (via plugin_translate). I think the Spanish translation at 
http://www.latinuxpress.com/books/drafts/web2py/index.html, on the other 
hand, is actually a human translation (at least, it's not the same as the 
Google Translate version), so probably preferable to the version at 
web2py.com.
 
Anthony

On Tuesday, January 18, 2011 1:43:05 PM UTC-5, Offray Vladimir Luna Cárdenas 
wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1 
>
> Hi. 
>
> I would like to share some thought of web2py introduction via identi.ca.
> Quote something and add the short url of the on-line Book, Spanish
> edition. There is one Spanish version hosted by Latinux-Press but is not
> so nicely formated like the one you get when you enter o
> http://web2py.com/book and select "Spanish" from the drop down language
> menu. But when I made this, I don't get any change in the url showning
> the language, so, may be if I share the url via microblogs people will
> get the English version. There is any way to indicate the language in
> the url of the online book edition? 
>
> Cheers, 
>
> Offray
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ 
>
> iQEcBAEBAgAGBQJNNd85AAoJEGiex2828ICwhHoH/3PB5QMhIl9V13JOqz8X/gvN
> BmeDcVWtII1O2YlUi+mdnBtuyxCgbIRwcJ/W72Swx3IhDYbQbHDvq/xMDGuzfN3l
> fMrtnf8PNA+tm8oEQ9R/9cb6O3RLTpIORn76gD2c76MsLpbpRzOeXp9hdciwOnOc
> v9aESWzM7n0aBwBwxUTaaKWg+z+F6o7os7QMNmLyMhIggJEwW/6KssKZ2RV5EZ/Z
> MHsC9U3h7hQQqQmPhrXpVThQj6V/FfkefM5+9t7/X797LMBEkcYxn3fg26rICNs5
> +hedCfYNII0EDQTyZmWdNA2fcAJUke+zTs8Dp7jRDsqBTVyaEU2P5AZ0l1v5vp4=
> =pti/
> -END PGP SIGNATURE-
>
> 

[web2py] Re: reply-to setting in Mail()

2011-01-18 Thread pbreit
What's the best way to file doc bugs? reply-to should certainly be 
documented in the book. And mail should probably be covered elsewhere in the 
book. Access Control was not where I expected it to be discussed.

Re: [web2py] Url for References in the Spanish book

2011-01-18 Thread Kenneth Lundström

If you add ?_language=es after the english URL you get the Spanish version.


Kenneth


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi.

I would like to share some thought of web2py introduction via identi.ca.
Quote something and add the short url of the on-line Book, Spanish
edition. There is one Spanish version hosted by Latinux-Press but is not
so nicely formated like the one you get when you enter o
http://web2py.com/book and select "Spanish" from the drop down language
menu. But when I made this, I don't get any change in the url showning
the language, so, may be if I share the url via microblogs people will
get the English version. There is any way to indicate the language in
the url of the online book edition?

Cheers,

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

iQEcBAEBAgAGBQJNNd85AAoJEGiex2828ICwhHoH/3PB5QMhIl9V13JOqz8X/gvN
BmeDcVWtII1O2YlUi+mdnBtuyxCgbIRwcJ/W72Swx3IhDYbQbHDvq/xMDGuzfN3l
fMrtnf8PNA+tm8oEQ9R/9cb6O3RLTpIORn76gD2c76MsLpbpRzOeXp9hdciwOnOc
v9aESWzM7n0aBwBwxUTaaKWg+z+F6o7os7QMNmLyMhIggJEwW/6KssKZ2RV5EZ/Z
MHsC9U3h7hQQqQmPhrXpVThQj6V/FfkefM5+9t7/X797LMBEkcYxn3fg26rICNs5
+hedCfYNII0EDQTyZmWdNA2fcAJUke+zTs8Dp7jRDsqBTVyaEU2P5AZ0l1v5vp4=
=pti/
-END PGP SIGNATURE-




[web2py] rows.find doesn't find anything

2011-01-18 Thread Lorin Rivers
semaphore_query = db4.rollup_semaphore.id > 0
semaphore_set = db4(semaphore_query)
semaphore_rows = semaphore_set.select()
for row in semaphore_rows.find(lambda row: row.table_name[0]=='data_table'):
print row


returns nothing. While:
print db4(db4.rollup_semaphore.table_name=='data_table').select()

Returns:
rollup_semaphore.id,rollup_semaphore.table_name,rollup_semaphore.rollup_status
1,data_table,False

Which is what I expect the first to return.

What am I doing wrong?


-- 
Lorin Rivers
Mosasaur: Killer Technical Marketing 

512/203.3198 (m)




[web2py] Dynamic Defaults, if that makes any sences...

2011-01-18 Thread Jason Brower
I am not so great with forms, but how do I set a particular value when 
they have completed the form...



#MODEL
db.define_table('page',
Field('page_name', 'string'),
Field('url_name', 'string'),#Basically it takes the page name and 
replaces spaces with _
Field('conference_id', 'integer'),
Field('contents', 'text'),
Field('creator', 'integer')
)
#CONTROLLER
page_form = SQLFORM(db.page)


And I want to set a field that is hidden in this form to 
session.conference_id.


Best Regards,
Jason Brower


[web2py] Url for References in the Spanish book

2011-01-18 Thread Offray Vladimir Luna Cárdenas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi.

I would like to share some thought of web2py introduction via identi.ca.
Quote something and add the short url of the on-line Book, Spanish
edition. There is one Spanish version hosted by Latinux-Press but is not
so nicely formated like the one you get when you enter o
http://web2py.com/book and select "Spanish" from the drop down language
menu. But when I made this, I don't get any change in the url showning
the language, so, may be if I share the url via microblogs people will
get the English version. There is any way to indicate the language in
the url of the online book edition?

Cheers,

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

iQEcBAEBAgAGBQJNNd85AAoJEGiex2828ICwhHoH/3PB5QMhIl9V13JOqz8X/gvN
BmeDcVWtII1O2YlUi+mdnBtuyxCgbIRwcJ/W72Swx3IhDYbQbHDvq/xMDGuzfN3l
fMrtnf8PNA+tm8oEQ9R/9cb6O3RLTpIORn76gD2c76MsLpbpRzOeXp9hdciwOnOc
v9aESWzM7n0aBwBwxUTaaKWg+z+F6o7os7QMNmLyMhIggJEwW/6KssKZ2RV5EZ/Z
MHsC9U3h7hQQqQmPhrXpVThQj6V/FfkefM5+9t7/X797LMBEkcYxn3fg26rICNs5
+hedCfYNII0EDQTyZmWdNA2fcAJUke+zTs8Dp7jRDsqBTVyaEU2P5AZ0l1v5vp4=
=pti/
-END PGP SIGNATURE-


[web2py] Bug? SQLFORM.factory and SQLFORM differ in handling of hidden form fields

2011-01-18 Thread Nathan VanHoudnos
Hi,

A minimal example:
likertRightAnswer = ['Yes', 'No', 'Impossible to tell']

form = SQLFORM.factory(
Field('rightAnswer',
  widget=horizontal_radios,
  requires=IS_IN_SET(likertRightAnswer,
 error_message=T('Please choose a
response.'))),
hidden={'timestart':request.now.strftime('%Y-%m-%d %H:%M:%S')}
)

In this case, BEAUTIFY(request.post_vars) will include, timestart and
rightAnswer, but BEAUTIFY(form.vars) will only include rightAnswer.

If we instead setup the appropriate db as db.ratings, and then do:
likertRightAnswer = ['Yes', 'No', 'Impossible to tell']

form = SQLFORM(db.ratings,
hidden={'timestart':request.now.strftime('%Y-%m-%d %H:%M:%S')}
)

In this case, both BEAUTIFY(request.post_vars) and BEAUTIFY(form.vars) will
both include timestart and rightAnswer.

The second behavior is "more expected" at least to me.

Right now, I'm using request.post_vars.timestart to access the value after
the form.accepts call, but this feels like I'm hacking something together.

And it essentially circumvents the security feature discussed in this
thread:

http://groups.google.com/group/web2py/browse_thread/thread/ab21d9d21693ee2e/1f6781206e956405?lnk=gst&q=hidden+form+fields+not+accepted#1f6781206e956405

So is this a bug? Or should I be doing something different? (My application
creates a bunch of little temporary forms and I don't want to bloat
the data-store with them.)

Cheers,
-- 
Nathan VanHoudnos
|- Statistics & Public Policy PhD student
|- Program for Interdisciplinary Education Research (PIER) Fellowship
|- Carnegie Mellon University
|- http://www.andrew.cmu.edu/user/nmv

"Neglect of mathematics works injury to all knowledge,
 since he who is ignorant of it cannot know the other
 sciences or the things of this world." -- Roger Bacon


[web2py] Re: reply-to setting in Mail()

2011-01-18 Thread blackthorne
Just got there,
if reply_to:
payload['Reply-To'] =
encode_header(reply_to.decode(encoding))

where reply_to is an arg for send(...reply_to=None...).

Maybe, this should be documented in the book.

Thanks


On Jan 18, 5:17 pm, Anthony  wrote:
> Mail is documented in the book 
> (http://web2py.com/book/default/chapter/08#Auth-and-Mail), but you're right,
> it does not appear to mention the reply-to option. However, the send method
> of the Mail class does include a reply-to parameter, as documented 
> here:http://www.web2py.com/examples/static/epydoc/web2py.gluon.tools.Mail-...
>
> For future reference, you can access the web2py Epydoc content from the
> documentation page:http://www.web2py.com/examples/default/documentation(or
> directly athttp://www.web2py.com/examples/static/epydoc/index.html).
> Because it's part of the 'examples' app (which is the main web2py.com site),
> Epydoc is also included in your local web2py installation (assuming you
> haven't deleted the 'examples' app) -- it's all in
> /applications/examples/static/epydoc/ and can be reached by navigating your
> local copy of the 'examples' app (just like on web2py.com).
>
> Anthony


[web2py] Re: reply-to setting in Mail()

2011-01-18 Thread Anthony
Mail is documented in the book (
http://web2py.com/book/default/chapter/08#Auth-and-Mail), but you're right, 
it does not appear to mention the reply-to option. However, the send method 
of the Mail class does include a reply-to parameter, as documented here: 
http://www.web2py.com/examples/static/epydoc/web2py.gluon.tools.Mail-class.html
 
For future reference, you can access the web2py Epydoc content from the 
documentation page: http://www.web2py.com/examples/default/documentation (or 
directly at http://www.web2py.com/examples/static/epydoc/index.html). 
Because it's part of the 'examples' app (which is the main web2py.com site), 
Epydoc is also included in your local web2py installation (assuming you 
haven't deleted the 'examples' app) -- it's all in 
/applications/examples/static/epydoc/ and can be reached by navigating your 
local copy of the 'examples' app (just like on web2py.com).
 
Anthony
 


[web2py] Re: Problem with one-to-many field

2011-01-18 Thread rif
I changed it back to Field('firma', db.firma) and now it works as
expected. I really hope that it was somehow my mistake because I want
to learn to use and trust web2py.

Just for the record in case it happens to someone else:

I had a foreign key (OneToMany relationship) that was not rendered as
a select box in the database administration or on crud generated
forms.
This field was first added as a string field and then migrated to
db.firma (foreign key), however the field rendering remained as
textfield.

I added some requirements hoping that it will help the database schema
migration (as I learned the way that I added the requirements was
FORCING the field to be a textfield: the opposite of my intention).
When I change it back to the original form (Massiomo's suggestion) the
problem was corrected.

All the best,
Radu

On Jan 18, 4:39 pm, Massimo Di Pierro 
wrote:
> Before you send me the app. Please explain again what is your model
> now, what you get and what you expect.
>
> You original code was wrong because if the validator is a list than
> there is no dropdown. That is not a bug but a feature.
>
> On Jan 18, 2:09 am, rif  wrote:
>
>
>
>
>
>
>
> > It was Field('firma', db.firma), I added the requires parameter as a
> > desperate measure thinking that it will trigger the right
> > functionality. It really looks like a "glitch in the system". If it is
> > useful to you I can send you the whole app.
>
> > Radu (from Romania :)
>
> > On Jan 17, 6:29 pm, Massimo Di Pierro 
> > wrote:
>
> > > Replace
>
> > >  Field('firma', db.firma, requires=[IS_IN_DB(db, 'firma.id', '%
> > > (nume)s')]),
>
> > > with
>
> > >  Field('firma', db.firma,  requires=IS_IN_DB(db, 'firma.id', '%
> > > (nume)s')),
>
> > > or even better
>
> > >  Field('firma', db.firma),
>
> > > the validator is automatic for reference fields.
>
> > >  Field('firma', db.firma, requires=[IS_IN_DB(db,
> > > 'firma.id', '%(nume)s')]),
>
> > > On Jan 17, 5:11 am, rif  wrote:
>
> > > > Hi guys,
>
> > > > I just started working with web2py and I like it a lot. I have a
> > > > little problem with the following tables:
>
> > > > The firma field in the second table is shown as a text field where I
> > > > can only enter the ids and not as a select field. I admit that I might
> > > > have saved the db.py with firma field as a string first but now the
> > > > migration does not seem to take place.
> > > > I have other foreign key fields that are working fine but this one is
> > > > giving me troubles. Did I do something wrong here?
>
> > > > If you need more info please let me know.
>
> > > > Keep up the good work!
> > > > Radu
>
> > > > db.define_table('firma',
> > > >                 Field('nume', required=True, unique=True),
> > > >                 format='%(nume)s'
> > > >                 )
>
> > > > db.define_table('angajat',
> > > >                 Field('firma', db.firma, requires=[IS_IN_DB(db,
> > > > 'firma.id', '%(nume)s')]),
> > > >                 Field('nume', required=True),
> > > >                 Field('prenume', required=True),
> > > >                 Field('norma', 'integer', required=True,
> > > > requires=[IS_INT_IN_RANGE(1,10)]),
> > > >                 Field('activ', 'boolean', default=True),
> > > >                 format='%(nume)s %(prenume)s'
> > > >                 )


Re: [web2py] Long-running controllers

2011-01-18 Thread Jonathan Lundell
On Jan 18, 2011, at 7:39 AM, ae wrote:
> 
> How do people deal with controller functions that take a long time?
> (waiting for a subprocess or connection to another host, for example)
> 
> It seems that while a thread is busy, anyone associated with the
> thread can't use the application.  I can see the benefit of this (one
> user can't consume many threads) but I also need the application to be
> responsive while a long-running request is being handled.
> 
> In the past, I've handed requests off to another server (written on
> Twisted) and had javascript poll for status, but this is a bit
> laborious.

When you say "anyone associated with the thread", do you mean other requests 
using some shared, locked resource (like the session)? Or something else?

Re: [web2py] Re: doesn't represents in a string format

2011-01-18 Thread Christian Foster Howes
the requires my not be necessary, i have not tested it.  when i have the 
represent it works for me in SQLTABLE.  i have not used the other 
visualizations.


On 01/18/2011 05:08 AM, web2py noob wrote:

I have to say that the represent=lambda x: db.stuff[x].name seems to
works only for webgrid plugin, but not for jqgrid (plugin_wiki) nor
SQLTABLE builtin function. it's this how is must be or is a bug?




[web2py] Re: reply-to setting in Mail()

2011-01-18 Thread blackthorne
Your link does not seem to hold any useful content related to my
question, looks more like a very incomplete suggestion on the way I
should be making questions. My question, is as simple as it can get,
should be pretty obvious to anyone able to answer it, does not seem to
be featured in the docs and looks strange to me that I'm the first to
need something like this on web2py.

Considering the contents of your own reference, I gently ask you to go
deeper on your reply, so it becomes clear.

Thank you,
Best regards

On Jan 18, 3:27 pm, Gary Herron  wrote:
> On 01/18/2011 07:18 AM, blackthorne wrote:
>
> > Is it possible? how?
>
> Seehttp://www.catb.org/~esr/faqs/smart-questions.html#intro
>
> --
> Gary Herron, PhD.
> Department of Computer Science
> DigiPen Institute of Technology
> (425) 895-4418


[web2py] Long-running controllers

2011-01-18 Thread ae
How do people deal with controller functions that take a long time?
(waiting for a subprocess or connection to another host, for example)

It seems that while a thread is busy, anyone associated with the
thread can't use the application.  I can see the benefit of this (one
user can't consume many threads) but I also need the application to be
responsive while a long-running request is being handled.

In the past, I've handed requests off to another server (written on
Twisted) and had javascript poll for status, but this is a bit
laborious.

Todd


[web2py] Re: social network idea

2011-01-18 Thread Massimo Di Pierro
I found diigo is a really good bookmarking site. It has some social
features, although not the ability to find people with same bookmarks
nearby.

On Jan 18, 8:44 am, Massimo Di Pierro 
wrote:
> At a second look...
>
> http://pinboard.in/this is very close to what I proposed. The fee is
> a one-time sign up fee. Their business model is very interesting but
> will prevent growth (the more users the more it costs to join -
> clearly not designed by an economist! - reminiscent of the social
> security business model).
>
> On Jan 18, 8:30 am, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > $9.19? They got the business model wrong.
>
> > On Jan 18, 12:12 am, Tom Atkins  wrote:
>
> > >http://pinboard.ingivesmea list of people to check out based on their
> > > bookmarking history.  I don't know the details of the algorithm and 
> > > there's
> > > no flexibility in refining the recommendations but I've found some
> > > interesting people to add to my 'network'. You can only see the username 
> > > of
> > > the person. The ability to find out more about people and then contact 
> > > them
> > > as Massimo suggests would be a good feature.
>
> > > The Facebook feature that lets you create 'lists' of friends so you can
> > > share things with sub-groups of your friends is not subtle enough - as far
> > > as I can tell it only allows you to send 'messages' to people in a list -
> > > this can be intrusive as it ends up in their 'inbox' and also usually
> > > emailed.  It would be better if you could also do 'wall' posts that can 
> > > only
> > > be seen by a sub group of friends (e.g. rude joke for my friends to see 
> > > but
> > > not family).


Re: [web2py] reply-to setting in Mail()

2011-01-18 Thread Gary Herron

On 01/18/2011 07:18 AM, blackthorne wrote:

Is it possible? how?



See http://www.catb.org/~esr/faqs/smart-questions.html#intro

--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418



[web2py] reply-to setting in Mail()

2011-01-18 Thread blackthorne
Is it possible? how?


[web2py] Re: social network idea

2011-01-18 Thread Massimo Di Pierro
At a second look...

http://pinboard.in/ this is very close to what I proposed. The fee is
a one-time sign up fee. Their business model is very interesting but
will prevent growth (the more users the more it costs to join -
clearly not designed by an economist! - reminiscent of the social
security business model).

On Jan 18, 8:30 am, Massimo Di Pierro 
wrote:
> $9.19? They got the business model wrong.
>
> On Jan 18, 12:12 am, Tom Atkins  wrote:
>
>
>
>
>
>
>
> >http://pinboard.ingivesme a list of people to check out based on their
> > bookmarking history.  I don't know the details of the algorithm and there's
> > no flexibility in refining the recommendations but I've found some
> > interesting people to add to my 'network'. You can only see the username of
> > the person. The ability to find out more about people and then contact them
> > as Massimo suggests would be a good feature.
>
> > The Facebook feature that lets you create 'lists' of friends so you can
> > share things with sub-groups of your friends is not subtle enough - as far
> > as I can tell it only allows you to send 'messages' to people in a list -
> > this can be intrusive as it ends up in their 'inbox' and also usually
> > emailed.  It would be better if you could also do 'wall' posts that can only
> > be seen by a sub group of friends (e.g. rude joke for my friends to see but
> > not family).


[web2py] Re: Problem with one-to-many field

2011-01-18 Thread Massimo Di Pierro
Before you send me the app. Please explain again what is your model
now, what you get and what you expect.

You original code was wrong because if the validator is a list than
there is no dropdown. That is not a bug but a feature.

On Jan 18, 2:09 am, rif  wrote:
> It was Field('firma', db.firma), I added the requires parameter as a
> desperate measure thinking that it will trigger the right
> functionality. It really looks like a "glitch in the system". If it is
> useful to you I can send you the whole app.
>
> Radu (from Romania :)
>
> On Jan 17, 6:29 pm, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > Replace
>
> >  Field('firma', db.firma, requires=[IS_IN_DB(db, 'firma.id', '%
> > (nume)s')]),
>
> > with
>
> >  Field('firma', db.firma,  requires=IS_IN_DB(db, 'firma.id', '%
> > (nume)s')),
>
> > or even better
>
> >  Field('firma', db.firma),
>
> > the validator is automatic for reference fields.
>
> >  Field('firma', db.firma, requires=[IS_IN_DB(db,
> > 'firma.id', '%(nume)s')]),
>
> > On Jan 17, 5:11 am, rif  wrote:
>
> > > Hi guys,
>
> > > I just started working with web2py and I like it a lot. I have a
> > > little problem with the following tables:
>
> > > The firma field in the second table is shown as a text field where I
> > > can only enter the ids and not as a select field. I admit that I might
> > > have saved the db.py with firma field as a string first but now the
> > > migration does not seem to take place.
> > > I have other foreign key fields that are working fine but this one is
> > > giving me troubles. Did I do something wrong here?
>
> > > If you need more info please let me know.
>
> > > Keep up the good work!
> > > Radu
>
> > > db.define_table('firma',
> > >                 Field('nume', required=True, unique=True),
> > >                 format='%(nume)s'
> > >                 )
>
> > > db.define_table('angajat',
> > >                 Field('firma', db.firma, requires=[IS_IN_DB(db,
> > > 'firma.id', '%(nume)s')]),
> > >                 Field('nume', required=True),
> > >                 Field('prenume', required=True),
> > >                 Field('norma', 'integer', required=True,
> > > requires=[IS_INT_IN_RANGE(1,10)]),
> > >                 Field('activ', 'boolean', default=True),
> > >                 format='%(nume)s %(prenume)s'
> > >                 )


[web2py] Re: Value of the form field

2011-01-18 Thread Massimo Di Pierro
Is your form using the IS_SLUG() validator?

On Jan 18, 7:02 am, luifran  wrote:
> When I write two separate words in a form field, and extract the value
> of this field, every space appears the symbol '_', it causes me not
> match the field's value with the value of the database.
>
> How I can fix this?
> Thanks.


[web2py] Re: social network idea

2011-01-18 Thread Massimo Di Pierro
$9.19? They got the business model wrong.

On Jan 18, 12:12 am, Tom Atkins  wrote:
> http://pinboard.ingives me a list of people to check out based on their
> bookmarking history.  I don't know the details of the algorithm and there's
> no flexibility in refining the recommendations but I've found some
> interesting people to add to my 'network'. You can only see the username of
> the person. The ability to find out more about people and then contact them
> as Massimo suggests would be a good feature.
>
> The Facebook feature that lets you create 'lists' of friends so you can
> share things with sub-groups of your friends is not subtle enough - as far
> as I can tell it only allows you to send 'messages' to people in a list -
> this can be intrusive as it ends up in their 'inbox' and also usually
> emailed.  It would be better if you could also do 'wall' posts that can only
> be seen by a sub group of friends (e.g. rude joke for my friends to see but
> not family).


[web2py] Re: .../default/user/not_authorized

2011-01-18 Thread Massimo Di Pierro

if isinstance(form,FORM):
form[0][-1][1].append(...)

On Jan 18, 3:02 am, annet  wrote:
> In the default controller I adjusted the user() function:
>
> def user():
>     """
>     exposes:
>     ...
>     """
>     form=auth()
>     form[0][-1]
> [1].append(INPUT(_type="button",_value="Cancel",_onclick="window.location=' 
> %s';"%URL(r=request,f='index')))
>     return dict(form=form)
>
> This works well, until a user requests access to a function he doesn't
> have access to.  Web2py then redirects to:
>
> http://127.0.0.1:8000/cms/default/user/not_authorized
>
> ... which results in the following error;
>
> Traceback (most recent call last):
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
> restricted.py", line 188, in restricted
>     exec ccode in environment
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/applications/
> cms/controllers/default.py", line 118, in 
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
> globals.py", line 96, in 
>     self._caller = lambda f: f()
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/applications/
> cms/controllers/default.py", line 25, in user
>     form[0][-1]
> [1].append(INPUT(_type="button",_value="Cancel",_onclick="window.location=' 
> %s';"%URL(r=request,f='index')))
> IndexError: string index out of range
>
> This is how I fixed the problem, not very elegant, and probably
> overlooking other conditions:
>
> def user():
>     """
>     exposes:
>     ...
>     """
>     form=auth()
>     if not request.args(0)=='not_authorized':
>         form[0][-1]
> [1].append(INPUT(_type="button",_value="Cancel",_onclick="window.location=' 
> %s';"%URL(r=request,f='index')))
>     return dict(form=form)
>
> I wonder whether there is a better way to solve this problem.
>
> Kind regards,
>
> Annet


[web2py] Re: How to pass a database object in request.vars to a function?

2011-01-18 Thread Massimo Di Pierro
request.vars[key] are strings.

a query is an instance of gluon.dal.Query.

You cannot serialize and deserialize a query without creating major
security issues. The best you can do is break the query into
(fieldname, operator, value) and do what plugin_wiki does in
controllers/plugin_wiki.py/jqgrid

On Jan 18, 2:27 am, Johann Spies  wrote:
> I am trying to build a generic 'list_records' function to handle pagination
> and to avoid doing it all over again for different queries and tables.
>
> I am struggling to pass a proper query to the function eg.
>
> request.vars.query = db.artikel.id > 0
>
> ends up in the function as '(artikel.id > 0)'  and not '(db.artikel.id > 0)'
>
> which means that this code produces a malformed sql query (db(artikel.id
>
> >0)...):
>
>     if request.vars.table and request.vars.query:
>         table = request.vars.table
>         start = page * items_per_page
>         stop = (page+1) * items_per_page+1
>         limitby = (start,stop)
>         query = request.vars.query
>         flds = request.vars.flds
>         print request.vars
>         if request.vars.total_found:
>             total_found = int(request.vars.total_found)
>         else:
>             total_found = db(query).count()
>         rows = db(query).select(flds,limitby=limitby)
>
> Regards
> Johann
>
> --
>  May grace and peace be yours in abundance through the full knowledge of God
> and of Jesus our Lord!  His divine power has given us everything we need for
> life and godliness through the full knowledge of the one who called us by
> his own glory and excellence.
>                                                     2 Pet. 1:2b,3a


[web2py] Re: account for each user

2011-01-18 Thread Massimo Di Pierro
This line:

records = db(auth.settings.table_user==auth.user).select(...)

is invalid because the content of db(...) is not a query. It does not
involve any field.



On Jan 17, 9:28 pm, Rick  wrote:
> I found that this line is the error-prone one:
> records =
> db(auth.settings.table_user==auth.user).select(db.day.theauth,
> distinct=True, orderby=db.day.thedate)
> ...I tested the next version too, but it also gave an error:
> records = db(db.day.theauth==auth.user).select(db.day.ALL,
> orderby=db.day.thedate)
> ...The last version worked, but it doesn't fulfill the function I want
> it to have, namely to select records that are associated with the user
> that is logged in:
> records = db().select(db.day.ALL, orderby=db.day.thedate)
> Any ideas?
>
>
>
>
>
>
>
> >On Jan 16, 9:54 pm, Rick  wrote:
> > I suppose that the problem is that the "records" list isn't completely
> > returned from the controller file to create.html and that the
> > "thedate" field is lost in that process.
>
> > On Jan 16, 9:32 pm, Rick  wrote:
>
> > > Hmmm... strange... the error disappeared, but it was replaced by
> > > another one:
> > > KeyError: 'thedate'
> > > ...and this error arises from the html-table in the create.html -- the
> > > code works when i delete the table.
>
> > > On Jan 16, 8:40 pm, Rick  wrote:
>
> > > > Perhaps the previous post was a bit vague. I meant that create.html
> > > > works when it only contains {{=form}}.
>
> > > > On Jan 16, 8:35 pm, Rick  wrote:
>
> > > > > Yes, {{=form}} works without the other code.
>
> > > > > On Jan 16, 6:35 pm, Martín Mulone  wrote:
>
> > > > > > to test, put only  {{=form}} in create.html remove all the other. 
> > > > > > Now the
> > > > > > error continue?
>
> > > > > > 2011/1/16 Rick 
>
> > > > > > > thanks for the comments. I deleted the #. At the beginning of
> > > > > > > create.html there is this code:
> > > > > > > {{import datetime}}
> > > > > > > {{import uuid}}
> > > > > > > {{recording=datetime.date(2000,01,01)}}
> > > > > > > ...but the error remains :(
>
> > > > > > > On Jan 16, 2:13 pm, "Martin.Mulone"  
> > > > > > > wrote:
> > > > > > > > in create.html
>
> > > > > > > > #if recording!=record.thedate:}
>
> > > > > > > > you commented this line but you hasn't commented the pass, the 
> > > > > > > > same to
> > > > > > > > {{#session.uuid=record.uuid}}
> > > > > > > > and what is recording??.
>
> > > > > > --
> > > > > > Pablo Martín Mulone 
> > > > > > (mar...@tecnodoc.com.ar)http://www.tecnodoc.com.ar/
> > > > > > Paraná, Entre Ríos, Argentina (CP 3100).
>
> > > > > > My blog:http://martin.tecnodoc.com.ar
> > > > > > Expert4Solution 
> > > > > > Profile:http://www.experts4solutions.com/e4s/default/expert/6


[web2py] Re: Problem with one-to-many field

2011-01-18 Thread rif
It was Field('firma', db.firma), I added the requires parameter as a
desperate measure thinking that it will trigger the right
functionality. It really looks like a "glitch in the system". If it is
useful to you I can send you the whole app.

Radu (from Romania :)

On Jan 17, 6:29 pm, Massimo Di Pierro 
wrote:
> Replace
>
>  Field('firma', db.firma, requires=[IS_IN_DB(db, 'firma.id', '%
> (nume)s')]),
>
> with
>
>  Field('firma', db.firma,  requires=IS_IN_DB(db, 'firma.id', '%
> (nume)s')),
>
> or even better
>
>  Field('firma', db.firma),
>
> the validator is automatic for reference fields.
>
>  Field('firma', db.firma, requires=[IS_IN_DB(db,
> 'firma.id', '%(nume)s')]),
>
> On Jan 17, 5:11 am, rif  wrote:
>
>
>
>
>
>
>
> > Hi guys,
>
> > I just started working with web2py and I like it a lot. I have a
> > little problem with the following tables:
>
> > The firma field in the second table is shown as a text field where I
> > can only enter the ids and not as a select field. I admit that I might
> > have saved the db.py with firma field as a string first but now the
> > migration does not seem to take place.
> > I have other foreign key fields that are working fine but this one is
> > giving me troubles. Did I do something wrong here?
>
> > If you need more info please let me know.
>
> > Keep up the good work!
> > Radu
>
> > db.define_table('firma',
> >                 Field('nume', required=True, unique=True),
> >                 format='%(nume)s'
> >                 )
>
> > db.define_table('angajat',
> >                 Field('firma', db.firma, requires=[IS_IN_DB(db,
> > 'firma.id', '%(nume)s')]),
> >                 Field('nume', required=True),
> >                 Field('prenume', required=True),
> >                 Field('norma', 'integer', required=True,
> > requires=[IS_INT_IN_RANGE(1,10)]),
> >                 Field('activ', 'boolean', default=True),
> >                 format='%(nume)s %(prenume)s'
> >                 )


[web2py] Re: doesn't represents in a string format

2011-01-18 Thread web2py noob
I have to say that the represent=lambda x: db.stuff[x].name seems to
works only for webgrid plugin, but not for jqgrid (plugin_wiki) nor
SQLTABLE builtin function. it's this how is must be or is a bug?


[web2py] Value of the form field

2011-01-18 Thread luifran
When I write two separate words in a form field, and extract the value
of this field, every space appears the symbol '_', it causes me not
match the field's value with the value of the database.

How I can fix this?
Thanks.


[web2py] Re: doesn't represents in a string format

2011-01-18 Thread web2py noob
On 18 ene, 02:12, howesc  wrote:
> (...)

Hi Howesc, If I understand well, as I put in the links,
requires=[IS_NOT_EMPTY(),IS_IN_DB()] would not needed if I already
defined the table as:


db.define_table('table01',
Field('name','string'),
format='%(name)s'
)

db.define_table('table02',
Field('table01_name','reference table01')
)

but I see that this will work for create tables and is not enought to
also force the represent value on read tables, so is needed to force
the represent stanza in the field.


[web2py] Re: Powertable remarks

2011-01-18 Thread Johann Spies
I started this thread:


On 17 December 2010 12:11, Johann Spies  wrote:

>
> * I have tested it this morning on a table with more  just over 8200
> entries and it took 70-90  seconds on Firefox and 30-35 secondes no Chrome
> to reload the page from localhost.  That is not usable.  Plugin_wiki's
> jqgrid does this in less than a second.
>   It seems that it loads the whole table and does not make use of paging
> while executing the query.
>
>
After the plugin was updated and I returned from holiday, I did the same
test today:

Firefox - about 45 seconds
Chrome - about 37 seconds.

So there is an improvement on Firefox, but not on Chrome.

But it still too slow to use on larger datasets without some other
pagination help - which is a pity.  I have tried to get it to load a table
of 135000 entries but gave up after a long time.

Unfortunately my knowlege of javascript is almost zero so I do not know
whether it is possible to get the javascript to handle the sql-queries in a
way that does not need to load all the data into memory.

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


Re: [web2py] social network idea

2011-01-18 Thread Albert Abril
@Anand What's the name? Or some link? Thanks.

On Tue, Jan 18, 2011 at 12:35 PM, Anand Vaidya wrote:

> I have seen an app that does almost what you mean on my freshly installed
> kubuntu desktop
>
> The app shows who is geographically nearby and (s)he need not be our
> "friend" already, most likely have similar interests (in this case KDE).
>


  1   2   >