Re: [web2py] Re: Proposals for New Tagline

2011-03-22 Thread Jason (spot) Brower
Yeah... Small framework big thought. Or something similar.
On 22 Mar 2011 00:21, Richard Vézina ml.richard.vez...@gmail.com wrote:
 web2py : A small framework that allow you to think Big ;-)

 Richard



 On Mon, Mar 21, 2011 at 2:46 PM, pbreit pbreitenb...@gmail.com wrote:

 In the non-enterprise world, it's the exact opposite. Enterprise
implies
 expensive, unpleasant, old, hard to acquire/install/use, bloated,
Java/.net,
 etc. I'd be surprised if many enterprises are even considering Django.


[web2py] Re: the facebook clone video

2011-03-22 Thread LightOfMooN
Thx, I think so, but just wanted to insurance :)

On 22 мар, 10:15, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 yes, here:

 User, Link, Post = db.auth_user, db.link, db.post
 me, a0, a1 = auth.user_id, request.args(0), request.args(1)
 myfriends = db(Link.source==me)(Link.accepted==True)
 alphabetical = User.first_name|User.last_name
 def name_of(user): return '%(first_name)s %(last_name)s' % user

 it is the video.

 On Mar 21, 6:59 pm, pbreit pbreitenb...@gmail.com wrote:







  You have to follow the video pretty closely but you'll see that Massimo sets
  those up as short-cuts. I think they were in the model.


[web2py] Re: reddit again

2011-03-22 Thread Mengu
it's not provacative, it's attractive. apart from that, i agree with
what you said.
let's not hijack other frameworks' threads.

On Mar 22, 7:27 am, pbreit pbreitenb...@gmail.com wrote:
 Massimo, sorry to say but I think your posting style invites the unwanted
 attention (av201001, too). I'm a Web2py supporter but I think they are
 right, we don't play well in the discussions. Posting a video under the
 title Facebook clone in 11 minutes is unnecessarily provocative. Joking
 about others hijacking the thread is passive-aggressive. As is following
 every Flask/Django/etc comment with but I like Flask/Django/etc. And
 hijacking threads, which we clearly do, and saying we don't is really bad
 style (regardless if other people do it).

 I think we could use a little grace in our interactions with the
 communities. Web2py is too good to leave such a bad impression everywhere.

 I also think we overstate the benefits of not having to write much code. It
 doesn't really matter what can be written with a little code, it matters
 what can be written with a lot of code. Same with write once, run
 anywhere. Most deploy to one  platform. These are nice features, but not
 worth getting into arguments over.


Re: [web2py] Re: Export DB from admin?

2011-03-22 Thread Kenneth Lundström

On 22.3.2011 7:42, pbreit wrote:
Great info, thanks! 


If you are moving from one database to another then you can have to open 
database connection in web2py extract data and write it back to the 
other database.



Kenneth



Re: [web2py] Re: new URL router use cases

2011-03-22 Thread Tom Atkins
I might be being naive here but in Flask I can do:

@app.route('/yoursitename/users')
... def editusers(yoursitename): pass

print url_for('editprofile', yoursitename='Supersite')

gives:

/Supersite/users



On 22 March 2011 05:23, Jonathan Lundell jlund...@pobox.com wrote:

 On Mar 21, 2011, at 7:44 PM, Indra Gunawan wrote:

 Agree, Flask way looks more elegant (see Variable Rules). It could be nice
 if this way also exists on Web2Py.

 On 22 March 2011 06:05, Tom Atkins minkto...@gmail.com wrote:

 I was playing with Flask and I have to say its solution to routing is very
 nice:

 http://flask.pocoo.org/docs/quickstart/#routing

 The use of variable names anywhere within the URL structure is very handy.
 Anything like this possible in web2py?


 Flask doesn't really allow variable names anywhere; near as I can tell
 they're a considerably restricted version of web2py's args list.




Re: [web2py] Re: new URL router use cases

2011-03-22 Thread Tom Atkins
sorry - should have been:

@app.route('/yoursitename/users')
... def editusers(yoursitename): pass

print url_for('editusers', yoursitename='Supersite')

gives:

/Supersite/users

On 22 March 2011 08:13, Tom Atkins minkto...@gmail.com wrote:

 I might be being naive here but in Flask I can do:

 @app.route('/yoursitename/users')
 ... def editusers(yoursitename): pass

 print url_for('editprofile', yoursitename='Supersite')

 gives:

 /Supersite/users



 On 22 March 2011 05:23, Jonathan Lundell jlund...@pobox.com wrote:

 On Mar 21, 2011, at 7:44 PM, Indra Gunawan wrote:

 Agree, Flask way looks more elegant (see Variable Rules). It could be nice
 if this way also exists on Web2Py.

 On 22 March 2011 06:05, Tom Atkins minkto...@gmail.com wrote:

 I was playing with Flask and I have to say its solution to routing is
 very nice:

 http://flask.pocoo.org/docs/quickstart/#routing

 The use of variable names anywhere within the URL structure is very
 handy. Anything like this possible in web2py?


 Flask doesn't really allow variable names anywhere; near as I can tell
 they're a considerably restricted version of web2py's args list.





[web2py] Re: reddit again

2011-03-22 Thread JorgeRpo
Agree.

Web2py has achieved a good  ever growing userbase momentum now. 

2 years ago there were like 6 threads created/updated daily in this Google 
groups discussion,

Currently, its like 4-5 times that number.

We are not the same skinny new kid on the block anymore.

There is no need to hijack other frameworks'  threads.

Guerrilla marketing tactics worked well but now we can move on with 
seduction, atracting users instead of 'stalking' them.

Disclaimer: I am proud web2py fan since 2008.


[web2py] Re: Converting legacy MySQL databases to web2py DAL

2011-03-22 Thread fib
Response much appreciated
I understand some of the defining and forms bits and want to use web2py - I 
do have rudimentary working apps 
but i was struggling to write the web2py code to create the db tables to 
match the mysql db tables i already have 

it was really the bit about changing the current mysql that I have to web2py 
format
I will spend some time on the book chapter etc to work out doing this before 
I come back 

so far:

I have tried to install mysqldb using google as an info source
using windows 7
python 2.5.1 installed
setuptools installed
seem to have issues with the get config ?? - confused here


just trying to get to a point where i can do the db structure scrape to 
create the web2py db code as i interpret that is what your code does

thank you


[web2py] update db.table from custom form

2011-03-22 Thread cyber
Hi there! Say guys how can I handle form.accepts if I need update
record in db from my custom form?

I have the custom form in one view:
{{from r in current_row:}}
form
   ...
   input type=button value={{=r.enter}} /
   ...
/form
{{pass}}

And I want to update db.table.enter from False to True when user
presses the button. How can I do that?


[web2py] Re: Converting legacy MySQL databases to web2py DAL

2011-03-22 Thread selecta

 just trying to get to a point where i can do the db structure scrape to
 create the web2py db code as i interpret that is what your code does

yes the script uses the mysql and mysqldump excecutables to dump the
table structures and parses that with regular expressions

Nice work Kevin, I have had only created and used for it once to
migrate our legacy db to pyMantis but I am planning to add this as a
feature the pyMantis so this comes in very handy :D


[web2py] Where do I put custom validators?

2011-03-22 Thread Ashwin Purohit
Which file do I put custom validators in? The book (
http://web2py.com/book/default/chapter/07#Custom-Validators) says nothing
about standard placement.

Thanks,
Ashwin


[web2py] Re: Where do I put custom validators?

2011-03-22 Thread DenesL

They usually go in a model file, just remember that models are loaded
in alphabetical order.

On Mar 22, 4:21 am, Ashwin Purohit puro...@gmail.com wrote:
 Which file do I put custom validators in? The book 
 (http://web2py.com/book/default/chapter/07#Custom-Validators) says nothing
 about standard placement.

 Thanks,
 Ashwin


[web2py] Re: reddit again

2011-03-22 Thread Massimo Di Pierro
Perhaps you are right. I will try be more careful.

On Mar 22, 2011, at 12:27 AM, pbreit wrote:

 Massimo, sorry to say but I think your posting style invites the unwanted 
 attention (av201001, too). I'm a Web2py supporter but I think they are right, 
 we don't play well in the discussions. Posting a video under the title 
 Facebook clone in 11 minutes is unnecessarily provocative. Joking about 
 others hijacking the thread is passive-aggressive. As is following every 
 Flask/Django/etc comment with but I like Flask/Django/etc. And hijacking 
 threads, which we clearly do, and saying we don't is really bad style 
 (regardless if other people do it).
 
 I think we could use a little grace in our interactions with the communities. 
 Web2py is too good to leave such a bad impression everywhere.
 
 I also think we overstate the benefits of not having to write much code. It 
 doesn't really matter what can be written with a little code, it matters what 
 can be written with a lot of code. Same with write once, run anywhere. Most 
 deploy to one  platform. These are nice features, but not worth getting into 
 arguments over.



[web2py] Re: plugins

2011-03-22 Thread selecta
For the the pyMantis project I created the following plugins. Since
they are integrated into the access management of pyMantis some of
them will need some small modifications to make them work with other
applications.

download the web2py app package from, the os releases are currently
broken but will be fixed in the next days
http://pymantis.org/pymantis_server/plugin_release/download

plugin_calendar
just a test to use the jquery calendar plugin, and some code of the
calendar app (???) to create a google like calendar (will need much
more development)

plugin_chat
fb like chat plugin, but for all registered users in one chat (uses
simple polling and has some z-index issues, but is already quite cool)

plugin_comments
my version of the comment plugin (not so great)

plugin_doc
should automatically create documentation of your web2py app using
docstrings (will need much more work, since lib2to3 has to be used
(inspection does not work on web2py apps) and I got tied up with other
things, but I guess it will be worth it if you need a good looking
documentation of you web2py app code)

plugin_filepreview
create HTML previews of filetypes pdf, doc, xls, images,

plugin_forcedirected
create forecedirected graphs in your browser using html5 canvas

plugin_useradmin
a nice visual use admin (create users, edit userinformation, create
groups, add/remove users to/from group, block/unblock/validate
users, ...)

plugin_mailinglist
creates a mailinglist/group similar to this one (still under
development)

plugin_release
this is the latest one, and I am quite proud of it
creates releases of your software (standalone win, src/linux, mac -
w2p packages) with a client and a server instance that allows clients
to automatically check for updates of your web2py app with a nice
update button

plugin_restapidoc
create a nice looking documentation of your web2py REST interface

plugin_tagging
Tagging plugin, this is not the same as the one that is on the plugin
list. This one allows you to put multiple tag clouds and forms on one
page, it is uses specific and only works for logged in uses.

plugin_tagging_hyperlink
similar to the above but for hyperlinks

plugin_tagging_miriam
similar to the above but for MIRIAM annotations (http://biomodels.net/
miriam/) needs libSBAnnotation (svn it from 
https://sourceforge.net/projects/semanticsbml/)
in your site-packages (still under development)

plugin_tagging_pubmed
similar to the above, it uses the PubMed REST interface to get papers
from keyword or DOI/pubmed ids

plugin_tracker
bug tracker (got bored developing it so it is not so good, also
depends on plugin_comments...)

plugin_webfolder
creates a win explorer like webinterface where you can upload your
files into a treebases folder structure, use drag and drop to move
files, used plugin_filepreview to view files (itegrates with the
pyMantis access management, so you will have to modify this plugin if
you want to use this in another app)


[web2py] Re: reddit again

2011-03-22 Thread villas
@pbreit

Reddit is clearly an informal place to promote new things. This
includes some jokes and banter and Massimo and av200101 have a polite
and informative style which always tends to be objective.

We can of course all choose our words more carefully, but the ambience
on Reddit seems more like a bar rather than a boardroom.

As far as I know, the video is actually titled:
Building a minimalist Facebook clone and deploying it on Google App
Engine

You are really saying that is provocative?! Please explain and suggest
a less provocative title. Perhaps something like 'Programming video -
please don't get upset or anything' might be better.

You say that the Reddit posts leave such a bad impression
everywhere.  That just seems plain wrong to me!  The posts that I
have seen are interesting and polite and I think the av200101 guy is
great!


On Mar 22, 5:27 am, pbreit pbreitenb...@gmail.com wrote:
 Massimo, sorry to say but I think your posting style invites the unwanted
 attention (av201001, too). I'm a Web2py supporter but I think they are
 right, we don't play well in the discussions. Posting a video under the
 title Facebook clone in 11 minutes is unnecessarily provocative. Joking
 about others hijacking the thread is passive-aggressive. As is following
 every Flask/Django/etc comment with but I like Flask/Django/etc. And
 hijacking threads, which we clearly do, and saying we don't is really bad
 style (regardless if other people do it).

 I think we could use a little grace in our interactions with the
 communities. Web2py is too good to leave such a bad impression everywhere.

 I also think we overstate the benefits of not having to write much code. It
 doesn't really matter what can be written with a little code, it matters
 what can be written with a lot of code. Same with write once, run
 anywhere. Most deploy to one  platform. These are nice features, but not
 worth getting into arguments over.


Re: [web2py] Re: reddit again

2011-03-22 Thread Marin Pranjic
On Tue, Mar 22, 2011 at 2:09 PM, villas villa...@gmail.com wrote:


 You are really saying that is provocative?! Please explain and suggest
 a less provocative title. Perhaps something like 'Programming video -
 please don't get upset or anything' might be better.



LOL


[web2py] GSOC 2011 - BioChemical Reaction Network Visualization - web2py

2011-03-22 Thread selecta
Hi web2py coders,
I am very happy to tell you that my group - Theoretical Biophysics at
the HU-Berlin - got selected for a mentoring program for the GSOC2011
(http://code.google.com/soc/). We want to create an new layout
algorithm for biochemical reaction networks, a visualization of the
reaction network using SVG and SBGN and a web based (js) SVG editor
for the reaction networks.

One of the software tools that we would need is a communication layer
that brings the graph visualization to the browser. Since we develop a
lot of software in our group with the help of web2py it would be great
if one of you would be interested in helping us to achieve our vision.
The work will have to be done within two month during the summer and
you would get payed a nice amount of money by google.

You will find more information about our GSOC project here
http://rumo.biologie.hu-berlin.de/gsoc/ (read especially Idea 3)

If you are interested and you want to discuss ideas with us join
http://groups.google.com/group/tbp-soc2011-stud

Please be aware that if you want to join you should bring some coding
skills. In addition to that please be aware that Idea 3 does not have
the highest priority since it depends on other components (layout
algorithm and SVG rendering) which some of you might also be
interested in.


[web2py] Re: update db.table from custom form

2011-03-22 Thread DenesL
Hi,

the input type button specifies a push button for use with client-side
scripting. The VALUE attribute gives the text label of the button. The
ONCLICK attribute is typically used to define the action taken when
the button is activated.

This means that your form has to use ONCLICK (or a similar event) to
create a call to the server from the client's browser.
See http://web2py.com/book/default/chapter/10#The-ajax-Function



On Mar 22, 8:11 am, cyber vlad.mul...@gmail.com wrote:
 Hi there! Say guys how can I handle form.accepts if I need update
 record in db from my custom form?

 I have the custom form in one view:
 {{from r in current_row:}}
 form
    ...
    input type=button value={{=r.enter}} /
    ...
 /form
 {{pass}}

 And I want to update db.table.enter from False to True when user
 presses the button. How can I do that?


[web2py] Re: Menu based on Boolean table fields.

2011-03-22 Thread annet
Thanks for your reply. I had a look at the code, but I am afraid it
doesn't solve my problem. The functions are fields in a table and
depending on their value being true or false they should be rendered
as an a/a or h4/h4 element.

Given this code in a function:

session.id=auth.user.bedrijf_id
session.row=db(db.cardfunction.bedrijf_id==session.id).select(db.cardfunction.ALL)
session.card_menu=[
['Home',request.function=='index',URL(r=request,f='index')],
['Logo',request.function=='logo',URL(r=request,f='logo')],
...
 
['Keywords',request.function=='keywords',URL(r=request,f='keywords')]]


.. I am looking for a way to make use of the _name attribute, for this
is the same as the field name, something like:

ul
  {{for _name,_active,_link in session.card_menu:}}
{{if session.row._name:}}
  li
a {{if _active:}} class=active {{pass}}
href={{=_link}}{{=_name}}/a
  /li
{{else:}}
  li
h4 class=disabled{{=_name}}/h4
  /li
{{pass}}
  {{pass}}
/ul


The problem is that this: {{if session.row._name:}} results in a
KeyError '_name'
Is it possible to use _name to accomplish this?


Kind regards,

Annet.


[web2py] Runnning my new app

2011-03-22 Thread Hal Smith
On page 87 of the manual it says:

Save it and go back to the edit page. Click on the index link to visit
the newly
created page.

Huh? I can only see compile, and that didn't seem to do much. I want
to see my Hello, World message.


[web2py] Re: Runnning my new app

2011-03-22 Thread DenesL

The index link is the title of your app (besides the open folder
image).


On Mar 22, 10:09 am, Hal Smith grownup_...@yahoo.com wrote:
 On page 87 of the manual it says:

 Save it and go back to the edit page. Click on the index link to visit
 the newly
 created page.

 Huh? I can only see compile, and that didn't seem to do much. I want
 to see my Hello, World message.


[web2py] Re: reddit again

2011-03-22 Thread ron_m
Maybe they are just jealous they never thought of what you have done before 
you made it a reality with web2py.


[web2py] Re: Runnning my new app

2011-03-22 Thread Anthony
I think you're on the Site page (which shows all your apps). For the app 
you want to test, click the Edit button, which will take you to the app 
Edit page. Under Controllers, next to your default.py controller, it should 
say exposes index, [other action], [other action], etc. -- you can click 
the index link (or the link of any action) to visit that page. Actually, 
if you just want to get to the index page, you can simply click the app name 
on the Site page or at the top of the app's Edit page.
 
Anthony

On Tuesday, March 22, 2011 10:09:33 AM UTC-4, Hal Smith wrote:

 On page 87 of the manual it says: 

 Save it and go back to the edit page. Click on the index link to visit 
 the newly 
 created page. 

 Huh? I can only see compile, and that didn't seem to do much. I want 
 to see my Hello, World message.



Re: [web2py] Re: new URL router use cases

2011-03-22 Thread Jonathan Lundell

On Mar 22, 2011, at 1:14 AM, Tom Atkins wrote:

 sorry - should have been:
 
 @app.route('/yoursitename/users')
 ... def editusers(yoursitename): pass
 
 print url_for('editusers', yoursitename='Supersite')
 
 gives:
 
 /Supersite/users

Maybe so. Is there a formal definition of how Flask's routing works? All I 
could find was a rather brief overview at the quickstart link.

 
 On 22 March 2011 08:13, Tom Atkins minkto...@gmail.com wrote:
 I might be being naive here but in Flask I can do:
 
 @app.route('/yoursitename/users')
 ... def editusers(yoursitename): pass
 
 print url_for('editprofile', yoursitename='Supersite')
 
 gives:
 
 /Supersite/users
 
 
 
 On 22 March 2011 05:23, Jonathan Lundell jlund...@pobox.com wrote:
 On Mar 21, 2011, at 7:44 PM, Indra Gunawan wrote:
 Agree, Flask way looks more elegant (see Variable Rules). It could be nice 
 if this way also exists on Web2Py.  
 
 On 22 March 2011 06:05, Tom Atkins minkto...@gmail.com wrote:
 I was playing with Flask and I have to say its solution to routing is very 
 nice:
 
 http://flask.pocoo.org/docs/quickstart/#routing
 
 The use of variable names anywhere within the URL structure is very handy. 
 Anything like this possible in web2py?
 
 Flask doesn't really allow variable names anywhere; near as I can tell 
 they're a considerably restricted version of web2py's args list.
 
 
 



[web2py] Re: plugins

2011-03-22 Thread Anthony
Thanks, selecta, this is a great gift to the community. I like how you made 
your application so modular by building plugins, which can then be shared 
with the rest of us. Kudos.
 
Anthony

On Tuesday, March 22, 2011 8:51:43 AM UTC-4, selecta wrote:

 For the the pyMantis project I created the following plugins. Since 
 they are integrated into the access management of pyMantis some of 
 them will need some small modifications to make them work with other 
 applications. 

 download the web2py app package from, the os releases are currently 
 broken but will be fixed in the next days 
 http://pymantis.org/pymantis_server/plugin_release/download 

 plugin_calendar 
 just a test to use the jquery calendar plugin, and some code of the 
 calendar app (???) to create a google like calendar (will need much 
 more development) 

 plugin_chat 
 fb like chat plugin, but for all registered users in one chat (uses 
 simple polling and has some z-index issues, but is already quite cool) 

 plugin_comments 
 my version of the comment plugin (not so great) 

 plugin_doc 
 should automatically create documentation of your web2py app using 
 docstrings (will need much more work, since lib2to3 has to be used 
 (inspection does not work on web2py apps) and I got tied up with other 
 things, but I guess it will be worth it if you need a good looking 
 documentation of you web2py app code) 

 plugin_filepreview 
 create HTML previews of filetypes pdf, doc, xls, images, 

 plugin_forcedirected 
 create forecedirected graphs in your browser using html5 canvas 

 plugin_useradmin 
 a nice visual use admin (create users, edit userinformation, create 
 groups, add/remove users to/from group, block/unblock/validate 
 users, ...) 

 plugin_mailinglist 
 creates a mailinglist/group similar to this one (still under 
 development) 

 plugin_release 
 this is the latest one, and I am quite proud of it 
 creates releases of your software (standalone win, src/linux, mac - 
 w2p packages) with a client and a server instance that allows clients 
 to automatically check for updates of your web2py app with a nice 
 update button 

 plugin_restapidoc 
 create a nice looking documentation of your web2py REST interface 

 plugin_tagging 
 Tagging plugin, this is not the same as the one that is on the plugin 
 list. This one allows you to put multiple tag clouds and forms on one 
 page, it is uses specific and only works for logged in uses. 

 plugin_tagging_hyperlink 
 similar to the above but for hyperlinks 

 plugin_tagging_miriam 
 similar to the above but for MIRIAM annotations (http://biomodels.net/ 
 miriam/ http://biomodels.net/miriam/) needs libSBAnnotation (svn it from 
 https://sourceforge.net/projects/semanticsbml/) 
 in your site-packages (still under development) 

 plugin_tagging_pubmed 
 similar to the above, it uses the PubMed REST interface to get papers 
 from keyword or DOI/pubmed ids 

 plugin_tracker 
 bug tracker (got bored developing it so it is not so good, also 
 depends on plugin_comments...) 

 plugin_webfolder 
 creates a win explorer like webinterface where you can upload your 
 files into a treebases folder structure, use drag and drop to move 
 files, used plugin_filepreview to view files (itegrates with the 
 pyMantis access management, so you will have to modify this plugin if 
 you want to use this in another app) 



Re: [web2py] Re: reddit again

2011-03-22 Thread Thadeus Burgess
I do not bother using reddit for anything other than laughing at some
trollface comics every once in a blue moon.

--
Thadeus




On Tue, Mar 22, 2011 at 9:49 AM, ron_m ron.mco...@gmail.com wrote:

 Maybe they are just jealous they never thought of what you have done before
 you made it a reality with web2py.



[web2py] Re: reddit again

2011-03-22 Thread pbreit
How about video tutorial: Facebook-style friend-feed in web2py


[web2py] Re: Runnning my new app

2011-03-22 Thread Hal Smith
I am supposed to get Hello from my first Web app, but all I see is Hello 
World




From: Anthony abasta...@gmail.com
To: web2py@googlegroups.com
Cc: Hal Smith grownup_...@yahoo.com
Sent: Tue, March 22, 2011 8:51:44 AM
Subject: Re: Runnning my new app


I think you're on the Site page (which shows all your apps). For the app you 
want to test, click the Edit button, which will take you to the app Edit 
page. 
Under Controllers, next to your default.py controller, it should say exposes 
index, [other action], [other action], etc. -- you can click the index link 
(or the link of any action) to visit that page. Actually, if you just want to 
get to the index page, you can simply click the app name on the Site page or 
at the top of the app's Edit page.
 
Anthony

On Tuesday, March 22, 2011 10:09:33 AM UTC-4, Hal Smith wrote:
On page 87 of the manual it says: 

Save it and go back to the edit page. Click on the index link to visit 
the newly 
created page. 

Huh? I can only see compile, and that didn't seem to do much. I want 
to see my Hello, World message.

[web2py] Re: Runnning my new app

2011-03-22 Thread Anthony
On Tuesday, March 22, 2011 11:43:10 AM UTC-4, Hal Smith wrote: 

  I am supposed to get Hello from my first Web app, but all I see is 
 Hello World

 
Are you following the tutorial in the book? Is your new app named myapp? 
If so, make sure the default.py controller that you edited is the one in the 
myapp app (and not the one in the welcome app), and make sure you 
entered the url for myapp -- http://127.0.0.1:8000/myapp/default/index.
 
Anthony


[web2py] Re: Runnning my new app

2011-03-22 Thread DenesL

You will see whatever is being returned from your index function in
controllers/default.py in your application folder, if you want that
message in particular then that line should read:

  return dict(Hello from my first Web app)



On Mar 22, 11:43 am, Hal Smith grownup_...@yahoo.com wrote:
 I am supposed to get Hello from my first Web app, but all I see is Hello
 World



Re: [web2py] Re: new URL router use cases

2011-03-22 Thread Tom Atkins
It uses Werkzeug - full details here:

http://werkzeug.pocoo.org/docs/routing/

On 22 March 2011 14:49, Jonathan Lundell jlund...@pobox.com wrote:


 Maybe so. Is there a formal definition of how Flask's routing works? All I
 could find was a rather brief overview at the quickstart link.




[web2py] Re: reddit again

2011-03-22 Thread VP
I have stated several times that Massimo should be very careful in
advocating for Web2py.  I'm still holding this opinion.  But I won't
elaborate on this.

About the facebook clone.  I do not see anything offensive about this
video.  I thought it's pretty good.  But it can be improved.  How?

Well, Facebook, Reddit, etc. are quite trivial applications in terms
of functionality and features.  But Facebook doesn't work perfectly
and Reddit fails once every other day.  Why?   The answer is
Scalability   These applications are hard to build to withstand a
tremendously large user base.

Here's my suggestion.  I remember Massimo did a Reddit clone once.
Let's redo this.  This will be a hit if done right (the political
climate is right :-)).

The Reddit clone should show these:

1. Expressiveness and conciseness of Web2py.
2. Exhibition of included batteries: form, authentication, permission,
DAL and CRUD.
3. Scalability.

There are many frameworks that will take 2 of these 3 items.  A good
microframework will take 1 and 3 easily.  I think Web2py can leverage
itself to take all 3 items.

Items 1+2 can be easily shown.

But item 3 will take a thoughtful experimental design to show.  And it
might cost some money (but probability not much).Item 3
encapsulates many practical aspects, including deployment.  Possibly,
choose a fast server like nginx, fine tune the set up to produce
optimal results.  And if possible, set up a scenario multiple
replicated databases.

I believe this demonstration will be far better than the mere words of
advocacy for web2py.  The benefits are multi-fold and will affect new
comers and current users (many of whom, I think, are still struggling
or at least tweaking with optimal, scalable deployment of web2py
apps).

Nobody expects that this Reddit clone will replace Reddit (for
instance).   Fortunately (or unfortunately), not many real apps will
have the problem of breaking Reddit frequently is having.  But, many
people will jump in if they see that Web2py is productive, easy and
able to build decently scalable apps.








[web2py] Re: reddit again

2011-03-22 Thread Massimo Di Pierro
Ok, tomorrow.

On Mar 22, 10:34 am, pbreit pbreitenb...@gmail.com wrote:
 How about video tutorial: Facebook-style friend-feed in web2py


[web2py] Re: reddit again

2011-03-22 Thread Massimo Di Pierro

 There is no need to hijack other frameworks'  threads.

For the record. Our thread was hijacked by both Flask and Django.

http://www.reddit.com/r/programming/comments/g875i/building_a_minimalist_facebook_clone_and/c1lnyu8
http://www.reddit.com/r/programming/comments/g875i/building_a_minimalist_facebook_clone_and/c1lqq


In the last year - as far as I remember - I only intervened in threads
about general discussion on web frameworks OR to clarify incorrect
statements made by somebody else about web2py OR after at least two
other frameworks were already mentioned and it turned into a
discussions about web frameworks.

The most recent attack came from an anonymous user who never posted
anything else but negative comments on web2py. I find it odd.

Anyway typical issues people bring up are:

# exec
we do it for a reason: in fact, we are the only framework to allow hot
install, and uninstall of apps in production and without having
sys.path conflict between modules of different apps. the way it is
done does not pose any security risk: we do not exec users'input, only
serverside code. Other frameworks do module reloading. That only works
with Python web servers. That has problems like potential memory leaks
(if imported module instantiates an object with a __del__ method and a
self reference).

# implicit imports
Rails does it too, and it is considered good. Enthought python does it
too and it is considered a flagship product by the python community.

# models and controllers are not python modules
No, they are not. Templates are not python modules in any framework,
why should models and controllers be? They are not Ruby modules in
Rails. That is because they also require a context to run: the http
request.

# web2py is a Domain Specific Language
If it were, there would be nothing bad. Yet, it is not. We use pure
Python language everywhere as opposed to other frameworks who indeed
use a domain specific language (not python) for configuration files
and yet another for templates.

# we by-pass normal imports
No. we have implicit imports (as mentioned above) and they are well
documented. web2py supports normal imports as any other python
program. We also have an additional method called local_import as a
convenience shortcut to avoid problems with the fact that sys.path is
not thread safe.

# web2py is not packaged as other web framework
True. We will change that. Yet the current packaging is particularly
convenient to new users. Some assume that because we ship all modules
together, those modules do not work independently outside web2py but,
in fact, they do.

# web2py is not perfect
True. Nothing is. It may not be for everybody. If it is not for you do
not use but do not complain about the people who made it available to
you for free.

# we attack other frameworks
Never. At most we pointed out that some of them do not seem to take
usability for new users at heart and we think that is important. Being
easy to use means lower development and maintenance costs. I also
think that some of them do a veyr poor job at backward compatibility
but I do not think I ever pointed that out outside this list.

Massimo


[web2py] Re: GSOC 2011 - BioChemical Reaction Network Visualization - web2py

2011-03-22 Thread Massimo Di Pierro
Congratulations!

On Mar 22, 8:59 am, selecta gr...@delarue-berlin.de wrote:
 Hi web2py coders,
 I am very happy to tell you that my group - Theoretical Biophysics at
 the HU-Berlin - got selected for a mentoring program for the GSOC2011
 (http://code.google.com/soc/). We want to create an new layout
 algorithm for biochemical reaction networks, a visualization of the
 reaction network using SVG and SBGN and a web based (js) SVG editor
 for the reaction networks.

 One of the software tools that we would need is a communication layer
 that brings the graph visualization to the browser. Since we develop a
 lot of software in our group with the help of web2py it would be great
 if one of you would be interested in helping us to achieve our vision.
 The work will have to be done within two month during the summer and
 you would get payed a nice amount of money by google.

 You will find more information about our GSOC project 
 herehttp://rumo.biologie.hu-berlin.de/gsoc/(read especially Idea 3)

 If you are interested and you want to discuss ideas with us 
 joinhttp://groups.google.com/group/tbp-soc2011-stud

 Please be aware that if you want to join you should bring some coding
 skills. In addition to that please be aware that Idea 3 does not have
 the highest priority since it depends on other components (layout
 algorithm and SVG rendering) which some of you might also be
 interested in.


[web2py] Re: reddit again

2011-03-22 Thread Massimo Di Pierro
On Mar 22, 9:49 am, ron_m ron.mco...@gmail.com wrote:
 Maybe they are just jealous they never thought of what you have done before 
 you made it a reality with web2py.


I do not think that is it.

I accept the fact that some people truly do not like web2py and that
is ok. Every design decision is a compromise. There are parts I do not
like (although as whole I like it better than the alternatives, of
course).

The problem is that we always the people who scream the most. And
those who scream the most are not agnostic users looking for the best
tool for the job. They are people with something at stake in the
relative success of web framework (and I guess I am one these people).
With two exception (one being me) these people are not even the
creators of the framework they try to bolster, they just act as such
and make profit from it. I do not blame them either.

Only three things bother me:
- when people make false statements
- when people who have a professional responsibility within the Python
community make statements that are divisive and not inclusive (luckily
this is very rare)
- when people accuse me (or somebody else) of doing what they do.


[web2py] Re: the facebook clone video

2011-03-22 Thread Massimo Di Pierro
http://imgur.com/LTH2X


[web2py] 1.94.5 auth pb form won't submit

2011-03-22 Thread Richard Vézina
Hello,

None of my form won't submit anymore when I try my app under 1.94.5...

It seems to be related to auth problem coming from the refactoring.

Here a example of form, model and trace that occure :

Traceback (most recent call last):
  File
/home/richard/Documents/programmation/version_194-5/web2py/gluon/restricted.py,
line 188, in restricted
exec ccode in environment
  File
/home/richard/Documents/programmation/version_194-5/web2py/applications/sgddms/controllers/ref.py,
line 229, in module
  File
/home/richard/Documents/programmation/version_194-5/web2py/gluon/globals.py,
line 124, in lambda
self._caller = lambda f: f()
  File
/home/richard/Documents/programmation/version_194-5/web2py/gluon/tools.py,
line 2331, in f
return action(*a, **b)
  File
/home/richard/Documents/programmation/version_194-5/web2py/applications/sgddms/controllers/ref.py,
line 26, in create
if form.accepts(request.vars, session):
  File
/home/richard/Documents/programmation/version_194-5/web2py/gluon/sqlhtml.py,
line 1197, in accepts
self.vars.id = self.table.insert(**fields)
  File
/home/richard/Documents/programmation/version_194-5/web2py/gluon/dal.py,
line 4341, in insert
return self._db._adapter.insert(self,self._listify(fields))
  File
/home/richard/Documents/programmation/version_194-5/web2py/gluon/dal.py,
line 4334, in _listify
raise SyntaxError,'Table: missing required field: %s' % ofield.name
SyntaxError: Table: missing required field: seizure


### Model ###
# ref_fnaregistry
db.define_table('ref_fnaregistry',
Field('fnaregistry_id','id'),
Field('num_part1','string',
length=20,
notnull=True,
requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
required=True
),
Field('num_part2','string',
length=20,
notnull=True,
requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
required=True
),
Field('num_part3','string',
length=20,
notnull=True,
requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
required=True
),
Field('title','text'),
Field('att_date','date',
notnull=True,
requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty')),
IS_DATE(format=T('%Y-%m-%d'),error_message=T('valid date of
format : -MM-DD!'))],
required=True
),
Field('seizure','db.auth_user',
readable=False,
writable=False,
default=auth.user and auth.user.id,
notnull=True,
requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
required=True
),
Field('seizure_date','date',
readable=False,
writable=False,
default=request.now,
notnull=True,
requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
required=True
),
Field('last_action_by','db.auth_user',
readable=False,
writable=False,
default=auth.user and auth.user.id,
update=auth.user and auth.user.id,
notnull=True,
requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
required=True
),
Field('sdate','datetime',
readable=False,
writable=False,
default=request.now,
update=request.now,
notnull=True,
requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
required=True
),
migrate=False,
sequence_name='ref_fnaregistry_fnaregistry_id_seq',
format=lambda row: '%s-%s-%s / %s'\

%(row.num_part1.rstrip(),row.num_part2.rstrip(),row.num_part3.rstrip(),row.title.rstrip()))

### Controller ###

@auth.requires_login()
def create():
if request.args(0) in ref_tables_list:
redirection_argument=request.args(0)
if en_ui_tables_names[request.args(0)]!=None :
table_name = str.lower(en_ui_tables_names[request.args(0)])
else:
table_name = request.args(0).replace('ref_','')
page_title=T('Form for : ')
if auth.has_membership(auth.id_group('admin')):
crud.settings.formstyle='divs'
form = crud.create(db[request.args(0)])
elif auth.has_membership(auth.id_group('technician')):
crud.settings.formstyle='divs'
form = crud.create(db[request.args(0)])
elif auth.has_membership(auth.id_group('technician_c')):
crud.settings.formstyle='divs'
form = crud.create(db[request.args(0)])
else:
return
dict(form=None,page_title=page_title,table_name=table_name,\
not_allow_permission='you are not allow
(permission)',permission_denied='Permission denied')
if form.accepts(request.vars, session):
response.flash = T('form accepted')
redirect(URL(r=request, f='read/'+redirection_argument,args=
form.vars.id))
elif form.errors:
response.flash = 

[web2py] [OT] Free Software University

2011-03-22 Thread Luis Díaz
Greetings!
I do not remember if I comment the following draft
http://www.freesoftwareuni.com/

well, the area is very active python ..
all have good intentions and desire to contribute with ideas, time and
effort.

in my humble opinion, propose and design something related to web2py
would be great.
I make the comment because I'm no expert, but this group if there are people
who can ..

so I invite you to participate!
---


saludos!
no recuerd si les comente el siguiente proyecto
http://www.freesoftwareuni.com/

bueno, el area de python esta muy activa..
todos tienen buenas intensiones y ganas de aportar con ideas, tiempo y
esfuerzo.

en mi humilde opinion, proponer y diseñar algo relacionado con web2py
seria genial.
hago el comentario, porque no soy experto, pero este grupo si que existen
personas capaces..

por lo cual les invito a participar!


Díaz Luis
http://www.facebook.com/diazluis2007
TSU Analisis de Sistemas
Universidad de Carabobo
Facultad de 
Odontologíahttp://www.odontologia.uc.edu.ve/index.php?option=com_contentview=articleid=102Itemid=85


[web2py] Re: can web2py internal webserver handle serveral requests in parallel?

2011-03-22 Thread Ross Peoples
To answer simply, yes the embedded Rocket server will handle 
multiple simultaneous requests. However, if you have long-running processes, 
they may force Rocket to wait until they are finished before responding to 
additional requests. This is easy to overcome by using Python's multiprocess 
module. For example, I have a script to batch insert a bunch of records into 
the database. The script takes about a minute to run and is started by an 
ajax call. So in web2py, I created a scripts.py module and imports 
multiprocessing, then subclasses the Process class.

When the ajax call comes in, web2py instantiates my script module, then 
calls run() to start a new process that does all the work. The moment that 
run() is called, execution continues so that other incoming requests can be 
handled and the script runs in the background. Just for fun, I also made my 
script report progress so that another ajax call could get the status of it.


[web2py] Re: can web2py internal webserver handle serveral requests in parallel?

2011-03-22 Thread olivier
thanks for the answer.
I will follow your advice!

On Mar 22, 6:59 pm, Ross Peoples ross.peop...@gmail.com wrote:
 To answer simply, yes the embedded Rocket server will handle
 multiple simultaneous requests. However, if you have long-running processes,
 they may force Rocket to wait until they are finished before responding to
 additional requests. This is easy to overcome by using Python's multiprocess
 module. For example, I have a script to batch insert a bunch of records into
 the database. The script takes about a minute to run and is started by an
 ajax call. So in web2py, I created a scripts.py module and imports
 multiprocessing, then subclasses the Process class.

 When the ajax call comes in, web2py instantiates my script module, then
 calls run() to start a new process that does all the work. The moment that
 run() is called, execution continues so that other incoming requests can be
 handled and the script runs in the background. Just for fun, I also made my
 script report progress so that another ajax call could get the status of it.


[web2py] web2py default application suggestion

2011-03-22 Thread Keith Pettit
I'm fairly new to web2py and had a question early on.  How could I make a 
app I created in web2py show up by default.  Not that I didn't like the 
welcome app but I wanted to set my own as default.

Somebody in IRC #web2py told me to rename my app to init which worked. 
 There wasn't a way I saw in the web admin to do that so I just did it in 
the commandline.  So based on that experience to make it easier I would 
suggest the following:

1) In the admin allow users to rename applications
2) in the admin allow users to select a default application. I think that 
would be nicer than renaming a app with a useful name to init.

Thanks for taking the time.


[web2py] Re: the facebook clone video

2011-03-22 Thread Ross Peoples
You've got to admit that it's kind of funny that someone always asks
about the recording script every time you post one of these videos.
You must be doing something right :)

On Mar 21, 2:19 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 http://blip.tv/file/4912976


[web2py] How do I set web2py applications as separate virtualhosts?

2011-03-22 Thread Keith Pettit
Web2py works great for me through Apache and mod_wsgi.  All seems fast and 
clean.  But now that I'm creating multiple web2py applications.  How can I 
deploy multiple web2py applications as separate virtualhosts?

Basically I want to do something like:

app1.mydomain.com goes to App1
app2.mydomain.com goes to App2
etc

Normally in Apache I would create separate virtualhost directives and point 
them to the directory where the code is.  But I wasn't sure how to do that 
with web2py without copying the entire web2py directory and renaming the 
application I want to show as init.  What's the best way to do things when 
you need to update code and develop frequently?

Thanks,



Re: [web2py] static subdirectories

2011-03-22 Thread pbreit
Would there be any way to support something like:

/$user/app/controller/function

Where $user is available to controllers as some sort of arg?

I could see your idea about re-formatting the URL to: 
/app/controller/function/$user but am wondering if that will be hard to 
manage?


[web2py] Re: web2py default application suggestion

2011-03-22 Thread Ross Peoples
I had a similar question as you a few weeks ago. I can tell you that
the reason why admin doesn't allow you to select a default application
is because admin would have to edit routes.py, which could break
everything if not done right and it also requires a server restart, so
that's why no one has added that functionality.

Setting the name of your app to 'init' is the easiest way to make it
default. Although if you want to keep your application's name, you can
create or modify routes.py in the web2py folder (not your application
folder) with the following contents:

routers = dict(
BASE = dict(
default_application='MyApp',
)
)

Obviously, you'd want to replace MyApp with your application's name.
Be sure to restart the web2py server for the changes to take effect.
You should now be able to go to http://127.0.0.1:8000 which should
take you to your application's default/index.

On Mar 22, 6:04 pm, Keith Pettit keith.pet...@prodesy.com wrote:
 I'm fairly new to web2py and had a question early on.  How could I make a
 app I created in web2py show up by default.  Not that I didn't like the
 welcome app but I wanted to set my own as default.

 Somebody in IRC #web2py told me to rename my app to init which worked.
  There wasn't a way I saw in the web admin to do that so I just did it in
 the commandline.  So based on that experience to make it easier I would
 suggest the following:

 1) In the admin allow users to rename applications
 2) in the admin allow users to select a default application. I think that
 would be nicer than renaming a app with a useful name to init.

 Thanks for taking the time.


[web2py] Re: How do I set web2py applications as separate virtualhosts?

2011-03-22 Thread pbreit
I believe the new router supports that. Check 
out: https://groups.google.com/d/topic/web2py/LdjhUWCWmnw/discussion

[web2py] Re: How do I set web2py applications as separate virtualhosts?

2011-03-22 Thread Ross Peoples
I tried this once and it failed terribly. I would also like to know
how this would work.

On Mar 22, 6:12 pm, Keith Pettit keith.pet...@prodesy.com wrote:
 Web2py works great for me through Apache and mod_wsgi.  All seems fast and
 clean.  But now that I'm creating multiple web2py applications.  How can I
 deploy multiple web2py applications as separate virtualhosts?

 Basically I want to do something like:

 app1.mydomain.com goes to App1
 app2.mydomain.com goes to App2
 etc

 Normally in Apache I would create separate virtualhost directives and point
 them to the directory where the code is.  But I wasn't sure how to do that
 with web2py without copying the entire web2py directory and renaming the
 application I want to show as init.  What's the best way to do things when
 you need to update code and develop frequently?

 Thanks,


[web2py] Re: reddit again

2011-03-22 Thread pbreit
It definitely would be nice if we could point to at least one high volume 
web2py-based site. A Reddit/Digg/HackerNews-type site might make sense. 
Although I'm wondering if we would be able to get much traffic?

It also would be nice if we had some core apps available such as CMS, Blog, 
Forums, Wiki. If we had a Wiki, we could use it for slices.

It would be nice if the book and/or the book app was open-sourced and/or 
forkable.


Re: [web2py] How do I set web2py applications as separate virtualhosts?

2011-03-22 Thread David J.


Look at the routes; you can do this;

Chapter 4 of the book.


On 3/22/11 2:12 PM, Keith Pettit wrote:
Web2py works great for me through Apache and mod_wsgi.  All seems fast 
and clean.  But now that I'm creating multiple web2py applications. 
 How can I deploy multiple web2py applications as separate virtualhosts?


Basically I want to do something like:

app1.mydomain.com goes to App1
app2.mydomain.com goes to App2
etc

Normally in Apache I would create separate virtualhost directives and 
point them to the directory where the code is.  But I wasn't sure how 
to do that with web2py without copying the entire web2py directory and 
renaming the application I want to show as init.  What's the best 
way to do things when you need to update code and develop frequently?


Thanks,





Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread Keith Pettit
That worked.  Thank you for the help.

Just a note, in my default install of web2py there was a
router.example.py -AND-
routes.example.py

In the examples there router.example.py had exactly what you suggested so I
tried that and renamed it to router.py which didn't work.  I created a new
file like you suggested called routes.py which did work.  It's kind of
confusing with the two examples that don't quite work so I thought I'd
mention it.

Thanks for the help,

-Keith

On Tue, Mar 22, 2011 at 1:14 PM, Ross Peoples ross.peop...@gmail.comwrote:

 I had a similar question as you a few weeks ago. I can tell you that
 the reason why admin doesn't allow you to select a default application
 is because admin would have to edit routes.py, which could break
 everything if not done right and it also requires a server restart, so
 that's why no one has added that functionality.

 Setting the name of your app to 'init' is the easiest way to make it
 default. Although if you want to keep your application's name, you can
 create or modify routes.py in the web2py folder (not your application
 folder) with the following contents:

 routers = dict(
BASE = dict(
default_application='MyApp',
)
 )

 Obviously, you'd want to replace MyApp with your application's name.
 Be sure to restart the web2py server for the changes to take effect.
 You should now be able to go to http://127.0.0.1:8000 which should
 take you to your application's default/index.

 On Mar 22, 6:04 pm, Keith Pettit keith.pet...@prodesy.com wrote:
  I'm fairly new to web2py and had a question early on.  How could I make a
  app I created in web2py show up by default.  Not that I didn't like the
  welcome app but I wanted to set my own as default.
 
  Somebody in IRC #web2py told me to rename my app to init which worked.
   There wasn't a way I saw in the web admin to do that so I just did it in
  the commandline.  So based on that experience to make it easier I would
  suggest the following:
 
  1) In the admin allow users to rename applications
  2) in the admin allow users to select a default application. I think
 that
  would be nicer than renaming a app with a useful name to init.
 
  Thanks for taking the time.




-- 
Keith Pettit
Prodesy Tech Inc.
keith.pet...@prodesy.com
832-200-6153 x2307


Re: [web2py] Re: How do I set web2py applications as separate virtualhosts?

2011-03-22 Thread David J.

Look at the routes.py in chapter 4 of the book.

I just did it this morning and it work using the that latest version of 
web2py


(Know that you have to name the file routes.py even though its in the 
router.py.example; and you might think to name it router.py and thus 
think it does not work.)


I think it says in the book it is interchangeable;




On 3/22/11 2:17 PM, Ross Peoples wrote:

I tried this once and it failed terribly. I would also like to know
how this would work.

On Mar 22, 6:12 pm, Keith Pettitkeith.pet...@prodesy.com  wrote:

Web2py works great for me through Apache and mod_wsgi.  All seems fast and
clean.  But now that I'm creating multiple web2py applications.  How can I
deploy multiple web2py applications as separate virtualhosts?

Basically I want to do something like:

app1.mydomain.com goes to App1
app2.mydomain.com goes to App2
etc

Normally in Apache I would create separate virtualhost directives and point
them to the directory where the code is.  But I wasn't sure how to do that
with web2py without copying the entire web2py directory and renaming the
application I want to show as init.  What's the best way to do things when
you need to update code and develop frequently?

Thanks,




[web2py] Re: reddit again

2011-03-22 Thread pbreit
Except that you have to be careful when you accuse people of making false 
statements. For example, pointing out that templates usually aren't python 
modules either is missing the point.

Also, on #3, just take the high road. Pointing out that other people 
supposedly do the same bad behavior is not going to go very far.


Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread pbreit
I presume those files will be consolidated at some point?

Re: [web2py] static subdirectories

2011-03-22 Thread David J.

The former is semantically more correct;

$user/app/controller/etc...

It seems the domain is obviously the root of any app; then the user 
selected name should be the next logical level; then any functions that 
user has access to should be listed;




On 3/22/11 2:12 PM, pbreit wrote:

Would there be any way to support something like:

/$user/app/controller/function

Where $user is available to controllers as some sort of arg?

I could see your idea about re-formatting the URL to: 
/app/controller/function/$user but am wondering if that will be hard 
to manage?




Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread Ross Peoples
I'm not quite sure what the deal is with that. I think one of the two files is 
from the old routers file and just never got cleaned up.

On Mar 22, 2011, at 2:27 PM, Keith Pettit wrote:

 That worked.  Thank you for the help.  
 
 Just a note, in my default install of web2py there was a 
 router.example.py -AND-
 routes.example.py
 
 In the examples there router.example.py had exactly what you suggested so I 
 tried that and renamed it to router.py which didn't work.  I created a new 
 file like you suggested called routes.py which did work.  It's kind of 
 confusing with the two examples that don't quite work so I thought I'd 
 mention it.
 
 Thanks for the help,
 
 -Keith
 
 On Tue, Mar 22, 2011 at 1:14 PM, Ross Peoples ross.peop...@gmail.com wrote:
 I had a similar question as you a few weeks ago. I can tell you that
 the reason why admin doesn't allow you to select a default application
 is because admin would have to edit routes.py, which could break
 everything if not done right and it also requires a server restart, so
 that's why no one has added that functionality.
 
 Setting the name of your app to 'init' is the easiest way to make it
 default. Although if you want to keep your application's name, you can
 create or modify routes.py in the web2py folder (not your application
 folder) with the following contents:
 
 routers = dict(
BASE = dict(
default_application='MyApp',
)
 )
 
 Obviously, you'd want to replace MyApp with your application's name.
 Be sure to restart the web2py server for the changes to take effect.
 You should now be able to go to http://127.0.0.1:8000 which should
 take you to your application's default/index.
 
 On Mar 22, 6:04 pm, Keith Pettit keith.pet...@prodesy.com wrote:
  I'm fairly new to web2py and had a question early on.  How could I make a
  app I created in web2py show up by default.  Not that I didn't like the
  welcome app but I wanted to set my own as default.
 
  Somebody in IRC #web2py told me to rename my app to init which worked.
   There wasn't a way I saw in the web admin to do that so I just did it in
  the commandline.  So based on that experience to make it easier I would
  suggest the following:
 
  1) In the admin allow users to rename applications
  2) in the admin allow users to select a default application. I think that
  would be nicer than renaming a app with a useful name to init.
 
  Thanks for taking the time.
 
 
 
 -- 
 Keith Pettit
 Prodesy Tech Inc.
 keith.pet...@prodesy.com
 832-200-6153 x2307
 



Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread Keith Pettit
One other note.  For both apache and web2py's built in webserver I had to
restart them for the change to take effect.  Just thought I'd mention that
in case someone wonders why there change isn't showing.

-Keith

On Tue, Mar 22, 2011 at 1:30 PM, Ross Peoples ross.peop...@gmail.comwrote:

 I'm not quite sure what the deal is with that. I think one of the two files
 is from the old routers file and just never got cleaned up.

 On Mar 22, 2011, at 2:27 PM, Keith Pettit wrote:

 That worked.  Thank you for the help.

 Just a note, in my default install of web2py there was a
 router.example.py -AND-
 routes.example.py

 In the examples there router.example.py had exactly what you suggested so
 I tried that and renamed it to router.py which didn't work.  I created a new
 file like you suggested called routes.py which did work.  It's kind of
 confusing with the two examples that don't quite work so I thought I'd
 mention it.

 Thanks for the help,

 -Keith

 On Tue, Mar 22, 2011 at 1:14 PM, Ross Peoples ross.peop...@gmail.comwrote:

 I had a similar question as you a few weeks ago. I can tell you that
 the reason why admin doesn't allow you to select a default application
 is because admin would have to edit routes.py, which could break
 everything if not done right and it also requires a server restart, so
 that's why no one has added that functionality.

 Setting the name of your app to 'init' is the easiest way to make it
 default. Although if you want to keep your application's name, you can
 create or modify routes.py in the web2py folder (not your application
 folder) with the following contents:

 routers = dict(
BASE = dict(
default_application='MyApp',
)
 )

 Obviously, you'd want to replace MyApp with your application's name.
 Be sure to restart the web2py server for the changes to take effect.
 You should now be able to go to http://127.0.0.1:8000 which should
 take you to your application's default/index.

 On Mar 22, 6:04 pm, Keith Pettit keith.pet...@prodesy.com wrote:
  I'm fairly new to web2py and had a question early on.  How could I make
 a
  app I created in web2py show up by default.  Not that I didn't like the
  welcome app but I wanted to set my own as default.
 
  Somebody in IRC #web2py told me to rename my app to init which worked.
   There wasn't a way I saw in the web admin to do that so I just did it
 in
  the commandline.  So based on that experience to make it easier I would
  suggest the following:
 
  1) In the admin allow users to rename applications
  2) in the admin allow users to select a default application. I think
 that
  would be nicer than renaming a app with a useful name to init.
 
  Thanks for taking the time.




 --
 Keith Pettit
 Prodesy Tech Inc.
 keith.pet...@prodesy.com
 832-200-6153 x2307





-- 
Keith Pettit
Prodesy Tech Inc.
keith.pet...@prodesy.com
832-200-6153 x2307


Re: [web2py] static subdirectories

2011-03-22 Thread Jonathan Lundell
On Mar 22, 2011, at 11:12 AM, pbreit wrote:

 Would there be any way to support something like:
 
 /$user/app/controller/function
 
 Where $user is available to controllers as some sort of arg?
 
 I could see your idea about re-formatting the URL to: 
 /app/controller/function/$user but am wondering if that will be hard to 
 manage?

I think that the only way to do it right now is by using the regex router to 
rewrite the URL, as above ($user should end up in request.args). I don't think 
it'd be all that hard to manage. You'd want to establish some rule for 
recognizing the case where the first element isn't a $user (say on initial 
login).

[web2py] Re: 1.94.5 auth pb form won't submit

2011-03-22 Thread Massimo Di Pierro
This should never have worked:

Field('seizure_date','date',
writable=False,
...
required=True
),

the field is not writable (so it does not appear in form) and yet it
is required (must have a value when doing insert).

On Mar 22, 11:49 am, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 Hello,

 None of my form won't submit anymore when I try my app under 1.94.5...

 It seems to be related to auth problem coming from the refactoring.

 Here a example of form, model and trace that occure :

 Traceback (most recent call last):
   File
 /home/richard/Documents/programmation/version_194-5/web2py/gluon/restricte 
 d.py,
 line 188, in restricted
     exec ccode in environment
   File
 /home/richard/Documents/programmation/version_194-5/web2py/applications/sg 
 ddms/controllers/ref.py,
 line 229, in module
   File
 /home/richard/Documents/programmation/version_194-5/web2py/gluon/globals.p 
 y,
 line 124, in lambda
     self._caller = lambda f: f()
   File
 /home/richard/Documents/programmation/version_194-5/web2py/gluon/tools.py ,
 line 2331, in f
     return action(*a, **b)
   File
 /home/richard/Documents/programmation/version_194-5/web2py/applications/sg 
 ddms/controllers/ref.py,
 line 26, in create
     if form.accepts(request.vars, session):
   File
 /home/richard/Documents/programmation/version_194-5/web2py/gluon/sqlhtml.p 
 y,
 line 1197, in accepts
     self.vars.id = self.table.insert(**fields)
   File
 /home/richard/Documents/programmation/version_194-5/web2py/gluon/dal.py,
 line 4341, in insert
     return self._db._adapter.insert(self,self._listify(fields))
   File
 /home/richard/Documents/programmation/version_194-5/web2py/gluon/dal.py,
 line 4334, in _listify
     raise SyntaxError,'Table: missing required field: %s' % ofield.name
 SyntaxError: Table: missing required field: seizure

 ### Model ###
 # ref_fnaregistry
 db.define_table('ref_fnaregistry',
     Field('fnaregistry_id','id'),
     Field('num_part1','string',
         length=20,
         notnull=True,
         requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
         required=True
         ),
     Field('num_part2','string',
         length=20,
         notnull=True,
         requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
         required=True
         ),
     Field('num_part3','string',
         length=20,
         notnull=True,
         requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
         required=True
         ),
     Field('title','text'),
     Field('att_date','date',
         notnull=True,
         requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty')),
             IS_DATE(format=T('%Y-%m-%d'),error_message=T('valid date of
 format : -MM-DD!'))],
         required=True
         ),
     Field('seizure','db.auth_user',
         readable=False,
         writable=False,
         default=auth.user and auth.user.id,
         notnull=True,
         requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
         required=True
         ),
     Field('seizure_date','date',
         readable=False,
         writable=False,
         default=request.now,
         notnull=True,
         requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
         required=True
         ),
     Field('last_action_by','db.auth_user',
         readable=False,
         writable=False,
         default=auth.user and auth.user.id,
         update=auth.user and auth.user.id,
         notnull=True,
         requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
         required=True
         ),
     Field('sdate','datetime',
         readable=False,
         writable=False,
         default=request.now,
         update=request.now,
         notnull=True,
         requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty'))],
         required=True
         ),
     migrate=False,
     sequence_name='ref_fnaregistry_fnaregistry_id_seq',
     format=lambda row: '%s-%s-%s / %s'\

 %(row.num_part1.rstrip(),row.num_part2.rstrip(),row.num_part3.rstrip(),row. 
 title.rstrip()))

 ### Controller ###

 @auth.requires_login()
 def create():
     if request.args(0) in ref_tables_list:
         redirection_argument=request.args(0)
         if en_ui_tables_names[request.args(0)]!=None :
             table_name = str.lower(en_ui_tables_names[request.args(0)])
         else:
             table_name = request.args(0).replace('ref_','')
         page_title=T('Form for : ')
         if auth.has_membership(auth.id_group('admin')):
             crud.settings.formstyle='divs'
             form = crud.create(db[request.args(0)])
         elif auth.has_membership(auth.id_group('technician')):
             crud.settings.formstyle='divs'
             form = crud.create(db[request.args(0)])
         elif auth.has_membership(auth.id_group('technician_c')):
             crud.settings.formstyle='divs'
             form = 

[web2py] Re: can web2py internal webserver handle serveral requests in parallel?

2011-03-22 Thread Massimo Di Pierro
The only caveat is that - unless you unlock them - session are locked.
Therefore the same user cannot request two pages at the same time.
This in order to guarantee data integrity in sessions.

BTW: Other frameworks that store session in cookies do not guarantee
data integrity in sessions.

On Mar 21, 4:37 pm, olivier odema...@gmail.com wrote:
 I plan to use web2py as a simple desktop app service (using the
 packaged web2py for windows).
 Will the web server (I don't know which server ships in the stand
 alone version) handle several requests in parallel if I use ajax calls
 to several controller functions?

 I am wondering if this could be an easy way to launch different
 webcrawls from a page - by hitting a controller function with
 differents parameters - and easily scale the app by leveraging the
 multiprocess/multithread aspect of the web server. Am I assuming
 something wrong here?

 Thanks!


Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread Jonathan Lundell
On Mar 22, 2011, at 11:30 AM, Ross Peoples wrote:

 I'm not quite sure what the deal is with that. I think one of the two files 
 is from the old routers file and just never got cleaned up.

They're both available. The regex router (routes.example.py) is still 
available, and it can do things that the new router cannot.

The tradeoff is that, for the things that the new router can do, it does them 
very easily, and some of what it does would be difficult or impossible for the 
regex router to do. But there's a motivation for both.

However, they can't be mixed.

Re: [web2py] Re: web2py applications and version control systems

2011-03-22 Thread howesc
Just note that in this case you are using web2py *trunk*.  this is not 
acceptable (or recommended) for most production deployments.

that's why i download and unzip the specific release version i'm looking 
for.

cfh


[web2py] Re: can web2py internal webserver handle serveral requests in parallel?

2011-03-22 Thread Anthony
On Tuesday, March 22, 2011 2:39:45 PM UTC-4, Massimo Di Pierro wrote: 

 The only caveat is that - unless you unlock them - session are locked. 
 Therefore the same user cannot request two pages at the same time. 
 This in order to guarantee data integrity in sessions.

 
With the new changes in 1.94.5, is the session file still locked for every 
request, even if nothing is saved to the session, or does it only get locked 
if something is actually saved/changed?
 
Thanks.
 
Anthony


[web2py] Re: can web2py internal webserver handle serveral requests in parallel?

2011-03-22 Thread Massimo Di Pierro
web2py does not know whether the session is going to change or not so it locks 
even if does not save it. To change it call session._unlock(request)

On Mar 22, 2011, at 2:18 PM, Anthony wrote:

 On Tuesday, March 22, 2011 2:39:45 PM UTC-4, Massimo Di Pierro wrote:
 The only caveat is that - unless you unlock them - session are locked. 
 Therefore the same user cannot request two pages at the same time. 
 This in order to guarantee data integrity in sessions.
  
 With the new changes in 1.94.5, is the session file still locked for every 
 request, even if nothing is saved to the session, or does it only get locked 
 if something is actually saved/changed?
  
 Thanks.
  
 Anthony



[web2py] pass variables to update() and insert() functions

2011-03-22 Thread LightOfMooN
I have table with too much cols.
So, is there a way to pass variable names and values in the insert()
or update() methods like this?


options_house =
db(db.company_houses_options.company_id==company.id).select().first()
if request.vars.edit_options_house:
houses_options={}
for column_name in houses_columns:
if request.vars.get(column_name, None):
houses_options[column_name]=True
else:
houses_options[column_name]=False
options_house.update_record(houses_options)

where houses_columns is a list of columns names like
['street','house','block','buildyear',...]


Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread Anthony

On Tuesday, March 22, 2011 2:27:52 PM UTC-4, Keith Pettit wrote: 

 That worked.  Thank you for the help.   

 Just a note, in my default install of web2py there was a  
 router.example.py -AND-
 routes.example.py

 In the examples there router.example.py had exactly what you suggested so 
 I tried that and renamed it to router.py which didn't work.  I created a new 
 file like you suggested called routes.py which did work.  It's kind of 
 confusing with the two examples that don't quite work so I thought I'd 
 mention it.

 
Yes, that is confusing. There are two separate routing systems, as described 
here: http://web2py.com/book/default/chapter/04#URL-Rewrite. You have to use 
one or the other -- you can't mix them. 'routes.example.py' includes 
examples of the older pattern-based system, and 'router.example.py' contains 
examples of the newer parameter-based system. You would think renaming 
'router.example.py' to 'router.py' would be the thing to do, but in fact, 
regardless of which system you use, you have to rename the file to 
'routes.py' (otherwise, if both files existed, web2py wouldn't know which 
one to use). For clarity, we should probably change the names of the two 
example files to something like 'routes.pattern_example.py' and 
'routes.parameter_example.py' -- that will make it more clear what is in 
each and that both need to be renamed to 'routes.py'.
 
Anthony


[web2py] Re: can web2py internal webserver handle serveral requests in parallel?

2011-03-22 Thread Anthony
Got it. Thanks.

On Tuesday, March 22, 2011 3:27:20 PM UTC-4, Massimo Di Pierro wrote:

 web2py does not know whether the session is going to change or not so it 
 locks even if does not save it. To change it call session._unlock(request) 

  On Mar 22, 2011, at 2:18 PM, Anthony wrote:

 On Tuesday, March 22, 2011 2:39:45 PM UTC-4, Massimo Di Pierro wrote: 

 The only caveat is that - unless you unlock them - session are locked. 
 Therefore the same user cannot request two pages at the same time. 
 This in order to guarantee data integrity in sessions.

  
 With the new changes in 1.94.5, is the session file still locked for every 
 request, even if nothing is saved to the session, or does it only get locked 
 if something is actually saved/changed?
  
 Thanks.
  
 Anthony




[web2py] Re: reddit again

2011-03-22 Thread Anthony
Book app: http://web2py.com/appliances/default/show/59
Blog/CMS: http://instant2press.appspot.com/
Forum: http://pyforum.org/
QA: http://beta.qa-stack.com/
Wiki: plugin_wiki
 
Check out http://web2py.com/poweredby and http://web2py.com/appliances.
 
Bruno and Martin are working on a whole new slices site (much more than just 
a wiki).
 
Anthony

On Tuesday, March 22, 2011 2:25:21 PM UTC-4, pbreit wrote:

 It definitely would be nice if we could point to at least one high volume 
 web2py-based site. A Reddit/Digg/HackerNews-type site might make sense. 
 Although I'm wondering if we would be able to get much traffic? 

 It also would be nice if we had some core apps available such as CMS, Blog, 
 Forums, Wiki. If we had a Wiki, we could use it for slices.

 It would be nice if the book and/or the book app was open-sourced and/or 
 forkable.



[web2py] Re: pass variables to update() and insert() functions

2011-03-22 Thread Anthony
On Tuesday, March 22, 2011 3:28:20 PM UTC-4, LightOfMooN wrote: 

 I have table with too much cols. 
 So, is there a way to pass variable names and values in the insert() 
 or update() methods like this? 


 options_house = 
 db(db.company_houses_options.company_id==company.id).select().first() 
 if request.vars.edit_options_house: 
 houses_options={} 
 for column_name in houses_columns: 
 if request.vars.get(column_name, None): 
 houses_options[column_name]=True 
 else: 
 houses_options[column_name]=False 
 options_house.update_record(houses_options) 

 where houses_columns is a list of columns names like 
 ['street','house','block','buildyear',...]

 
In Python, I think you can pass a dict preceded by ** to a function and the 
dict will be separated into a set of keyword args. So, you would do:
 
options_house.update_record(**house_options)
 
I think that would work.
 
Anthony


[web2py] Re: pass variables to update() and insert() functions

2011-03-22 Thread mart
I use this as a generic function table names are variables (I use a
shortcut -so other modules can just do select(x,y) or update(x,y,z). I
guess the same can be extended a little bit to make use/enable more
variables...

   def updateStorage(self,tbl,name,value,cmdName=None):
db = self.db
id = None
rowID = None
for mTbl in db.tables:
if tbl in mTbl:
if mTbl.startswith(tbl):
rows = db(db[mTbl].name==name).select()
for row in rows:
if row.name == name and row.value  0:
id = row.id
if id != None:
rowID =
db(db[tbl].name==name).update(name=name,value=value)
else:
rowID = db[tbl].insert(name=name,value=value)
if cmdName is not None:
 
db(db[tbl].id==rowID).update(cmdName=cmdName)
db.commit()
return rowID

On Mar 22, 3:28 pm, LightOfMooN vladsale...@yandex.ru wrote:
 I have table with too much cols.
 So, is there a way to pass variable names and values in the insert()
 or update() methods like this?

     options_house =
 db(db.company_houses_options.company_id==company.id).select().first()
     if request.vars.edit_options_house:
         houses_options={}
         for column_name in houses_columns:
             if request.vars.get(column_name, None):
                 houses_options[column_name]=True
             else:
                 houses_options[column_name]=False
         options_house.update_record(houses_options)

 where houses_columns is a list of columns names like
 ['street','house','block','buildyear',...]


[web2py] Re: pass variables to update() and insert() functions

2011-03-22 Thread LightOfMooN
Thanks! It's work :)

On 23 мар, 00:51, Anthony abasta...@gmail.com wrote:
 On Tuesday, March 22, 2011 3:28:20 PM UTC-4, LightOfMooN wrote:

  I have table with too much cols.
  So, is there a way to pass variable names and values in the insert()
  or update() methods like this?

      options_house =
  db(db.company_houses_options.company_id==company.id).select().first()
      if request.vars.edit_options_house:
          houses_options={}
          for column_name in houses_columns:
              if request.vars.get(column_name, None):
                  houses_options[column_name]=True
              else:
                  houses_options[column_name]=False
          options_house.update_record(houses_options)

  where houses_columns is a list of columns names like
  ['street','house','block','buildyear',...]

 In Python, I think you can pass a dict preceded by ** to a function and the
 dict will be separated into a set of keyword args. So, you would do:

 options_house.update_record(**house_options)

 I think that would work.

 Anthony


Re: [web2py] Re: LOAD() a plugin_wiki page

2011-03-22 Thread danto

 2011/3/13 Massimo Di Pierro massimo.dipie...@gmail.com

 You can also do

 {{=plugin_wiki.render_page('slug')}}

 if you do not need the ajax trapping.


for the record, the above didn't work because there is not any render_page
method in  plugin_wiki, but   {{=plugin_wiki.embed_page('slug')}} works
instead


[web2py] Re: pass variables to update() and insert() functions

2011-03-22 Thread mart
oh... variable s like that :) left the window open for too long and
didn't see the reply

On Mar 22, 3:54 pm, mart msenecal...@gmail.com wrote:
 I use this as a generic function table names are variables (I use a
 shortcut -so other modules can just do select(x,y) or update(x,y,z). I
 guess the same can be extended a little bit to make use/enable more
 variables...

    def updateStorage(self,tbl,name,value,cmdName=None):
         db = self.db
         id = None
         rowID = None
         for mTbl in db.tables:
             if tbl in mTbl:
                 if mTbl.startswith(tbl):
                     rows = db(db[mTbl].name==name).select()
                     for row in rows:
                         if row.name == name and row.value  0:
                             id = row.id
         if id != None:
             rowID =
 db(db[tbl].name==name).update(name=name,value=value)
         else:
             rowID = db[tbl].insert(name=name,value=value)
         if cmdName is not None:

 db(db[tbl].id==rowID).update(cmdName=cmdName)
         db.commit()
         return rowID

 On Mar 22, 3:28 pm, LightOfMooN vladsale...@yandex.ru wrote:







  I have table with too much cols.
  So, is there a way to pass variable names and values in the insert()
  or update() methods like this?

      options_house =
  db(db.company_houses_options.company_id==company.id).select().first()
      if request.vars.edit_options_house:
          houses_options={}
          for column_name in houses_columns:
              if request.vars.get(column_name, None):
                  houses_options[column_name]=True
              else:
                  houses_options[column_name]=False
          options_house.update_record(houses_options)

  where houses_columns is a list of columns names like
  ['street','house','block','buildyear',...]


[web2py] Re: Where do I put custom validators?

2011-03-22 Thread Pystar
Are models loaded in alphabetical order? or alphanumerical order?

On Mar 22, 1:45 pm, DenesL denes1...@yahoo.ca wrote:
 They usually go in a model file, just remember that models are loaded
 in alphabetical order.

 On Mar 22, 4:21 am, Ashwin Purohit puro...@gmail.com wrote:







  Which file do I put custom validators in? The book 
  (http://web2py.com/book/default/chapter/07#Custom-Validators) says nothing
  about standard placement.

  Thanks,
  Ashwin


[web2py] Re: Runnning my new app

2011-03-22 Thread Hal Smith
I got it working. But I don't understand what is going on there. I hope your 
manual clarifies that. 




From: Anthony abasta...@gmail.com
To: web2py@googlegroups.com
Cc: Hal Smith grownup_...@yahoo.com
Sent: Tue, March 22, 2011 9:59:29 AM
Subject: Re: Runnning my new app

On Tuesday, March 22, 2011 11:43:10 AM UTC-4, Hal Smith wrote: 
I am supposed to get Hello from my first Web app, but all I see is Hello 
World
 
Are you following the tutorial in the book? Is your new app named myapp? If 
so, make sure the default.py controller that you edited is the one in the 
myapp app (and not the one in the welcome app), and make sure you entered 
the url for myapp -- http://127.0.0.1:8000/myapp/default/index.
 
Anthony

Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread Keith Pettit
Thanks that helps me understand a bit better.  

Being a newbie I'd suggest just having the one example.   When looking I 
didn't really know what the files were or that they are competing methods to 
do the same thing.  Even if the naming is better like you suggest, it would 
still make me wonder what the difference is.  I'd probably just randomly try 
one of the examples and use whatever worked first.   I think to make 
things easier for the user you should only have the example for 
the preferred method.

Just my 2 cents though.

Thanks again for the help.




[web2py] Re: LOAD() a plugin_wiki page

2011-03-22 Thread Massimo Di Pierro
oops

On Mar 22, 3:01 pm, danto web2py.n...@gmail.com wrote:
  2011/3/13 Massimo Di Pierro massimo.dipie...@gmail.com

  You can also do

  {{=plugin_wiki.render_page('slug')}}

  if you do not need the ajax trapping.

 for the record, the above didn't work because there is not any render_page
 method in  plugin_wiki, but   {{=plugin_wiki.embed_page('slug')}} works
 instead


Re: [web2py] Re: the facebook clone video

2011-03-22 Thread Tito Garrido
When I logged in I've received:

Internal errorTicket issued:
friends/32.104.18.200.2011-03-22.20-51-25.fe57da4e-be3b-46fe-8bd4-cbd529f57d5dhttp://web2py.appspot.com/admin/default/ticket/friends/32.104.18.200.2011-03-22.20-51-25.fe57da4e-be3b-46fe-8bd4-cbd529f57d5d


Is this app available for download?

Regards,

Tito

On Tue, Mar 22, 2011 at 3:08 PM, Ross Peoples ross.peop...@gmail.comwrote:

 You've got to admit that it's kind of funny that someone always asks
 about the recording script every time you post one of these videos.
 You must be doing something right :)

 On Mar 21, 2:19 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:
  http://blip.tv/file/4912976




-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread Anthony
Thanks for the feedback. I think the new parameter-based system is probably 
preferred in general because it's easier, but there are things it cannot do 
that can only be done with the pattern-based system, so we probably need to 
maintain good examples for both. But perhaps we could at least include some 
additional guidance within the example files (e.g., the pattern-based 
example file could say try the other file first -- use this one only if you 
need the additional flexibility of the pattern-based system -- and maybe 
reference the book chapter).
 
Best,
Anthony

On Tuesday, March 22, 2011 4:45:58 PM UTC-4, Keith Pettit wrote:

 Thanks that helps me understand a bit better.   

 Being a newbie I'd suggest just having the one example.   When looking I 
 didn't really know what the files were or that they are competing methods to 
 do the same thing.  Even if the naming is better like you suggest, it would 
 still make me wonder what the difference is.  I'd probably just randomly try 
 one of the examples and use whatever worked first.   I think to make 
 things easier for the user you should only have the example for 
 the preferred method.

 Just my 2 cents though.

 Thanks again for the help.




Re: [web2py] Re: the facebook clone video

2011-03-22 Thread Anthony
Same here -- login is not working in the version posted to 
web2py.appspot.com.
 
Anthony


[web2py] Re: Runnning my new app

2011-03-22 Thread Anthony
Hopefully it will become clear as you go through the book. If not, come back 
and ask. :)
 
This section might help: 
http://web2py.com/book/default/chapter/04#Dispatching
 
Anthony


On Tuesday, March 22, 2011 4:14:26 PM UTC-4, Hal Smith wrote:

  I got it working. But I don't understand what is going on there. I hope 
 your manual clarifies that. 

  --
 *From:* Anthony aba...@gmail.com
 *To:* web...@googlegroups.com
 *Cc:* Hal Smith grow...@yahoo.com
 *Sent:* Tue, March 22, 2011 9:59:29 AM
 *Subject:* Re: Runnning my new app

 On Tuesday, March 22, 2011 11:43:10 AM UTC-4, Hal Smith wrote: 

  I am supposed to get Hello from my first Web app, but all I see is 
 Hello World

  
 Are you following the tutorial in the book? Is your new app named myapp? 
 If so, make sure the default.py controller that you edited is the one in the 
 myapp app (and not the one in the welcome app), and make sure you 
 entered the url for myapp -- http://127.0.0.1:8000/myapp/default/index.
  
 Anthony



Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread pbreit
I guess I was wondering if the two approaches could be consolidated into one 
file but perhaps that might be dangerous.

[web2py] Re: Where do I put custom validators?

2011-03-22 Thread pbreit
Alphanumeric with numbers preceding letter. Which is why you might see model 
filenames starting with 0 occasionally.

Re: [web2py] Re: web2py applications and version control systems

2011-03-22 Thread pbreit
As I mentioned, with Mercurial or any version control, you can specify the 
precise version that you want all of the files in the working directory to 
correspond to. In fact, after doing hg pull, your files will be unchanged. 
It's not until you hg update that your files actually get updated. And you 
can specify what changeset or version tag you want to hg update to. For 
example hg update R-1.94.1.

Also, many people do want to try out trunk to verify fixes. With version 
control, it's very easy to reliably switch back and forth.


[web2py] Re: web2py applications and version control systems

2011-03-22 Thread Gregory Hellings
I was just getting ready to dump my newest project into VCS and was
wondering the same question.  For me, since I'm not anywhere near
production yet, I am opting for just putting the application into VCS,
then I can use web2py's autoupdate feature.  Again, I'm only using
this as a playground for putting ideas into code which might be used
later on down the line.  So the version of web2py upgrading and
breaking things is not a concern for me.

If you're dealing with a real, life application for a client and
you're concerned about the extra files for GAE, I would start my VCS
at the base of web2py and only add my application and those files I
absolutely needed.  The rest could be hg/bzr/git/svn ignore'd.  Then
you can update just those files and track them, without being bothered
by changes to web2py.  Again, since I'm only dealing with a sandbox
for my own amusement and learning at this time, I'm not really
concerned about tracking web2py's updates and matching it for
compatibility nor the ability to rollback.

--Greg

On Mar 17, 1:13 pm, Dave Warnock dwarn...@gmail.com wrote:
 Hi,

 Do people generally start version control at web2py/applications/myapp or at
 web2py?

 If an application is to be deployed on gae then shouldn't some files in
 web2py be considered part of the project (index.yaml, app.yaml) and
 therefore under version control?

 Yet I would prefer not to have the whole of web2py under version control so
 that I can more quickly move between web2py versions for testing 
 upgrading.

 Just wondering what you do?

 Dave

 --
 Dave Warnock:http://42.blogs.warnock.me.uk


[web2py] Re: reddit again

2011-03-22 Thread villas
I believe the 'high road' comment would be better directed towards
those making unreasonable, false statements.

In the heat of the moment,  Massimo did concede that it 'bothers'
him.  Such 'outbursts' are rather uncharacteristic, so we can assume
he was somewhat displeased.  Can we allow that without too much nit-
picking? I hope so.


On Mar 22, 6:28 pm, pbreit pbreitenb...@gmail.com wrote:
 Except that you have to be careful when you accuse people of making false
 statements. For example, pointing out that templates usually aren't python
 modules either is missing the point.

 Also, on #3, just take the high road. Pointing out that other people
 supposedly do the same bad behavior is not going to go very far.


Re: [web2py] Re: can web2py internal webserver handle serveral requests in parallel?

2011-03-22 Thread Jonathan Lundell
On Mar 22, 2011, at 12:34 PM, Anthony wrote:

 Got it. Thanks.

In the current version, there's no practical difference between session.forget 
and session._unlock. This is a change, but (and this is open to question) I 
think that unlock without forget can only be a bug. Maybe I'm wrong about that, 
but...

In answer to Anthony's first question, the session is automatically locked. It 
remains locked until the end of the request and the session is written out, or 
until you call session.forget (or session._unlock), but if you do that, the 
file is closed and cannot be written.

To put it another way: it used to be possible to unlock the session file and 
still write it. I'm suggesting that if anyone did that, it must be a bug, but 
I'm open to argument.

 
 On Tuesday, March 22, 2011 3:27:20 PM UTC-4, Massimo Di Pierro wrote:
 web2py does not know whether the session is going to change or not so it 
 locks even if does not save it. To change it call session._unlock(request) 
 
 On Mar 22, 2011, at 2:18 PM, Anthony wrote:
 
 On Tuesday, March 22, 2011 2:39:45 PM UTC-4, Massimo Di Pierro wrote:
 The only caveat is that - unless you unlock them - session are locked. 
 Therefore the same user cannot request two pages at the same time. 
 This in order to guarantee data integrity in sessions.
  
 With the new changes in 1.94.5, is the session file still locked for every 
 request, even if nothing is saved to the session, or does it only get locked 
 if something is actually saved/changed?
  
 Thanks.
  
 Anthony
 



Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread Jonathan Lundell
On Mar 22, 2011, at 1:57 PM, Anthony wrote:

 Thanks for the feedback. I think the new parameter-based system is probably 
 preferred in general because it's easier, but there are things it cannot do 
 that can only be done with the pattern-based system, so we probably need to 
 maintain good examples for both. But perhaps we could at least include some 
 additional guidance within the example files (e.g., the pattern-based example 
 file could say try the other file first -- use this one only if you need the 
 additional flexibility of the pattern-based system -- and maybe reference 
 the book chapter).

That's a good summary of the situation, including the need to make this clearer 
in the book.

At some point I'd like to enable pattern-editing in the parameter-based router, 
but I'm not quite sure how to do it. At that point, we could deprecate the 
pattern-based router, I suppose, though it'd still need to be present for 
compatibility.


  
 Best,
 Anthony
 
 On Tuesday, March 22, 2011 4:45:58 PM UTC-4, Keith Pettit wrote:
 Thanks that helps me understand a bit better.  
 
 Being a newbie I'd suggest just having the one example.   When looking I 
 didn't really know what the files were or that they are competing methods to 
 do the same thing.  Even if the naming is better like you suggest, it would 
 still make me wonder what the difference is.  I'd probably just randomly try 
 one of the examples and use whatever worked first.   I think to make things 
 easier for the user you should only have the example for the preferred method.
 
 Just my 2 cents though.
 
 Thanks again for the help.
 
 



Re: [web2py] Re: Where do I put custom validators?

2011-03-22 Thread Jonathan Lundell
On Mar 22, 2011, at 1:31 PM, Pystar wrote:

 Are models loaded in alphabetical order? or alphanumerical order?

They're sorted by Python's built-in function sorted, in its default mode, which 
I believe in this case is eventually using str.__cmp__.

 
 On Mar 22, 1:45 pm, DenesL denes1...@yahoo.ca wrote:
 They usually go in a model file, just remember that models are loaded
 in alphabetical order.
 
 On Mar 22, 4:21 am, Ashwin Purohit puro...@gmail.com wrote:
 
 
 
 
 
 
 
 Which file do I put custom validators in? The book 
 (http://web2py.com/book/default/chapter/07#Custom-Validators) says nothing
 about standard placement.
 
 Thanks,
 Ashwin



Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread David Warnock
Hi,

Just looking again at the book.

Is there any support for subdomains in either routing system? I couldn't see
any.

I am thinking of what I think 37signals use

http://clienta.myapp.com/users   // list of all users for client A
http://clientb.myapp.com/users/dave   // form for user dave within client B
http://myapp.com/users/// application administrators

I am interested both for aesthetics and also because GAE supports namespaces
via subdomains for controlling access to the data.

Thanks

Dave

-- 
Dave Warnock: http://42.blogs.warnock.me.uk
Cycling Blog: http://42bikes.warnock.me.uk


Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread pbreit
All I do to handle sub-domains is check to see if the sub-domain matches a 
user sub-domain. For example:

user = 
db(db.auth_user.sub_domain==request.env.http_host.split('.')[0]).select().first()
 
or ''


[web2py] Re: Alternative for annoying default javascript integer/double/decimal validtors

2011-03-22 Thread pbreit
I just put in your changes. The cursor moving to the end of field text was 
driving me nuts! Thanks.

Re: [web2py] Re: web2py default application suggestion

2011-03-22 Thread Jonathan Lundell
On Mar 22, 2011, at 3:53 PM, David Warnock wrote:
 Is there any support for subdomains in either routing system? I couldn't see 
 any.
 
 I am thinking of what I think 37signals use
 
 http://clienta.myapp.com/users   // list of all users for client A
 http://clientb.myapp.com/users/dave   // form for user dave within client B
 http://myapp.com/users/// application administrators 
 
 I am interested both for aesthetics and also because GAE supports namespaces 
 via subdomains for controlling access to the data.
 

In the new router, you can configure domain routing in the BASE router. This is 
an example from the unit test:

BASE = dict(
domains = {
domain1.com : app1,
www.domain1.com : app1,
domain2.com : app2,
},
),

The domain can include a port, and the target can be a controller:

domains = {
#  two domains to the same app
domain1.com : app1,
www.domain1.com : app1,
#  same domain, two ports, to two apps
domain2.com  : app2a,
domain2.com:8080 : app2b,
#  two domains, same app, two controllers
domain3a.com : app3/c3a,
domain3b.com : app3/c3b,
#  http vs https
domain6.com:80  : app6,
domain6.com:443 : app6s,
},

But if you want to map the subdomain to (say) an arg, you'll have to use the 
regex router.

[web2py] Re: Alternative for annoying default javascript integer/double/decimal validtors

2011-03-22 Thread Massimo Di Pierro
I do not have a strong opinion about this one. What do other people
think?

On Mar 20, 1:15 pm, Kevin Ivarsen kivar...@gmail.com wrote:
 Hi all,

 I find the default javascript validators for integer, double, and decimal
 SQLFORM fields to be a little annoying. Consider the following surprising
 behaviors:

 - You can't navigate within the textbox using the keyboard. Pressing left,
 right, home, or end all result in the cursor jumping back to the end of the
 input
 - You can't select text with ctrl-a or ctrl-shift-left/right
 - If the user accidentally flubs the input (e.g. 2.u1828 instead of
 2.71828), the offending character is silently removed and an incorrect value
 may be submitted without warning.

 I think a better alternative is to flag to the user that the input is wrong
 rather than trying to correct it for them -- e.g. by changing the input
 background color. The following is a sample implementation that does this:

 -- in file web2py_ajax.html, replace the lines
 jQuery('input.integer').live... and
 jQuery('input.double,input.decimal').live... with:

   jQuery('input.integer').live('keydown keyup', function(){
      if (! this.value.match(/^[+-]?[0-9]*$/)) {
           jQuery(this).addClass(w2p_inputerror);
      }
      else {
           jQuery(this).removeClass(w2p_inputerror);
      }
   });

   jQuery('input.double,input.decimal').live('keydown keyup', function(){
      if (! this.value.match(/^[+-]?[0-9]*\.?[0-9]*$/)) {
           jQuery(this).addClass(w2p_inputerror);
      }
      else {
           jQuery(this).removeClass(w2p_inputerror);
      }
   });

 -- in file base.css, add the following style:

      input.w2p_inputerror {
           background: #FF8;
      }

 A few notes:

 1. The regexes used to validate numbers are intentionally naive. For
 example. the double validator accepts +, -, +., and -., which are of
 couse not valid numbers. However, suppose the user enters a value between -1
 and 0. They are likely to start by typing -., and I don't think it's
 polite to flash the textbox at them when they are about to enter a valid
 number.

 2. The double validator does not permit scientific notation - e.g. 1e6 for
 1 million. Such notation is probably of limited use for most people, the old
 validator rejected such values anyway, and I didn't feel like implementing
 it :-)

 3. The jquery events listen to both keyup and keydown. keyup is necessary
 because the input.value has not yet been updated when keydown is fired. But
 listening to keydown is useful if the user holds down the backspace key -
 the background color will be reset as soon as the last offending character
 has been deleted, rather than waiting for the user to release the backspace
 key.

 4. I used the class name w2p_inputerror in an attept to namespace this
 somewhat web2py-specific class.

 I hope some people find this to be useful. If other people have been annoyed
 by the current default, perhaps we could open discussion to make this the
 new default in web2py?

 Cheers,
 Kevin


[web2py] Re: book other typo

2011-03-22 Thread bryanp
Did anyone have this example working on GAE?

I can get it to come up locally on GAE, but no records that I add show
up in the todo list.

I changed the app.yaml file to:

application: myappname
version: 1
api_version: 1
runtime: python

derived_file_type:
- python_precompiled

handlers:

- url: /
  static_files: applications/init/static/output/TodoApp.html
  upload: applications/init/static/output/TodoApp.html

- url: /(.*)
  static_files: applications/init/static/output/\1
  upload: applications/init/static/output/(.+)

- url: /jsonrpc
  script: gaehandler.py


My db.py looks like:

try:
from gluon.contrib.gql import *  # if running on Google App Engine
except:
db = SQLDB('sqlite://storage.db')  # if not, use SQLite or other
DB
else:
db = GQLDB()  # connect to Google BigTable
session.connect(request, response, db=db)  # and store sessions
there

db=SQLDB('sqlite://storage.db')
db.define_table('todo', db.Field('task'))

from gluon.tools import Service # new in web2py 1.56
service = Service(globals())


Re: [web2py] Re: Alternative for annoying default javascript integer/double/decimal validtors

2011-03-22 Thread Alexandre Andrade
My main main problem is localization. since in portuguese decimal separator
is , and not a . I just have to disable it.



2011/3/22 Massimo Di Pierro massimo.dipie...@gmail.com

 I do not have a strong opinion about this one. What do other people
 think?

 On Mar 20, 1:15 pm, Kevin Ivarsen kivar...@gmail.com wrote:
  Hi all,
 
  I find the default javascript validators for integer, double, and decimal
  SQLFORM fields to be a little annoying. Consider the following surprising
  behaviors:
 
  - You can't navigate within the textbox using the keyboard. Pressing
 left,
  right, home, or end all result in the cursor jumping back to the end of
 the
  input
  - You can't select text with ctrl-a or ctrl-shift-left/right
  - If the user accidentally flubs the input (e.g. 2.u1828 instead of
  2.71828), the offending character is silently removed and an incorrect
 value
  may be submitted without warning.
 
  I think a better alternative is to flag to the user that the input is
 wrong
  rather than trying to correct it for them -- e.g. by changing the input
  background color. The following is a sample implementation that does
 this:
 
  -- in file web2py_ajax.html, replace the lines
  jQuery('input.integer').live... and
  jQuery('input.double,input.decimal').live... with:
 
jQuery('input.integer').live('keydown keyup', function(){
   if (! this.value.match(/^[+-]?[0-9]*$/)) {
jQuery(this).addClass(w2p_inputerror);
   }
   else {
jQuery(this).removeClass(w2p_inputerror);
   }
});
 
jQuery('input.double,input.decimal').live('keydown keyup', function(){
   if (! this.value.match(/^[+-]?[0-9]*\.?[0-9]*$/)) {
jQuery(this).addClass(w2p_inputerror);
   }
   else {
jQuery(this).removeClass(w2p_inputerror);
   }
});
 
  -- in file base.css, add the following style:
 
   input.w2p_inputerror {
background: #FF8;
   }
 
  A few notes:
 
  1. The regexes used to validate numbers are intentionally naive. For
  example. the double validator accepts +, -, +., and -., which are
 of
  couse not valid numbers. However, suppose the user enters a value between
 -1
  and 0. They are likely to start by typing -., and I don't think it's
  polite to flash the textbox at them when they are about to enter a valid
  number.
 
  2. The double validator does not permit scientific notation - e.g. 1e6
 for
  1 million. Such notation is probably of limited use for most people, the
 old
  validator rejected such values anyway, and I didn't feel like
 implementing
  it :-)
 
  3. The jquery events listen to both keyup and keydown. keyup is necessary
  because the input.value has not yet been updated when keydown is fired.
 But
  listening to keydown is useful if the user holds down the backspace key -
  the background color will be reset as soon as the last offending
 character
  has been deleted, rather than waiting for the user to release the
 backspace
  key.
 
  4. I used the class name w2p_inputerror in an attept to namespace this
  somewhat web2py-specific class.
 
  I hope some people find this to be useful. If other people have been
 annoyed
  by the current default, perhaps we could open discussion to make this the
  new default in web2py?
 
  Cheers,
  Kevin




-- 
Atenciosamente


Alexandre Andrade
Hipercenter.com Classificados Gratuitos


[web2py] Re: book bugs

2011-03-22 Thread niknok
Thanks for the excellent work


On Mar 18, 9:23 am, villas villa...@gmail.com wrote:
 Hi niknok

 I have recently been editing thebook(prompted by the suggestions of
 Kevin Ivarsen).  You may find that these issues  have been resolved.
 Please take a look (at the online version) and let me know if this
 section is still not correct.

 http://web2py.com/book/default/chapter/07#Validators

 Many thanks,
 David

 On Mar 18, 12:02 am, niknok nikolai...@gmail.com wrote:







  In Validator section of Chapter 7, the  example for IS_DATE_IN_RANGE
  incorrectly uses IS_DATETIME where IS_DATE_IN_RANGE is expected:

  requires = IS_DATE(format=T('%Y-%m-%d'),
                          minimum=datetime.date(2008,1,1),
                          maximum=datetime.date(2009,12,31),
                          error_message=T('must be -MM-DD!'))

  should be:

  requires = IS_DATE_IN_RANGE(format=T('%Y-%m-%d'),
                          minimum=datetime.date(2008,1,1),
                          maximum=datetime.date(2009,12,31),
                          error_message=T('must be -MM-DD!'))

  The same error occured in the IS_DATETIME_IN_RANGE validator example:

  requires = IS_DATE(format=T('%Y-%m-%d'),
                          minimum=datetime.date(2008,1,1),
                          maximum=datetime.date(2009,12,31),
                          error_message=T('must be -MM-DD!'))

  should read as:

  requires = IS_DATETIME_IN_RANGE(format=T('%Y-%m-%d'),
                                  minimum=datetime.date(2008,1,1),
                                  maximum=datetime.date(2009,12,31),
                                  error_message=T('must be -MM-DD!'))

  hth


[web2py] File Upload and save to DB

2011-03-22 Thread Ialejandro
HI everyone!! this time I have a new question...

I'm developing an application where I generate an INI file (could be
any file) with specific info.

For example I have this ini structure

[Room]

name = room1
color = red
size = big

(I generate the file dynamically from an X computer [x could be any
computer running a python script)

After the file is generated, is sent by FTP to my web2py server PC in
C:\SERVER\iniuploads

The question is, how could I read the ini file values and save them in
a model??

Some to consider is:

- Could be many ini files (each one with the room name, so the name of
the file is the same of [Room])
- I need to check every X time if a new ini file has been uploaded,
and new files must be processed (save on db)
- After a file is processed it must be deleted

How could I do this?? It's ok to change the ini to any other file
format, what I need is the contained info in a DB.


[web2py] a few questions

2011-03-22 Thread niknok
Hi everyone.

a few question about forms:
1. why doesn't the datepicker appear when I use the sqlform.factory to
generate input fields?
2. Other than customizing a view, is there a way to display radiobox
options horizontally when using sqlform?

I'm stuck with this internal error: ValueError: invalid literal for
int() with base 10: ''

Traceback (most recent call last):
  File /home/rwn/Projects/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/rwn/Projects/web2py/applications/bbc_test/views/
appadmin.html, line 193, in module
/p
  File /home/rwn/Projects/web2py/gluon/sqlhtml.py, line 1356, in
__init__
r = A(field.represent(r), _href=str(href))
  File /home/rwn/Projects/web2py/gluon/dal.py, line 3322, in
repr_ref
def repr_ref(id, r=referenced, f=ff): return f(r, id)
  File /home/rwn/Projects/web2py/gluon/dal.py, line 3291, in ff
row=r(id)
  File /home/rwn/Projects/web2py/gluon/dal.py, line 4243, in
__call__
record = self._db(self.id == key).select(limitby=(0,1)).first()
  File /home/rwn/Projects/web2py/gluon/dal.py, line 5009, in select
return self.db._adapter.select(self.query,fields,attributes)
  File /home/rwn/Projects/web2py/gluon/dal.py, line 1070, in select
return self.parse(rows,self._colnames)
  File /home/rwn/Projects/web2py/gluon/dal.py, line 1263, in parse
colset[fieldname] = rid = Reference(value)
ValueError: invalid literal for int() with base 10: ''

Am using version 1.94.5.


[web2py] Re: Menu based on Boolean table fields.

2011-03-22 Thread DenesL
Hi Annet,

On Mar 22, 10:08 am, annet annet.verm...@gmail.com wrote:
 Thanks for your reply. I had a look at the code, but I am afraid it
 doesn't solve my problem. The functions are fields in a table and
 depending on their value being true or false they should be rendered
 as an a/a or h4/h4 element.

 Given this code in a function:

 session.id=auth.user.bedrijf_id
 session.row=db(db.cardfunction.bedrijf_id==session.id).select(db.cardfunction.ALL)
 session.card_menu=[
     ['Home',request.function=='index',URL(r=request,f='index')],
     ['Logo',request.function=='logo',URL(r=request,f='logo')],
     ...

 ['Keywords',request.function=='keywords',URL(r=request,f='keywords')]]

 .. I am looking for a way to make use of the _name attribute, for this
 is the same as the field name, something like:

 ul
   {{for _name,_active,_link in session.card_menu:}}
     {{if session.row._name:}}
       li
         a {{if _active:}} class=active {{pass}}
 href={{=_link}}{{=_name}}/a
       /li
     {{else:}}
       li
         h4 class=disabled{{=_name}}/h4
       /li
     {{pass}}
   {{pass}}
 /ul

 The problem is that this: {{if session.row._name:}} results in a
 KeyError '_name'
 Is it possible to use _name to accomplish this?

I think you want
  {{if session.row[0][_name.lower()]:}}

session.row is a Rows object, not a single row, so you have to select
the first one, hence [0].
The single row will have the _name key.

Since your menu is using the capitalized version of the field name I
added _name.lower() so that it would get the correct field name.


 Kind regards,

 Annet.


  1   2   >