[web2py:32535] Re: newbie: returning Controller variable to View

2009-10-09 Thread ed

Hi Massimo,
Okay, redirect returns page but without any variable. Any hint how to
render a page name loggedin that says; Hi Ed, welcome! after a
succesful login using the code i created?. Sorry, i'm a newbie with
very limited web2py knowledge and stucked on this.  Thank you in
advance Massimo.

On Oct 9, 11:58 am, mdipierro mdipie...@cs.depaul.edu wrote:
 mind that redirect is a function that raises an HTTP exception which
 causes the server to send and HTTP 303 response. redirect never
 returns and your view is never rendered.

 Massimo

 On Oct 8, 9:22 pm, ed edbi...@rocketmail.com wrote:

  The display went well because i filled a session with a constant Ed
  and not a result of a db().select(). So, the constant variable was
  displayed without a hitch. When i used db().select() the display went
  like:
  [{'first_name': 'Ed'}]
  The above display is the result of the following code:
  Controller:
  if form.accepts(request.vars, session):
      em=request.vars.emailad
      name1 = db(db.auth_user.email==em).select(db.auth_user.first_name)
  [0]
      name=name1.first_name
      return dict(red=redirect(URL(r=request,f='loggedin')), name=name)
  ..
  View:
  {{extend 'layout2.html'}}
  p
  ph3Hi {{=name}}/h3/p
  p
  .
   This was the result of the view, Hi [{'first_name': 'Ed'}]. I've
  googled and searched the manual and tried examples but to no avail.
  Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32536] Re: SQLFORM

2009-10-09 Thread leone

does't work the #mytable_myfield solution, and I can't understand why!
(no web2py_ajax.html in code)

On 9 Ott, 07:15, mr.freeze nat...@freezable.com wrote:
 Try using the class:

 input.string {
     width: 450px;

 }

 or if you don't want to affect all input.string:

 #mytable_myfield{
     width: 450px;

 }

 or go crazy...

 db.define_table('mytable',Field('myfield','string'))
 db.mytable.myfield.widget = lambda f,v: INPUT(_type=text, _value=v,
 _class=crazy_input,_name=myfield,_id=mytable_myfield,
 _size=100)

 On Oct 8, 11:40 pm, leone handja...@gmail.com wrote:



  I know, but no effect. Strange.
  Do you know if SQLFORM's argument onvalidation is executed before
  inserting row?

  On 8 Ott, 22:51, Thadeus Burgess thade...@thadeusb.com wrote:

   leone,

   To change the size in css you have to use the width property, there is no
   size property in css.

   input #table_field {
       width: 350px;

   }

   -Thadeus

   On Thu, Oct 8, 2009 at 3:07 PM, leone handja...@gmail.com wrote:

Second question solved.
About input length css has no effect.
SQLFORM(onvalidation is executed before or after inserting row?

On 8 Ott, 17:23, Thadeus Burgess thade...@thadeusb.com wrote:
 massimo,

 On my machine locally, web2py_ajax.html seems to overwrite any length
 settings put into css..

 The jQuery commands that change the length need to be either commented
out
 or removed.

 -Thadeus

 On Thu, Oct 8, 2009 at 8:07 AM, mdipierro mdipie...@cs.depaul.edu
wrote:

  You should set it using css. For a table table and a field field
  the id of the input field is

  #table_field

  you should be able to do something like this in the page

  style
  input #table_field { size: 5 }
  /style

  On Oct 8, 8:01 am, leone handja...@gmail.com wrote:
   Two questions:
   1) how can I set the length of an html input field generated by
   SQLFORM? They have all the same size.
   2) It  needs same commit() using SQLite? My submits seem to 
   generate
   no rows.

  No need for commit. Do you have form.accepts(...)? Hard to tell the
  problem without looking at the action.

   Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32537] Re: SQLFORM

2009-10-09 Thread Iceberg

The crazy need not be that crazy. I normally do:

  db.Field('myfield','string',
widget=lambda field,value,**kwargs:
  StringWidget.widget(field,value,_size=40,**kwargs)

so that the output field has a size=40 setting.

css should also work. Just make sure your definition appear in right
place so that it won't be override by default setting.

On Oct9, 1:15pm, mr.freeze nat...@freezable.com wrote:
 Try using the class:

 input.string {
     width: 450px;

 }

 or if you don't want to affect all input.string:

 #mytable_myfield{
     width: 450px;

 }

 or go crazy...

 db.define_table('mytable',Field('myfield','string'))
 db.mytable.myfield.widget = lambda f,v: INPUT(_type=text, _value=v,
 _class=crazy_input,_name=myfield,_id=mytable_myfield,
 _size=100)

 On Oct 8, 11:40 pm, leone handja...@gmail.com wrote:



  I know, but no effect. Strange.
  Do you know if SQLFORM's argument onvalidation is executed before
  inserting row?

  On 8 Ott, 22:51, Thadeus Burgess thade...@thadeusb.com wrote:

   leone,

   To change the size in css you have to use the width property, there is no
   size property in css.

   input #table_field {
       width: 350px;

   }

   -Thadeus

   On Thu, Oct 8, 2009 at 3:07 PM, leone handja...@gmail.com wrote:

Second question solved.
About input length css has no effect.
SQLFORM(onvalidation is executed before or after inserting row?

On 8 Ott, 17:23, Thadeus Burgess thade...@thadeusb.com wrote:
 massimo,

 On my machine locally, web2py_ajax.html seems to overwrite any length
 settings put into css..

 The jQuery commands that change the length need to be either commented
out
 or removed.

 -Thadeus

 On Thu, Oct 8, 2009 at 8:07 AM, mdipierro mdipie...@cs.depaul.edu
wrote:

  You should set it using css. For a table table and a field field
  the id of the input field is

  #table_field

  you should be able to do something like this in the page

  style
  input #table_field { size: 5 }
  /style

  On Oct 8, 8:01 am, leone handja...@gmail.com wrote:
   Two questions:
   1) how can I set the length of an html input field generated by
   SQLFORM? They have all the same size.
   2) It  needs same commit() using SQLite? My submits seem to 
   generate
   no rows.

  No need for commit. Do you have form.accepts(...)? Hard to tell the
  problem without looking at the action.

   Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32538] Will web2py be a dream stack?

2009-10-09 Thread Joseph Jude

I thought of sharing this article:
http://blogs.forrester.com/appdev/2009/10/my-dream-stack-for-developing-web-applications.html

Joseph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32539] Re: Circular table reference

2009-10-09 Thread Markus Schmitz

Hi Massimo,

I think the answers are (all) spot on. I will go for the trick
solution with the integer type instead of reference.

It is closest to what I had in mind. Not naturally a clean DB design,
but I can live with the missing cascade on delete in this
application scenario. So I am fione.

Thanks

a lot for the help,

Markus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32540] Re: Circular table reference

2009-10-09 Thread Yarko Tymciurak
On Fri, Oct 9, 2009 at 2:32 AM, Markus Schmitz mschm...@soft-impact.comwrote:


 Hi Massimo,

 I think the answers are (all) spot on. I will go for the trick
 solution with the integer type instead of reference.


why??

If you use Massimo's 3 table layout, there is absolutely no need



 It is closest to what I had in mind. Not naturally a clean DB design,
 but I can live with the missing cascade on delete in this
 application scenario. So I am fione.

 Thanks

 a lot for the help,

 Markus
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32541] Re: web2py wiki

2009-10-09 Thread Joe Barnhart
We could make the wiki even simpler...


   1. Get rid of comments on each page.  The wiki IS comments it doesn't
   need additional comments!

   2. Get rid of tags.  Tags imply we know in advance what the structure of
   the wiki is.  We don't.  Instead the structure should evolve dynamically
   with wiki pages.

   3. Generate a set of search keys for each page.  Filter out the
   punctuation and whitespace, then toss uninteresting words ('a', 'the', etc)
   and save the remaining words as a text field to help with full-text
   searching.

   4. Cache the generated HTML in the database to avoid re-processing the
   RST every time a page hit occurs.  Most entries are edited rarely but viewed
   often.

   5. Permission levels should have site administrators, site contributors
   (editors), and guests.  Admins can edit immutable pages, contributors can
   create and edit normal content, and guests can read anything but not edit.


The design goal should look more like MediaWiki and less like a blog, IMHO.
Less space wasted for header and navigation and more area devoted to
content.

I've also been playing with ideas for the web2py wiki.  See my site at
http://www.site51.net/wiki  for an unfinished prototype.

Try the editing feature and notice the AJAX call to process RST and preview
your changes.  Just click at the bottom of the edit page to re-render the
RST at any time.

Create a new page just by entering its WikiName in the URL and then hitting
edit.  Remember to edit the main page and add your new page to the list.

This wiki sample is unprotected by signon, so it'll probably get defaced
quickly and I'll have to take it down.  But for awhile you can see the
direction I am suggesting -- albeit in a very unfinished state!

Joe B.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32542] Re: Try out admin editor

2009-10-09 Thread Iceberg

Do you mean that the ctrl+s is already implemented in current web2py
latest trunk?

But I tried in IE7, ctrl+s doesn't invoke any action. And I tried in
Chrome3, ctrl+s just invoke the browser's built-in save current page
to local harddisk feature.

Well, not a big deal. I am just curious to know whether ctrl+s works
in other user's environment. If it does not work, I won't mind because
it is not really my first choice to edit my app. :-)

On Oct7, 10:10pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Please check again it should be there

 On Oct 7, 4:26 am, Iceberg iceb...@21cn.com wrote:



  Looks like the problem is already addressed 3 weeks ago. But I did not
  find a file named keyboard.js in our web2py admin.

   http://sourceforge.net/projects/editarea/forums/forum/556921/topic/33...

  On Oct7, 11:24am, mdipierro mdipie...@cs.depaul.edu wrote:

   Can you send me a patch?

   On Oct 6, 7:30 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:

Still the main problem with admin editor is this
wrong-refreshing/wrong-displaying trauma - never solved or did I miss 
smth ?

On Oct 5, 2009 3:47 AM, Iceberg iceb...@21cn.com wrote:

Did not really try the admin editor until recently. Nice as a handy
tool for some quick typing, the only inconvenience is the lack of ctrl
+s shortcut to save a file. Is it possible to add this feature? Since
I notice the ctrl+f etc can work.

BTW, the word_wrap.gif icon is missing in the toolbar.

Regards,
Iceberg
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32543] Re: controller images

2009-10-09 Thread Sebastian E. Ovide
exactly  it suppose to use a relative path... from the library:

/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License:
http://www.opensource.org/licenses/mit-license.php
*/

var tb_pathToImage = images/loadingAnimation.gif;

/*! edit below this line at your own risk
!!!*/

//on page load call tb_init
$(document).ready(function(){
tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to
apply thickbox
imgLoader = new Image();// preload image
imgLoader.src = tb_pathToImage;
});




On Thu, Oct 8, 2009 at 4:51 PM, mdipierro mdipie...@cs.depaul.edu wrote:


 I never had to do this. All the JS libraries I ever used use relative
 references since they do now know in which folder they are installed.
 I do not understand.

 On Oct 8, 10:42 am, Álvaro Justen [Turicas] alvarojus...@gmail.com
 wrote:
  On Thu, Oct 8, 2009 at 07:30, sebastian sebastianov...@gmail.com
 wrote:
 
   Hi All,
 
   I am using a JS library (http://jquery.com/demo/thickbox/) which refer
   to   images/something.jpg. That works perfectly on static HTML but
   web2py translates it as http://blabla/init/default/images/
   something.jpg.
 
   as work around I'd like to create a controller names images that
   returns the image in static/images. I'm sure that it would be 2 lines
   of web2py... any ideas ?
 
  Yes, it happens with nicEdit[1] too. You have 3 ways to solve this
 problem:
 
  1- Change routes.py to redirect /yourapp/default/images/blablabla to
  /yourapp/static/images/blablabla (you may change routes_in and
  routes_out, see routes.example.py). This way the 'redirect' will be
  'internally' - user won't get any redirect.
 
  2- Create a function called images in default.py and redirects user to
  /static/images/request.args, something like that:
  def images():
  redirect(URL(r=request, c='static', f='images/' +
 '/'.join(request.args)))
  I don't like this second way since user will be redirected in all
 requests.
 
  3- Change JS code to point to /yourapp/static/images/ instead of
 images/
 
  I prefer 3rd option. :-)
 
  [1]http://www.nicedit.com/
 
  --
   Álvaro Justen
   Peta5 - Telecomunicações e Software Livre
   21 3021-6001 / 9898-0141
   http://www.peta5.com.br/
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32545] Re: controller images

2009-10-09 Thread Sebastian E. Ovide
same problem for HTML file

div class=index_small_pics style=background:
url(images/pic_goals.jpg) no-repeat;
Courses Aims
/div

for those I can use URL or CSS files, but I am not so kind of modify 3th
party libraries ...

On Fri, Oct 9, 2009 at 10:03 AM, Sebastian E. Ovide 
sebastianov...@gmail.com wrote:

 exactly  it suppose to use a relative path... from the library:

 /*
  * Thickbox 3.1 - One Box To Rule Them All.
  * By Cody Lindley (http://www.codylindley.com)
  * Copyright (c) 2007 cody lindley
  * Licensed under the MIT License:
 http://www.opensource.org/licenses/mit-license.php
 */

 var tb_pathToImage = images/loadingAnimation.gif;

 /*! edit below this line at your own risk
 !!!*/

 //on page load call tb_init
 $(document).ready(function(){
 tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to
 apply thickbox
 imgLoader = new Image();// preload image
 imgLoader.src = tb_pathToImage;
 });





 On Thu, Oct 8, 2009 at 4:51 PM, mdipierro mdipie...@cs.depaul.edu wrote:


 I never had to do this. All the JS libraries I ever used use relative
 references since they do now know in which folder they are installed.
 I do not understand.

 On Oct 8, 10:42 am, Álvaro Justen [Turicas] alvarojus...@gmail.com
 wrote:
  On Thu, Oct 8, 2009 at 07:30, sebastian sebastianov...@gmail.com
 wrote:
 
   Hi All,
 
   I am using a JS library (http://jquery.com/demo/thickbox/) which
 refer
   to   images/something.jpg. That works perfectly on static HTML but
   web2py translates it as http://blabla/init/default/images/
   something.jpg.
 
   as work around I'd like to create a controller names images that
   returns the image in static/images. I'm sure that it would be 2 lines
   of web2py... any ideas ?
 
  Yes, it happens with nicEdit[1] too. You have 3 ways to solve this
 problem:
 
  1- Change routes.py to redirect /yourapp/default/images/blablabla to
  /yourapp/static/images/blablabla (you may change routes_in and
  routes_out, see routes.example.py). This way the 'redirect' will be
  'internally' - user won't get any redirect.
 
  2- Create a function called images in default.py and redirects user to
  /static/images/request.args, something like that:
  def images():
  redirect(URL(r=request, c='static', f='images/' +
 '/'.join(request.args)))
  I don't like this second way since user will be redirected in all
 requests.
 
  3- Change JS code to point to /yourapp/static/images/ instead of
 images/
 
  I prefer 3rd option. :-)
 
  [1]http://www.nicedit.com/
 
  --
   Álvaro Justen
   Peta5 - Telecomunicações e Software Livre
   21 3021-6001 / 9898-0141
   http://www.peta5.com.br/
 






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32546] SQLFORM onvalidate

2009-10-09 Thread leone

I have questions about SQLFORM onvalidate.
Before inserting a row I have to resize an image by PIL and push
b64encoded bytes on a blob field.
So I have defined onvalidate=DoSomething in SQLFORM.
DoSomething has form as input arg, resize image as thumbnails, encode
it and push in form.vars.myblob
(or db.mytable.myblob???).
The new record is OK, but blob field is empty.
Can someone orient me?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32547] Re: SQLFORM

2009-10-09 Thread leone

Solved.
My error is a space between input and #mytable_myfield in css
definition.
The css approach is effective and elegant.

On 9 Ott, 08:50, Iceberg iceb...@21cn.com wrote:
 The crazy need not be that crazy. I normally do:

   db.Field('myfield','string',
     widget=lambda field,value,**kwargs:
       StringWidget.widget(field,value,_size=40,**kwargs)

 so that the output field has a size=40 setting.

 css should also work. Just make sure your definition appear in right
 place so that it won't be override by default setting.

 On Oct9, 1:15pm, mr.freeze nat...@freezable.com wrote:



  Try using the class:

  input.string {
      width: 450px;

  }

  or if you don't want to affect all input.string:

  #mytable_myfield{
      width: 450px;

  }

  or go crazy...

  db.define_table('mytable',Field('myfield','string'))
  db.mytable.myfield.widget = lambda f,v: INPUT(_type=text, _value=v,
  _class=crazy_input,_name=myfield,_id=mytable_myfield,
  _size=100)

  On Oct 8, 11:40 pm, leone handja...@gmail.com wrote:

   I know, but no effect. Strange.
   Do you know if SQLFORM's argument onvalidation is executed before
   inserting row?

   On 8 Ott, 22:51, Thadeus Burgess thade...@thadeusb.com wrote:

leone,

To change the size in css you have to use the width property, there is 
no
size property in css.

input #table_field {
    width: 350px;

}

-Thadeus

On Thu, Oct 8, 2009 at 3:07 PM, leone handja...@gmail.com wrote:

 Second question solved.
 About input length css has no effect.
 SQLFORM(onvalidation is executed before or after inserting row?

 On 8 Ott, 17:23, Thadeus Burgess thade...@thadeusb.com wrote:
  massimo,

  On my machine locally, web2py_ajax.html seems to overwrite any 
  length
  settings put into css..

  The jQuery commands that change the length need to be either 
  commented
 out
  or removed.

  -Thadeus

  On Thu, Oct 8, 2009 at 8:07 AM, mdipierro mdipie...@cs.depaul.edu
 wrote:

   You should set it using css. For a table table and a field 
   field
   the id of the input field is

   #table_field

   you should be able to do something like this in the page

   style
   input #table_field { size: 5 }
   /style

   On Oct 8, 8:01 am, leone handja...@gmail.com wrote:
Two questions:
1) how can I set the length of an html input field generated by
SQLFORM? They have all the same size.
2) It  needs same commit() using SQLite? My submits seem to 
generate
no rows.

   No need for commit. Do you have form.accepts(...)? Hard to tell 
   the
   problem without looking at the action.

Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32548] Re: SQLFORM onvalidate

2009-10-09 Thread leone

excuse me: onvalidation not onvalidate.

On 9 Ott, 14:20, leone handja...@gmail.com wrote:
 I have questions about SQLFORM onvalidate.
 Before inserting a row I have to resize an image by PIL and push
 b64encoded bytes on a blob field.
 So I have defined onvalidate=DoSomething in SQLFORM.
 DoSomething has form as input arg, resize image as thumbnails, encode
 it and push in form.vars.myblob
 (or db.mytable.myblob???).
 The new record is OK, but blob field is empty.
 Can someone orient me?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32552] Re: newbie: returning Controller variable to View

2009-10-09 Thread mdipierro

Something like this?

def page1():
form=SQLFORM.factory(Field('email',requires=IS_IN_DB
(db,'auth_user.email')))
if form.accepts(request.vars, session):
  redirect(URL(r=request,f='page2',dict(em=form.vars.email))
return dict(form=form)

{{extend 'layout.html'}}{{=form}}

def page2():
rows=db(db.auth_user.email==request.vars.em).select()
if not rows: redirect(URL(r=request,f='page1'))
return dict(name=rows.first().first_name)

{{extend 'layout.html'}}Hello {{=name}}


Mind that you do not need anything like this if your purpose is login.
In that case web2py already provides method for login and the user
info is simply in
{{=auth.user.first_name}} {{=auth.user.last_name}}


On Oct 9, 1:34 am, ed edbi...@rocketmail.com wrote:
 Hi Massimo,
 Okay, redirect returns page but without any variable. Any hint how to
 render a page name loggedin that says; Hi Ed, welcome! after a
 succesful login using the code i created?. Sorry, i'm a newbie with
 very limited web2py knowledge and stucked on this.  Thank you in
 advance Massimo.

 On Oct 9, 11:58 am, mdipierro mdipie...@cs.depaul.edu wrote:

  mind that redirect is a function that raises an HTTP exception which
  causes the server to send and HTTP 303 response. redirect never
  returns and your view is never rendered.

  Massimo

  On Oct 8, 9:22 pm, ed edbi...@rocketmail.com wrote:

   The display went well because i filled a session with a constant Ed
   and not a result of a db().select(). So, the constant variable was
   displayed without a hitch. When i used db().select() the display went
   like:
   [{'first_name': 'Ed'}]
   The above display is the result of the following code:
   Controller:
   if form.accepts(request.vars, session):
       em=request.vars.emailad
       name1 = db(db.auth_user.email==em).select(db.auth_user.first_name)
   [0]
       name=name1.first_name
       return dict(red=redirect(URL(r=request,f='loggedin')), name=name)
   ..
   View:
   {{extend 'layout2.html'}}
   p
   ph3Hi {{=name}}/h3/p
   p
   .
    This was the result of the view, Hi [{'first_name': 'Ed'}]. I've
   googled and searched the manual and tried examples but to no avail.
   Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32553] Re: Will web2py be a dream stack?

2009-10-09 Thread mdipierro

I emailed him.

On Oct 9, 2:01 am, Joseph Jude ceph...@gmail.com wrote:
 I thought of sharing this 
 article:http://blogs.forrester.com/appdev/2009/10/my-dream-stack-for-developi...

 Joseph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32554] Re: SQLFORM

2009-10-09 Thread mr.freeze

Yes, that is less crazy but still requires removing a line from
web2py_ajax.html for me:

  jQuery('input.string').attr('size',50);

I think Thadeus is correct and these should be set in base.css, not
through javascript.

On Oct 9, 1:50 am, Iceberg iceb...@21cn.com wrote:
 The crazy need not be that crazy. I normally do:

   db.Field('myfield','string',
     widget=lambda field,value,**kwargs:
       StringWidget.widget(field,value,_size=40,**kwargs)

 so that the output field has a size=40 setting.

 css should also work. Just make sure your definition appear in right
 place so that it won't be override by default setting.

 On Oct9, 1:15pm, mr.freeze nat...@freezable.com wrote:

  Try using the class:

  input.string {
      width: 450px;

  }

  or if you don't want to affect all input.string:

  #mytable_myfield{
      width: 450px;

  }

  or go crazy...

  db.define_table('mytable',Field('myfield','string'))
  db.mytable.myfield.widget = lambda f,v: INPUT(_type=text, _value=v,
  _class=crazy_input,_name=myfield,_id=mytable_myfield,
  _size=100)

  On Oct 8, 11:40 pm, leone handja...@gmail.com wrote:

   I know, but no effect. Strange.
   Do you know if SQLFORM's argument onvalidation is executed before
   inserting row?

   On 8 Ott, 22:51, Thadeus Burgess thade...@thadeusb.com wrote:

leone,

To change the size in css you have to use the width property, there is 
no
size property in css.

input #table_field {
    width: 350px;

}

-Thadeus

On Thu, Oct 8, 2009 at 3:07 PM, leone handja...@gmail.com wrote:

 Second question solved.
 About input length css has no effect.
 SQLFORM(onvalidation is executed before or after inserting row?

 On 8 Ott, 17:23, Thadeus Burgess thade...@thadeusb.com wrote:
  massimo,

  On my machine locally, web2py_ajax.html seems to overwrite any 
  length
  settings put into css..

  The jQuery commands that change the length need to be either 
  commented
 out
  or removed.

  -Thadeus

  On Thu, Oct 8, 2009 at 8:07 AM, mdipierro mdipie...@cs.depaul.edu
 wrote:

   You should set it using css. For a table table and a field 
   field
   the id of the input field is

   #table_field

   you should be able to do something like this in the page

   style
   input #table_field { size: 5 }
   /style

   On Oct 8, 8:01 am, leone handja...@gmail.com wrote:
Two questions:
1) how can I set the length of an html input field generated by
SQLFORM? They have all the same size.
2) It  needs same commit() using SQLite? My submits seem to 
generate
no rows.

   No need for commit. Do you have form.accepts(...)? Hard to tell 
   the
   problem without looking at the action.

Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32556] Re: SQLFORM onvalidate

2009-10-09 Thread leone

Solved:

if form.accepts(request.vars, session, keepvalues=True,
onvalidation=WriteThumb):
 .

def WriteThumb(form):
i = cStringIO.StringIO()
o = cStringIO.StringIO()
i.write(form.vars.imgfile.value)
i.seek(0)
im = Image.open(i, 'r')
im.thumbnail((100,100),Image.ANTIALIAS)
im.save(o,'jpeg')
form.vars.thumbnail = base64.b64encode(o.getvalue())
o.close()
i.close()

img src=data:image/jpeg;base64,{{=row['thumbnail']}}
alt=Thumbnail photo  /


On 9 Ott, 14:48, leone handja...@gmail.com wrote:
 excuse me: onvalidation not onvalidate.

 On 9 Ott, 14:20, leone handja...@gmail.com wrote:



  I have questions about SQLFORM onvalidate.
  Before inserting a row I have to resize an image by PIL and push
  b64encoded bytes on a blob field.
  So I have defined onvalidate=DoSomething in SQLFORM.
  DoSomething has form as input arg, resize image as thumbnails, encode
  it and push in form.vars.myblob
  (or db.mytable.myblob???).
  The new record is OK, but blob field is empty.
  Can someone orient me?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32557] Re: SQLFORM onvalidate

2009-10-09 Thread leone

I forget:

from PIL import Image

On 9 Ott, 15:49, leone handja...@gmail.com wrote:
 Solved:

 if form.accepts(request.vars, session, keepvalues=True,
 onvalidation=WriteThumb):
          .

 def WriteThumb(form):
     i = cStringIO.StringIO()
     o = cStringIO.StringIO()
     i.write(form.vars.imgfile.value)
     i.seek(0)
     im = Image.open(i, 'r')
     im.thumbnail((100,100),Image.ANTIALIAS)
     im.save(o,'jpeg')
     form.vars.thumbnail = base64.b64encode(o.getvalue())
     o.close()
     i.close()

 img src=data:image/jpeg;base64,{{=row['thumbnail']}}
                                     alt=Thumbnail photo  /

 On 9 Ott, 14:48, leone handja...@gmail.com wrote:



  excuse me: onvalidation not onvalidate.

  On 9 Ott, 14:20, leone handja...@gmail.com wrote:

   I have questions about SQLFORM onvalidate.
   Before inserting a row I have to resize an image by PIL and push
   b64encoded bytes on a blob field.
   So I have defined onvalidate=DoSomething in SQLFORM.
   DoSomething has form as input arg, resize image as thumbnails, encode
   it and push in form.vars.myblob
   (or db.mytable.myblob???).
   The new record is OK, but blob field is empty.
   Can someone orient me?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32558] Re: Midphase + web2py how do I set it up?

2009-10-09 Thread DenesL


On Oct 9, 9:27 am, Chris S sanders.ch...@gmail.com wrote:
 I just wanted to throw out another update since I've received e-mails
 from others who are/were interested in using web2py on Midphase.  I
 received an e-mail from one of the sales reps at Midphase asking what
 they would need to change for Midphase to be considered a good option
 for web2py hosting.

 I said:
 Python 2.5 or 2.6 support
 FastCGI/WSGI help files
 Best case, web2py FastCGI/WSGI instructions

 I'll post here again if something changes.  I'll be honest I haven't
 even messed with the Python 2.4 support any further.  After finding
 basically no WSGI/FsatCGI help on the midphase site and being told the
 wrong answers from the live tech support I've just been using GAE for
 now.  Hopefully this really does change I'd love to try out web2py on
 a host with a SQL database as I think I'll like it a lot better than
 GAE.

I had a similarly bad experience with their tech support when I
approached them about python a while ago. Maybe now that their sales
end of business is involved things will change, otherwise its their
loss as hosting will be done somewhere else.
Thanks and keep us posted.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32559] Re: web2py wiki

2009-10-09 Thread Jonathan Lundell
On Oct 9, 2009, at 1:22 AM, Joe Barnhart wrote:

 We could make the wiki even simpler...

 Get rid of comments on each page.  The wiki IS comments it  
 doesn't need additional comments!

 Get rid of tags.  Tags imply we know in advance what the structure  
 of the wiki is.  We don't.  Instead the structure should evolve  
 dynamically with wiki pages.

 Generate a set of search keys for each page.  Filter out the  
 punctuation and whitespace, then toss uninteresting words ('a',  
 'the', etc) and save the remaining words as a text field to help  
 with full-text searching.

 Cache the generated HTML in the database to avoid re-processing the  
 RST every time a page hit occurs.  Most entries are edited rarely  
 but viewed often.

 Permission levels should have site administrators, site contributors  
 (editors), and guests.  Admins can edit immutable pages,  
 contributors can create and edit normal content, and guests can read  
 anything but not edit.

 The design goal should look more like MediaWiki and less like a  
 blog, IMHO.  Less space wasted for header and navigation and more  
 area devoted to content.

Agreed. MediaWiki is the best model we have, and ought to drive the  
default choices.

A talk page for meta comments makes more sense than inline comments,  
absolutely. And it has the advantage that it's just another wiki page,  
really.




 I've also been playing with ideas for the web2py wiki.  See my site  
 at http://www.site51.net/wiki  for an unfinished prototype.

 Try the editing feature and notice the AJAX call to process RST and  
 preview your changes.  Just click at the bottom of the edit page to  
 re-render the RST at any time.

 Create a new page just by entering its WikiName in the URL and then  
 hitting edit.  Remember to edit the main page and add your new  
 page to the list.

 This wiki sample is unprotected by signon, so it'll probably get  
 defaced quickly and I'll have to take it down.  But for awhile you  
 can see the direction I am suggesting -- albeit in a very unfinished  
 state!





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32560] Re: html pages without function associated

2009-10-09 Thread DenesL


Any reason not to place them under static?.
You don't seem to be using the template language.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32561] Re: html pages without function associated

2009-10-09 Thread Sebastian E. Ovide
well... I'm still using URL  probably in some future I could use
sessions...

just wondering how to save some seconds more... and make web2py even easier
adding more defaults...



On Fri, Oct 9, 2009 at 4:00 PM, DenesL denes1...@yahoo.ca wrote:



 Any reason not to place them under static?.
 You don't seem to be using the template language.


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32562] Could someone clear up some questions about cache?

2009-10-09 Thread Thadeus Burgess
When you apply @cache to an controller action, what is actually cached, is
it just the response from the function, or the generated html? or the
returned dict() ?

Is there a way to have web2py just cache the generated html and serve it
like it was a static html file, depending on the request.env.path_info ?

-Thadeus

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32563] Re: Could someone clear up some questions about cache?

2009-10-09 Thread mdipierro

@cache.ram(...)
def index(): return dict(a=3)

caches the dict only

@cache.ram(...)
def index(): return response.render(a=3)

caches the html


On Oct 9, 11:00 am, Thadeus Burgess thade...@thadeusb.com wrote:
 When you apply @cache to an controller action, what is actually cached, is
 it just the response from the function, or the generated html? or the
 returned dict() ?

 Is there a way to have web2py just cache the generated html and serve it
 like it was a static html file, depending on the request.env.path_info ?

 -Thadeus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32564] Error in GAE

2009-10-09 Thread Joseph Jude

Hi,
When I execute the below code in GAE it throws an error: unsupported
operand type(s) for %: 'NoneType' and 'dict'. However this works ok in
a non-GAE environment. Any tips?

print db(db.paid_by.paid_by.lower()=='cash').select(db.paid_by.ALL)[0]
['id']

Basically what I have is the description and I want to get the
corresponding id stored in the database.

Thank you in advance,
Joseph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32565] Re: Error in GAE

2009-10-09 Thread mdipierro

GAE does not support .lower()

sorry

On Oct 9, 12:31 pm, Joseph Jude ceph...@gmail.com wrote:
 Hi,
 When I execute the below code in GAE it throws an error: unsupported
 operand type(s) for %: 'NoneType' and 'dict'. However this works ok in
 a non-GAE environment. Any tips?

 print db(db.paid_by.paid_by.lower()=='cash').select(db.paid_by.ALL)[0]
 ['id']

 Basically what I have is the description and I want to get the
 corresponding id stored in the database.

 Thank you in advance,
 Joseph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32566] Re: Could someone clear up some questions about cache?

2009-10-09 Thread Thadeus Burgess
It also seems, when using cache on an action, that if I had set
response.title = About within the function, it no longer gets set in the
cached version of the page.

-Thadeus




On Fri, Oct 9, 2009 at 11:00 AM, Thadeus Burgess thade...@thadeusb.comwrote:

 When you apply @cache to an controller action, what is actually cached, is
 it just the response from the function, or the generated html? or the
 returned dict() ?

 Is there a way to have web2py just cache the generated html and serve it
 like it was a static html file, depending on the request.env.path_info ?

 -Thadeus




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32567] Re: html pages without function associated

2009-10-09 Thread mdipierro

I know some people like to use web2py as they would use PHP which, I
would not recommend, but technically works.

On Oct 9, 10:40 am, Sebastian E. Ovide sebastianov...@gmail.com
wrote:
 well... I'm still using URL  probably in some future I could use
 sessions...

 just wondering how to save some seconds more... and make web2py even easier
 adding more defaults...

 On Fri, Oct 9, 2009 at 4:00 PM, DenesL denes1...@yahoo.ca wrote:

  Any reason not to place them under static?.
  You don't seem to be using the template language.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32568] Re: Could someone clear up some questions about cache?

2009-10-09 Thread mdipierro

No until you cache the view as well.

Massimo

On Oct 9, 12:35 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 It also seems, when using cache on an action, that if I had set
 response.title = About within the function, it no longer gets set in the
 cached version of the page.

 -Thadeus

 On Fri, Oct 9, 2009 at 11:00 AM, Thadeus Burgess thade...@thadeusb.comwrote:

  When you apply @cache to an controller action, what is actually cached, is
  it just the response from the function, or the generated html? or the
  returned dict() ?

  Is there a way to have web2py just cache the generated html and serve it
  like it was a static html file, depending on the request.env.path_info ?

  -Thadeus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32569] Re: Try out admin editor

2009-10-09 Thread Yarko Tymciurak
CTRL-S  is too old, and too widely used;  it's save from probably every
browser in every environment in existence

In ASCII, it is Device Control 3, and has been used for terminal control
since the beginnings of the use of terminals.


On Fri, Oct 9, 2009 at 3:52 AM, Iceberg iceb...@21cn.com wrote:


 Do you mean that the ctrl+s is already implemented in current web2py
 latest trunk?

 But I tried in IE7, ctrl+s doesn't invoke any action. And I tried in
 Chrome3, ctrl+s just invoke the browser's built-in save current page
 to local harddisk feature.

 Well, not a big deal. I am just curious to know whether ctrl+s works
 in other user's environment. If it does not work, I won't mind because
 it is not really my first choice to edit my app. :-)

 On Oct7, 10:10pm, mdipierro mdipie...@cs.depaul.edu wrote:
  Please check again it should be there
 
  On Oct 7, 4:26 am, Iceberg iceb...@21cn.com wrote:
 
 
 
   Looks like the problem is already addressed 3 weeks ago. But I did not
   find a file named keyboard.js in our web2py admin.
 
  
 http://sourceforge.net/projects/editarea/forums/forum/556921/topic/33...
 
   On Oct7, 11:24am, mdipierro mdipie...@cs.depaul.edu wrote:
 
Can you send me a patch?
 
On Oct 6, 7:30 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 
 Still the main problem with admin editor is this
 wrong-refreshing/wrong-displaying trauma - never solved or did I
 miss smth ?
 
 On Oct 5, 2009 3:47 AM, Iceberg iceb...@21cn.com wrote:
 
 Did not really try the admin editor until recently. Nice as a handy
 tool for some quick typing, the only inconvenience is the lack of
 ctrl
 +s shortcut to save a file. Is it possible to add this feature?
 Since
 I notice the ctrl+f etc can work.
 
 BTW, the word_wrap.gif icon is missing in the toolbar.
 
 Regards,
 Iceberg
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32570] Re: test on IBM AS/400 iSeries System i

2009-10-09 Thread DenesL


After fixing a problem with a couple bad memory cards the problem
seems to have gone away.

Currently Tim and I have two separate AS/400s running web2py in PASE
but we need to create a new driver to access DB2 directly.

On a related note, the AlterEgo/FAQ about DB2 support in web2py has
been updated to show how to have read/write and read-only access,
useful for the legacy table support recently introduced.
http://www.web2py.com/AlterEgo/default/show/208

DenesL
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32571] web2py and python 2.4

2009-10-09 Thread pepe_eloy

Hello!

A Question: Is it possible to run Web2py using python 2.4? I ask this
beacuse some web hosting servers only offers this version.

Thanks for the help.

Regards.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32572] suggestions for wiki site

2009-10-09 Thread Wes James

Use new web2py logo for the wiki instead of the balloon with the check mark.

Change a collaboration tool for web2py community to a collaboration
tool for the web2py community on the front.

-wes

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32573] reCaptcha example not working?

2009-10-09 Thread devnull

The controller below initially displays the flash 'some other error in
your form' right when the page loads.

If I leave the captcha field blank and hit submit, it flashes 'done!'
The same thing happens if I type something incorrect in the captcha
field and then hit submit.

What should I do differently? The example from 
http://www.web2py.com/AlterEgo/default/show/99
looks ok to me... (Thanks in advance)

public_key='(a very long key from reCAPTCHA)'
private_key='(a very long key from reCAPTCHA with a hyphen in it)'

def cap():
form=FORM(RECAPTCHA(request,public_key,private_key),INPUT
(_type='submit'))
if form.accepts(request.vars,session): response.flash='done!'
elif form.errors.has_key('captcha'): response.flash='invalid
captcha'
else: response.flash='some other error in your form'
return dict(form=form)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32574] Re: Could someone clear up some questions about cache?

2009-10-09 Thread Thadeus Burgess
Ok so using

@cache.ram(...)
def index(): return response.render(a=3)

caches the view and just serves it as html ? That is exactly what I want,
thanks!

-Thadeus




On Fri, Oct 9, 2009 at 1:42 PM, mdipierro mdipie...@cs.depaul.edu wrote:


 No until you cache the view as well.

 Massimo

 On Oct 9, 12:35 pm, Thadeus Burgess thade...@thadeusb.com wrote:
  It also seems, when using cache on an action, that if I had set
  response.title = About within the function, it no longer gets set in
 the
  cached version of the page.
 
  -Thadeus
 
  On Fri, Oct 9, 2009 at 11:00 AM, Thadeus Burgess thade...@thadeusb.com
 wrote:
 
   When you apply @cache to an controller action, what is actually cached,
 is
   it just the response from the function, or the generated html? or the
   returned dict() ?
 
   Is there a way to have web2py just cache the generated html and serve
 it
   like it was a static html file, depending on the request.env.path_info
 ?
 
   -Thadeus
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32575] Re: web2py wiki

2009-10-09 Thread Yarko Tymciurak
Joe -

Some of these suggestions I like...

On Fri, Oct 9, 2009 at 3:22 AM, Joe Barnhart joe.barnh...@gmail.com wrote:

 We could make the wiki even simpler...


1. Get rid of comments on each page.  The wiki IS comments it
doesn't need additional comments!


Hmmm yes, but with a caveat:  if page-changing (e.g. child page to a
page) is setup, then comments become irrelevant, and just a special case
of the general changing.

This is important if there are to be ACL lists, since (for example) you may
want to have one group write a tutorial, but let anyone add comments (e.g.
sub-pages).



1.
2. Get rid of tags.  Tags imply we know in advance what the structure
of the wiki is.  We don't.  Instead the structure should evolve dynamically
with wiki pages.


Hmmm meta-information can be good, can aid search, but I think you are
right the structure should evolve - just that tags may serve a purpose in
holding multi-dimensionality to that structure.




1.
2. Generate a set of search keys for each page.  Filter out the
punctuation and whitespace, then toss uninteresting words ('a', 'the', etc)
and save the remaining words as a text field to help with full-text
searching.

3. Cache the generated HTML in the database to avoid re-processing the
RST every time a page hit occurs.  Most entries are edited rarely but 
 viewed
often.

4. Permission levels should have site administrators, site contributors
(editors), and guests.  Admins can edit immutable pages, contributors can
create and edit normal content, and guests can read anything but not edit.


 The design goal should look more like MediaWiki and less like a blog,
 IMHO.  Less space wasted for header and navigation and more area devoted to
 content.


MediaWiki, and Twiki are two notable current examples, but there are some
other interesting wiki concepts out there - and perhaps some of our numbers
will come with an innovation or two...



 I've also been playing with ideas for the web2py wiki.  See my site at
 http://www.site51.net/wiki  for an unfinished prototype.


I like the general look of this!



 Try the editing feature and notice the AJAX call to process RST and preview
 your changes.  Just click at the bottom of the edit page to re-render the
 RST at any time.


Nice!



 Create a new page just by entering its WikiName in the URL and then hitting
 edit.  Remember to edit the main page and add your new page to the list.


This is a NICE feature, but I wonder if it is too one-dimensional.  I
suppose next or child pages could be created by links on the parent
page and maybe that is the right way...  If you want people to comment
on your pages (regardless of ACL) you add a comments link at the bottom of
your page, and make that page editable by all where people add pages
(e.g. comments)

The needed piece, perhaps, then is backlinks - which page is referring to
the current page - to complete the sense of structure.




 This wiki sample is unprotected by signon, so it'll probably get defaced
 quickly and I'll have to take it down.  But for awhile you can see the
 direction I am suggesting -- albeit in a very unfinished state!


Thanks - nice job.   Perhaps you can share this, and get more collaboration
at some point?



 Joe B.


Yarko




 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32576] Re: web2py wiki

2009-10-09 Thread Thadeus Burgess
Once we get the new wiki situated, we can start going through the google
groups history and looking for questions that have been asked, and adding
them to the wiki :)

Little things such as
http://www.mail-archive.com/web2py@googlegroups.com/msg16724.html

would be awesome for learning the framework without too much searching.

-Thadeus




On Fri, Oct 9, 2009 at 2:59 PM, Yarko Tymciurak yark...@gmail.com wrote:

 Joe -

 Some of these suggestions I like...

 On Fri, Oct 9, 2009 at 3:22 AM, Joe Barnhart joe.barnh...@gmail.comwrote:

 We could make the wiki even simpler...


1. Get rid of comments on each page.  The wiki IS comments it
doesn't need additional comments!


 Hmmm yes, but with a caveat:  if page-changing (e.g. child page to a
 page) is setup, then comments become irrelevant, and just a special case
 of the general changing.

 This is important if there are to be ACL lists, since (for example) you may
 want to have one group write a tutorial, but let anyone add comments (e.g.
 sub-pages).



1.
2. Get rid of tags.  Tags imply we know in advance what the structure
of the wiki is.  We don't.  Instead the structure should evolve 
 dynamically
with wiki pages.


 Hmmm meta-information can be good, can aid search, but I think you are
 right the structure should evolve - just that tags may serve a purpose in
 holding multi-dimensionality to that structure.




1.
2. Generate a set of search keys for each page.  Filter out the
punctuation and whitespace, then toss uninteresting words ('a', 'the', 
 etc)
and save the remaining words as a text field to help with full-text
searching.

3. Cache the generated HTML in the database to avoid re-processing the
RST every time a page hit occurs.  Most entries are edited rarely but 
 viewed
often.

4. Permission levels should have site administrators, site
contributors (editors), and guests.  Admins can edit immutable pages,
contributors can create and edit normal content, and guests can read
anything but not edit.


 The design goal should look more like MediaWiki and less like a blog,
 IMHO.  Less space wasted for header and navigation and more area devoted to
 content.


 MediaWiki, and Twiki are two notable current examples, but there are some
 other interesting wiki concepts out there - and perhaps some of our numbers
 will come with an innovation or two...



 I've also been playing with ideas for the web2py wiki.  See my site at
 http://www.site51.net/wiki  for an unfinished prototype.


 I like the general look of this!



 Try the editing feature and notice the AJAX call to process RST and
 preview your changes.  Just click at the bottom of the edit page to
 re-render the RST at any time.


 Nice!



 Create a new page just by entering its WikiName in the URL and then
 hitting edit.  Remember to edit the main page and add your new page to the
 list.


 This is a NICE feature, but I wonder if it is too one-dimensional.  I
 suppose next or child pages could be created by links on the parent
 page and maybe that is the right way...  If you want people to comment
 on your pages (regardless of ACL) you add a comments link at the bottom of
 your page, and make that page editable by all where people add pages
 (e.g. comments)

 The needed piece, perhaps, then is backlinks - which page is referring to
 the current page - to complete the sense of structure.




 This wiki sample is unprotected by signon, so it'll probably get defaced
 quickly and I'll have to take it down.  But for awhile you can see the
 direction I am suggesting -- albeit in a very unfinished state!


 Thanks - nice job.   Perhaps you can share this, and get more collaboration
 at some point?



 Joe B.


 Yarko







 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32577] Re: web2py wiki

2009-10-09 Thread Yarko Tymciurak
On Fri, Oct 9, 2009 at 2:59 PM, Yarko Tymciurak yark...@gmail.com wrote:

 Joe -

 Some of these suggestions I like...

 On Fri, Oct 9, 2009 at 3:22 AM, Joe Barnhart joe.barnh...@gmail.comwrote:

 We could make the wiki even simpler...


1. Get rid of comments on each page.  The wiki IS comments it
doesn't need additional comments!


 Hmmm yes, but with a caveat:  if page-changing (e.g. child page to a
 page) is setup, then comments become irrelevant, and just a special case
 of the general changing.


Ugh - PAGE-CHAINING ... that was supposed to read page-chaining !!!




 This is important if there are to be ACL lists, since (for example) you may
 want to have one group write a tutorial, but let anyone add comments (e.g.
 sub-pages).



1.
2. Get rid of tags.  Tags imply we know in advance what the structure
of the wiki is.  We don't.  Instead the structure should evolve 
 dynamically
with wiki pages.


 Hmmm meta-information can be good, can aid search, but I think you are
 right the structure should evolve - just that tags may serve a purpose in
 holding multi-dimensionality to that structure.




1.
2. Generate a set of search keys for each page.  Filter out the
punctuation and whitespace, then toss uninteresting words ('a', 'the', 
 etc)
and save the remaining words as a text field to help with full-text
searching.

3. Cache the generated HTML in the database to avoid re-processing the
RST every time a page hit occurs.  Most entries are edited rarely but 
 viewed
often.

4. Permission levels should have site administrators, site
contributors (editors), and guests.  Admins can edit immutable pages,
contributors can create and edit normal content, and guests can read
anything but not edit.


 The design goal should look more like MediaWiki and less like a blog,
 IMHO.  Less space wasted for header and navigation and more area devoted to
 content.


 MediaWiki, and Twiki are two notable current examples, but there are some
 other interesting wiki concepts out there - and perhaps some of our numbers
 will come with an innovation or two...



 I've also been playing with ideas for the web2py wiki.  See my site at
 http://www.site51.net/wiki  for an unfinished prototype.


 I like the general look of this!



 Try the editing feature and notice the AJAX call to process RST and
 preview your changes.  Just click at the bottom of the edit page to
 re-render the RST at any time.


 Nice!



 Create a new page just by entering its WikiName in the URL and then
 hitting edit.  Remember to edit the main page and add your new page to the
 list.


 This is a NICE feature, but I wonder if it is too one-dimensional.  I
 suppose next or child pages could be created by links on the parent
 page and maybe that is the right way...  If you want people to comment
 on your pages (regardless of ACL) you add a comments link at the bottom of
 your page, and make that page editable by all where people add pages
 (e.g. comments)

 The needed piece, perhaps, then is backlinks - which page is referring to
 the current page - to complete the sense of structure.




 This wiki sample is unprotected by signon, so it'll probably get defaced
 quickly and I'll have to take it down.  But for awhile you can see the
 direction I am suggesting -- albeit in a very unfinished state!


 Thanks - nice job.   Perhaps you can share this, and get more collaboration
 at some point?



 Joe B.


 Yarko




 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32578] Re: reCaptcha example not working?

2009-10-09 Thread mdipierro

The example was incorrect because uses an old file with bugs. You
should use the Recaptcha helper built in web2py. I fixed the example

http://www.web2py.com/AlterEgo/default/show/99

On Oct 9, 2:26 pm, devnull ache...@gmail.com wrote:
 The controller below initially displays the flash 'some other error in
 your form' right when the page loads.

 If I leave the captcha field blank and hit submit, it flashes 'done!'
 The same thing happens if I type something incorrect in the captcha
 field and then hit submit.

 What should I do differently? The example 
 fromhttp://www.web2py.com/AlterEgo/default/show/99
 looks ok to me... (Thanks in advance)

 public_key='(a very long key from reCAPTCHA)'
 private_key='(a very long key from reCAPTCHA with a hyphen in it)'

 def cap():
     form=FORM(RECAPTCHA(request,public_key,private_key),INPUT
 (_type='submit'))
     if form.accepts(request.vars,session): response.flash='done!'
     elif form.errors.has_key('captcha'): response.flash='invalid
 captcha'
     else: response.flash='some other error in your form'
     return dict(form=form)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32579] Re: web2py and python 2.4

2009-10-09 Thread mdipierro

It works with 2.4 is hashlib is present (you may need to install it
separately)

On Oct 9, 2:20 pm, pepe_eloy pepe.e...@gmail.com wrote:
 Hello!

 A Question: Is it possible to run Web2py using python 2.4? I ask this
 beacuse some web hosting servers only offers this version.

 Thanks for the help.

 Regards.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32580] Unit testing Auth functions

2009-10-09 Thread bm

Does anyone know how to unit test the auth functions in web2py?

If so, could you please send examples?

So far, using the example unit test provided here:
http://www.web2py.com/AlterEgo/default/show/213 as the basis, I've
attempted to call http://site/default/user/register.

Here's an example:

class TestDefaultController(unittest.TestCase):
def testRegisterGet_noKeys(self):
self.request.env.request_method = 'GET'
self.request.vars = None
self.controller.user('register')
form = self.controller.user('register').response._vars['form']
self.assertFalse(form.errors)


I've tried some obvious permutations of the line:
self.controller.user('register')
like:
self.controller.user.register
self.controller.user(register)

But to no avail, so far.

Naturally, for the 2 examples above that are passing an arg I changed
the default.py user function to be:

 def user(arg=None):
  return dict(form=auth())

but, oddly, I get the following error when I've tried passing
'register' as an arg:

NameError: global name 'auth' is not defined

Also, I've already checked the projects source tree for existing unit
tests for auth.

Thanks in advance to anyone that provides insight and examples on how
to this. :-)










--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32581] t3 app with latest w2p trunk

2009-10-09 Thread Wes James

I changed the db source in db.py from sqlite to postgres and I get:

NameError: global name 'psycopg2' is not defined

If I run python I can import psycopg2.

I notice that when I run w2p from the cli it says it sees sqlite, but
it does not say that it sees postgres.

??

thx,

-wes

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32582] Re: reCaptcha example not working?

2009-10-09 Thread devnull

Awesome -- thanks! (By the way, the page says [captcha and recaptha]
and should say [captcha and recaptcha])

On Oct 9, 5:24 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 The example was incorrect because uses an old file with bugs. You
 should use the Recaptcha helper built in web2py. I fixed the example

 http://www.web2py.com/AlterEgo/default/show/99

 On Oct 9, 2:26 pm, devnull ache...@gmail.com wrote:

  The controller below initially displays the flash 'some other error in
  your form' right when the page loads.

  If I leave the captcha field blank and hit submit, it flashes 'done!'
  The same thing happens if I type something incorrect in the captcha
  field and then hit submit.

  What should I do differently? The example 
  fromhttp://www.web2py.com/AlterEgo/default/show/99
  looks ok to me... (Thanks in advance)

  public_key='(a very long key from reCAPTCHA)'
  private_key='(a very long key from reCAPTCHA with a hyphen in it)'

  def cap():
      form=FORM(RECAPTCHA(request,public_key,private_key),INPUT
  (_type='submit'))
      if form.accepts(request.vars,session): response.flash='done!'
      elif form.errors.has_key('captcha'): response.flash='invalid
  captcha'
      else: response.flash='some other error in your form'
      return dict(form=form)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32583] Re: reCaptcha example not working?

2009-10-09 Thread mdipierro

oops. fixed thanks. Please let us know if this works for you.

On Oct 9, 4:57 pm, devnull ache...@gmail.com wrote:
 Awesome -- thanks! (By the way, the page says [captcha and recaptha]
 and should say [captcha and recaptcha])

 On Oct 9, 5:24 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  The example was incorrect because uses an old file with bugs. You
  should use the Recaptcha helper built in web2py. I fixed the example

 http://www.web2py.com/AlterEgo/default/show/99

  On Oct 9, 2:26 pm, devnull ache...@gmail.com wrote:

   The controller below initially displays the flash 'some other error in
   your form' right when the page loads.

   If I leave the captcha field blank and hit submit, it flashes 'done!'
   The same thing happens if I type something incorrect in the captcha
   field and then hit submit.

   What should I do differently? The example 
   fromhttp://www.web2py.com/AlterEgo/default/show/99
   looks ok to me... (Thanks in advance)

   public_key='(a very long key from reCAPTCHA)'
   private_key='(a very long key from reCAPTCHA with a hyphen in it)'

   def cap():
       form=FORM(RECAPTCHA(request,public_key,private_key),INPUT
   (_type='submit'))
       if form.accepts(request.vars,session): response.flash='done!'
       elif form.errors.has_key('captcha'): response.flash='invalid
   captcha'
       else: response.flash='some other error in your form'
       return dict(form=form)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32584] Re: t3 app with latest w2p trunk

2009-10-09 Thread mdipierro

Are you using source or binary? the binary version does not see your
modules. You should use source.

On Oct 9, 4:52 pm, Wes James compte...@gmail.com wrote:
 I changed the db source in db.py from sqlite to postgres and I get:

 NameError: global name 'psycopg2' is not defined

 If I run python I can import psycopg2.

 I notice that when I run w2p from the cli it says it sees sqlite, but
 it does not say that it sees postgres.

 ??

 thx,

 -wes
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32585] Re: t3 app with latest w2p trunk

2009-10-09 Thread Wes James

source

On Fri, Oct 9, 2009 at 4:17 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 Are you using source or binary? the binary version does not see your
 modules. You should use source.

 On Oct 9, 4:52 pm, Wes James compte...@gmail.com wrote:
 I changed the db source in db.py from sqlite to postgres and I get:

 NameError: global name 'psycopg2' is not defined

 If I run python I can import psycopg2.

 I notice that when I run w2p from the cli it says it sees sqlite, but
 it does not say that it sees postgres.

 ??

 thx,

 -wes
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32586] Re: t3 app with latest w2p trunk

2009-10-09 Thread Wes James

I just started up an app  I had with web2py 1.54:

Version 1.54 (2008-12-31 17:10:24)
Database drivers available: SQLite3, Postgre

This is what I get with current trunk:

Database drivers available: SQLite3, PostgreSQL

Hmmm,  maybe there is something with wsgihandler.py.  It worked with sqlite.

I just ran the app from the cli, It works there, but not via wsgi.
(but sqlite does)

-wes

On Fri, Oct 9, 2009 at 4:17 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 Are you using source or binary? the binary version does not see your
 modules. You should use source.

 On Oct 9, 4:52 pm, Wes James compte...@gmail.com wrote:
 I changed the db source in db.py from sqlite to postgres and I get:

 NameError: global name 'psycopg2' is not defined

 If I run python I can import psycopg2.

 I notice that when I run w2p from the cli it says it sees sqlite, but
 it does not say that it sees postgres.

 ??

 thx,

 -wes
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32587] Re: web2py wiki

2009-10-09 Thread Richard

uploaded to GAE here: http://web2py-wiki.appspot.com/wiki
The first page I accessed threw an error but worked on a refresh.

How do I create a developer user, apart from using appadmin?



On Oct 9, 9:36 am, Richard richar...@gmail.com wrote:
  I really don't know much about GAE.
  Can you help in this issue?

 yeah sure, I'll have a look.

 On Oct 9, 7:28 am, Álvaro Justen [Turicas] alvarojus...@gmail.com
 wrote:

  On Thu, Oct 8, 2009 at 09:27, Richard richar...@gmail.com wrote:

   It's great when people from the community take ownership of useful
   applications like this!

   Is the wiki able to run on the GAE?

  I really don't know much about GAE.
  Can you help in this issue?

   I noticed a few links that could perhaps be made more pretty:
   - tags
   - edit page

   Also is it possible to edit the page I'm looking at directly? I only
   saw the edit link through the _pages list view.

  When you are logged in and is in group 'developer' an 'edit' link
  appear in top of the page.
  I have to change this - the actual 'permission' system have some bugs
  (for example: non-developers can't create pages).

   And when I click on the edit link I get a Redirect Loop error -
   Firefox has detected that the server is redirecting the request for
   this address in a way that will never complete.

  It should be a bug of permission system - I'll see this later.

  Thanks.

   Richard

   On Oct 8, 12:57 pm, Álvaro Justen [Turicas] alvarojus...@gmail.com
   wrote:
   On Wed, Oct 7, 2009 at 22:15, John Heenan johnmhee...@gmail.com wrote:

On Oct 8, 1:15 am, Álvaro Justen [Turicas] alvarojus...@gmail.com
wrote:
Please use:http://wiki.web2py.com/
(instead ofhttp://www.web2py.com/wiki-itactuallywill redirect to
former URL)

 Great work.

Just a small suggestion to remain in line with current wiki practices
that would make potential adopters less nervous.

There are good sound practical reasons to to make the wiki appear to
live off a directory that is part of the URL. For example
   http://wiki.web2py.com/wiki. I know it looks ugly and redundant but it
is sound.

   http://wiki.web2py.comcouldbemade to redirect 
   tohttp://wiki.web2py.com/wiki

This is fromhttp://www.mediawiki.org/wiki/Manual:Short_URL

   http://example.com/wiki/Page_title(thisisthe standard, same as
in Wikipedia)
   http://wiki.example.com/Page_title(notrecommended!)

   Hi John,
   for now, it'll be too dificult to adopt this URI schema since we have
   wiki hosted in different server than site.
   In a near future we'll have only one server to host all web2py-related
   apps so we can change URIs.
   Yeh, cool URIs don't change...and I know that wiki.web2py.com isn't a
   cool URI - so it'll change. :-)
   But you can rest assured that I will place the redirecting HTTP Moved
   Permanently when do it.

   Thanks for that.

   --
    Álvaro Justen
    Peta5 - Telecomunicações e Software Livre
    21 3021-6001 / 9898-0141
    http://www.peta5.com.br/

  --
   Álvaro Justen
   Peta5 - Telecomunicações e Software Livre
   21 3021-6001 / 9898-0141
   http://www.peta5.com.br/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32588] stupid question: How to format a table.id in a form ?

2009-10-09 Thread Leandro - ProfessionalIT

Hi,

  I have a custom form and I need show the table.id in this format:
0 in the page. How to do this ?

  Ex:
  labelspan{{=form.custom.label.id}}/span
{{=form.custom.widget.id}}/label

   This show me: 1
   But I need that show me in this way: 1

   Any idea ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32589] Re: stupid question: How to format a table.id in a form ?

2009-10-09 Thread mdipierro

I assume this is an update form (else the id is not defined). you can
do

{{=%.5i % form.record.id}}

On Oct 9, 7:01 pm, Leandro - ProfessionalIT lsever...@gmail.com
wrote:
 Hi,

   I have a custom form and I need show the table.id in this format:
 0 in the page. How to do this ?

   Ex:
   labelspan{{=form.custom.label.id}}/span
 {{=form.custom.widget.id}}/label

    This show me: 1
    But I need that show me in this way: 1

    Any idea ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32590] Re: web2py wiki

2009-10-09 Thread Álvaro Justen [Turicas]

Hi Joe,

On Fri, Oct 9, 2009 at 05:22, Joe Barnhart joe.barnh...@gmail.com wrote:
 We could make the wiki even simpler...

 Get rid of comments on each page.  The wiki IS comments it doesn't need
 additional comments!

I agree.

 Get rid of tags.  Tags imply we know in advance what the structure of the
 wiki is.  We don't.  Instead the structure should evolve dynamically with
 wiki pages.

Hmmm, I'm not sure about this. If you were talking about categories,
ok, but the tag concept is more free then categories.
By the way, I think we need some way to categorize pages. I'm thinking
in namespaces (like in Dokuwiki).

 Generate a set of search keys for each page.  Filter out the punctuation and
 whitespace, then toss uninteresting words ('a', 'the', etc) and save the
 remaining words as a text field to help with full-text searching.

Good thing!

 Cache the generated HTML in the database to avoid re-processing the RST
 every time a page hit occurs.  Most entries are edited rarely but viewed
 often.

Yes, it was just in my ToDo list.

 Permission levels should have site administrators, site contributors
 (editors), and guests.  Admins can edit immutable pages, contributors can
 create and edit normal content, and guests can read anything but not edit.

I think it is simple but is what we need for now. Ok, added to ToDo list.

 The design goal should look more like MediaWiki and less like a blog, IMHO.
 Less space wasted for header and navigation and more area devoted to
 content.

 I've also been playing with ideas for the web2py wiki.  See my site at
 http://www.site51.net/wiki  for an unfinished prototype.

wiki2py - I liked this name!

 Try the editing feature and notice the AJAX call to process RST and preview
 your changes.  Just click at the bottom of the edit page to re-render the
 RST at any time.

Very good! Can you contribute with your code? We need more developers.

 Create a new page just by entering its WikiName in the URL and then hitting
 edit.  Remember to edit the main page and add your new page to the list.

It is done this way in web2py wiki!
Enter in:
http://wiki.web2py.com/My_new_page
If the page exists, it'll show the page; else it'll redirect you to:
http://wiki.web2py.com/_create/My_new_page

 This wiki sample is unprotected by signon, so it'll probably get defaced
 quickly and I'll have to take it down.  But for awhile you can see the
 direction I am suggesting -- albeit in a very unfinished state!

 Joe B.

Thanks, Joe.


On Fri, Oct 9, 2009 at 17:22, Thadeus Burgess thade...@thadeusb.com wrote:
 Once we get the new wiki situated, we can start going through the google
 groups history and looking for questions that have been asked, and adding
 them to the wiki :)

 Little things such as
 http://www.mail-archive.com/web2py@googlegroups.com/msg16724.html

 would be awesome for learning the framework without too much searching.

Hi Thadeus,
Yes, it'll be very good! Unfortunately I can't do this for now since
I'm doing other things.
So, users, please help!


On Fri, Oct 9, 2009 at 20:01, Richard richar...@gmail.com wrote:
 uploaded to GAE here: http://web2py-wiki.appspot.com/wiki
 The first page I accessed threw an error but worked on a refresh.

Hi Richard, thinks for that.

 How do I create a developer user, apart from using appadmin?

This app doesn't provide an way to do it instead of using appadmin.
I think you can create a function, something like that:
def create_users():
db.auth_user.insert(...)
db.auth_membership.insert(...)

-- 
 Álvaro Justen
 Peta5 - Telecomunicações e Software Livre
 21 3021-6001 / 9898-0141
 http://www.peta5.com.br/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32591] Re: suggestions for wiki site

2009-10-09 Thread Álvaro Justen [Turicas]

On Fri, Oct 9, 2009 at 16:20, Wes James compte...@gmail.com wrote:
 Use new web2py logo for the wiki instead of the balloon with the check mark.

 Change a collaboration tool for web2py community to a collaboration
 tool for the web2py community on the front.

Thanks.

-- 
 Álvaro Justen
 Peta5 - Telecomunicações e Software Livre
 21 3021-6001 / 9898-0141
 http://www.peta5.com.br/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32592] Re: Try out admin editor

2009-10-09 Thread Iceberg

You are right, Yarko. And perhaps that is exactly why we can not
expect much from those editors-inside-a-browser-window. Let it be. :-)

On Oct10, 2:55am, Yarko Tymciurak yark...@gmail.com wrote:
 CTRL-S  is too old, and too widely used;  it's save from probably every
 browser in every environment in existence

 In ASCII, it is Device Control 3, and has been used for terminal control
 since the beginnings of the use of terminals.



 On Fri, Oct 9, 2009 at 3:52 AM, Iceberg iceb...@21cn.com wrote:

  Do you mean that the ctrl+s is already implemented in current web2py
  latest trunk?

  But I tried in IE7, ctrl+s doesn't invoke any action. And I tried in
  Chrome3, ctrl+s just invoke the browser's built-in save current page
  to local harddisk feature.

  Well, not a big deal. I am just curious to know whether ctrl+s works
  in other user's environment. If it does not work, I won't mind because
  it is not really my first choice to edit my app. :-)

  On Oct7, 10:10pm, mdipierro mdipie...@cs.depaul.edu wrote:
   Please check again it should be there

   On Oct 7, 4:26 am, Iceberg iceb...@21cn.com wrote:

Looks like the problem is already addressed 3 weeks ago. But I did not
find a file named keyboard.js in our web2py admin.

 http://sourceforge.net/projects/editarea/forums/forum/556921/topic/33...

On Oct7, 11:24am, mdipierro mdipie...@cs.depaul.edu wrote:

 Can you send me a patch?

 On Oct 6, 7:30 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:

  Still the main problem with admin editor is this
  wrong-refreshing/wrong-displaying trauma - never solved or did I
  miss smth ?

  On Oct 5, 2009 3:47 AM, Iceberg iceb...@21cn.com wrote:

  Did not really try the admin editor until recently. Nice as a handy
  tool for some quick typing, the only inconvenience is the lack of
  ctrl
  +s shortcut to save a file. Is it possible to add this feature?
  Since
  I notice the ctrl+f etc can work.

  BTW, the word_wrap.gif icon is missing in the toolbar.

  Regards,
  Iceberg
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32593] Re: Could someone clear up some questions about cache?

2009-10-09 Thread Iceberg

Or in other word, @cache.ram(...) ALWAYS caches what the OUTPUT of a
controller action.

HOWEVER, if the output is a dict, then the web2py core will further
render them by the DEFAULT view. If the output is a string, then the
web2py core will serve it as-is. This is a rendering feature of web2py
core, and has nothing to do with cache feature.

Hope this explanation makes thing clear.

Regards,
Iceberg

On Oct10, 1:27am, mdipierro mdipie...@cs.depaul.edu wrote:
 @cache.ram(...)
 def index(): return dict(a=3)

 caches the dict only

 @cache.ram(...)
 def index(): return response.render(a=3)

 caches the html

 On Oct 9, 11:00 am, Thadeus Burgess thade...@thadeusb.com wrote:



  When you apply @cache to an controller action, what is actually cached, is
  it just the response from the function, or the generated html? or the
  returned dict() ?

  Is there a way to have web2py just cache the generated html and serve it
  like it was a static html file, depending on the request.env.path_info ?

  -Thadeus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32594] Re: Error in GAE

2009-10-09 Thread Joseph Jude

it does. I did the below  it worked in gae

def index():
  sm=HELO
  print sm.lower()
  return

It should be something else. Also is there any other way achieve this:
having a description (the user can input in upper or lower) finding
out the id?

Thx,
Joseph

On Oct 9, 10:33 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 GAE does not support .lower()

 sorry

 On Oct 9, 12:31 pm, Joseph Jude ceph...@gmail.com wrote:

  Hi,
  When I execute the below code in GAE it throws an error: unsupported
  operand type(s) for %: 'NoneType' and 'dict'. However this works ok in
  a non-GAE environment. Any tips?

  print db(db.paid_by.paid_by.lower()=='cash').select(db.paid_by.ALL)[0]
  ['id']

  Basically what I have is the description and I want to get the
  corresponding id stored in the database.

  Thank you in advance,
  Joseph


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32595] Re: Could someone clear up some questions about cache?

2009-10-09 Thread Thadeus Burgess
Is there a way to cache two different versions of a function?

Say you have a contact page, that when users are logged in, includes a
comments and suggestions form, however when your not logged in, does not
display this form.

Is there a way to cache one version for logged in users, and the other
version for everyone else? The html never changes except for the display of
the form.

-Thadeus




On Fri, Oct 9, 2009 at 9:07 PM, Iceberg iceb...@21cn.com wrote:

 WEVER, if the output is a dict, then the web2py core will further
 render them by the DEFAULT view. If the output is a string, then the
 web2py core will serve it as-is. This is a rendering feature of web2py
 core, and has nothing to do with cache fe


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32596] Re: Error in GAE

2009-10-09 Thread mdipierro

It is not the same. GAE is pure python and the lower() operator of a
string is implemented.

In the following case

db(db.table.field.lower()==value).select( ... )

.lower is not the string operator but it is a web2py method of the
field object that is mapped into SQL

SELECT ... WHERE LOWER(table.field)=value;

GAE has no equivalent of the LOWER(..) in SQL therefore
db.table.field.lower() cannot be mapped.

Hope it makes sense.

Massimo


On Oct 9, 9:24 pm, Joseph Jude ceph...@gmail.com wrote:
 it does. I did the below  it worked in gae

 def index():
   sm=HELO
   print sm.lower()
   return

 It should be something else. Also is there any other way achieve this:
 having a description (the user can input in upper or lower) finding
 out the id?

 Thx,
 Joseph

 On Oct 9, 10:33 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  GAE does not support .lower()

  sorry

  On Oct 9, 12:31 pm, Joseph Jude ceph...@gmail.com wrote:

   Hi,
   When I execute the below code in GAE it throws an error: unsupported
   operand type(s) for %: 'NoneType' and 'dict'. However this works ok in
   a non-GAE environment. Any tips?

   print db(db.paid_by.paid_by.lower()=='cash').select(db.paid_by.ALL)[0]
   ['id']

   Basically what I have is the description and I want to get the
   corresponding id stored in the database.

   Thank you in advance,
   Joseph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32597] Re: Try out admin editor

2009-10-09 Thread Yarko Tymciurak
On Fri, Oct 9, 2009 at 9:01 PM, Iceberg iceb...@21cn.com wrote:


 You are right, Yarko. And perhaps that is exactly why we can not
 expect much from those editors-inside-a-browser-window. Let it be. :-)


 hehehe yes, and I have some ancient, reptilian memory of CTRL-S
being used to stop output at the terminal (and I think it used to send a
NACK down the 300 baud lines; back in those days - which were SO much nicer
than punched cards and printouts -  at 300 baud, or about 30 characters per
second   yes, 2-3 seconds per LINE of output on your terminal!!!  
you simply did NOT need paging programs much, and interactive editors had to
be EXTREMELY efficient in output, or no one would use them!

Ah,,,   Good old  CTRL-S / CTRL-Q    for STOP and RERUME output;
_those were the days!

NOT! :-)


 On Oct10, 2:55am, Yarko Tymciurak yark...@gmail.com wrote:
  CTRL-S  is too old, and too widely used;  it's save from probably every
  browser in every environment in existence
 
  In ASCII, it is Device Control 3, and has been used for terminal
 control
  since the beginnings of the use of terminals.
 
 
 
  On Fri, Oct 9, 2009 at 3:52 AM, Iceberg iceb...@21cn.com wrote:
 
   Do you mean that the ctrl+s is already implemented in current web2py
   latest trunk?
 
   But I tried in IE7, ctrl+s doesn't invoke any action. And I tried in
   Chrome3, ctrl+s just invoke the browser's built-in save current page
   to local harddisk feature.
 
   Well, not a big deal. I am just curious to know whether ctrl+s works
   in other user's environment. If it does not work, I won't mind because
   it is not really my first choice to edit my app. :-)
 
   On Oct7, 10:10pm, mdipierro mdipie...@cs.depaul.edu wrote:
Please check again it should be there
 
On Oct 7, 4:26 am, Iceberg iceb...@21cn.com wrote:
 
 Looks like the problem is already addressed 3 weeks ago. But I did
 not
 find a file named keyboard.js in our web2py admin.
 
  http://sourceforge.net/projects/editarea/forums/forum/556921/topic/33.
 ..
 
 On Oct7, 11:24am, mdipierro mdipie...@cs.depaul.edu wrote:
 
  Can you send me a patch?
 
  On Oct 6, 7:30 am, Kuba Kucharski kuba.kuchar...@gmail.com
 wrote:
 
   Still the main problem with admin editor is this
   wrong-refreshing/wrong-displaying trauma - never solved or did
 I
   miss smth ?
 
   On Oct 5, 2009 3:47 AM, Iceberg iceb...@21cn.com wrote:
 
   Did not really try the admin editor until recently. Nice as a
 handy
   tool for some quick typing, the only inconvenience is the lack
 of
   ctrl
   +s shortcut to save a file. Is it possible to add this feature?
   Since
   I notice the ctrl+f etc can work.
 
   BTW, the word_wrap.gif icon is missing in the toolbar.
 
   Regards,
   Iceberg
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32598] Re: reCaptcha example not working?

2009-10-09 Thread devnull

Hm. The page loads with the error response flash. Other than that it
works.

def cap():
from gluon.tools import Recaptcha
form=FORM(
Recaptcha(request,public_key,private_key),
INPUT(_type='submit'))
if form.accepts(request.vars,session):
response.flash='done!'
else:
response.flash='nope.'
return dict(form=form)


On Oct 9, 6:16 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 oops. fixed thanks. Please let us know if this works for you.

 On Oct 9, 4:57 pm, devnull ache...@gmail.com wrote:

  Awesome -- thanks! (By the way, the page says [captcha and recaptha]
  and should say [captcha and recaptcha])

  On Oct 9, 5:24 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   The example was incorrect because uses an old file with bugs. You
   should use the Recaptcha helper built in web2py. I fixed the example

  http://www.web2py.com/AlterEgo/default/show/99

   On Oct 9, 2:26 pm, devnull ache...@gmail.com wrote:

The controller below initially displays the flash 'some other error in
your form' right when the page loads.

If I leave the captcha field blank and hit submit, it flashes 'done!'
The same thing happens if I type something incorrect in the captcha
field and then hit submit.

What should I do differently? The example 
fromhttp://www.web2py.com/AlterEgo/default/show/99
looks ok to me... (Thanks in advance)

public_key='(a very long key from reCAPTCHA)'
private_key='(a very long key from reCAPTCHA with a hyphen in it)'

def cap():
    form=FORM(RECAPTCHA(request,public_key,private_key),INPUT
(_type='submit'))
    if form.accepts(request.vars,session): response.flash='done!'
    elif form.errors.has_key('captcha'): response.flash='invalid
captcha'
    else: response.flash='some other error in your form'
    return dict(form=form)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32599] Re: newbie: returning Controller variable to View

2009-10-09 Thread ed

Hi Massimo,
Your suggestion is very neat and beyond my limited web2py knowledge:

Mind that you do not need anything like this if your purpose is login.
In that case web2py already provides method for login and the user
info is simply in
{{=auth.user.first_name}} {{=auth.user.last_name}}
--
I tried the above code in the View p Hi, {{=auth.user.first_name}}/
p unfortunately got an error;
AttributeError: 'NoneType' object has no attribute 'first_name'
---
I searched and found this at Mark Mail:
auth.user.id  -- this is the global variable 'auth' which has a
variable named 'user' which in turn has a named  variable called
'id'.  This variable is valid only after a user is logged on and it
refers to the id of the current user.  If no one is logged in,
auth.user does not exist and has the value of 'None'.  But None has no
named variable 'id' so you get an error if you try to use it.
--
So, definitely with the following Controller code i was not able to
logged in since my View encountered an Attribute error: Nonetype
object has no attribute 'first_name'  and failed to display
{{=auth.user.first_name}}? The following is the actual code:
Controller:
def user:
if request.args(0)=='login':
form = SQLFORM.factory(
Field('emailad', 'emailad',requires=[IS_LENGTH
(maxsize=30,error_message='Maximum length 30 chars..'),IS_EMAIL(),
IS_IN_DB(db,'auth_user.email',error_message='Email address does not
exist.')], required=True, label='Email Address'),
Field('password', 'password', requires=[IS_IN_DB
(db,'auth_user.password',error_message='Password is not the
same.')],label='Password'))
form[0][-1][1].append(INPUT
(_type='button',_value='Cancel',_onclick=window.location='%s';%URL
(r=request,f='index')))

if form.accepts(request.vars, session):
em=request.vars.emailad
session.flash = 'You are now logged in %s .' %
name
redirect(URL(r=request,f='loggedin'))
return dict(form=form)
View:
{{extend 'layout2.html'}}
p
ph3Hi {{=auth.user.first_name}}/h3/p
p
.
Massimo, i tried to adopt your code but an error was encountered
during the run. What shall i do to adopt your code which is very
simple? Thank you again for your patience and very prompt responses.

On Oct 9, 8:59 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Something like this?

 def page1():
     form=SQLFORM.factory(Field('email',requires=IS_IN_DB
 (db,'auth_user.email')))
     if form.accepts(request.vars, session):
           redirect(URL(r=request,f='page2',dict(em=form.vars.email))
     return dict(form=form)

 {{extend 'layout.html'}}{{=form}}

 def page2():
     rows=db(db.auth_user.email==request.vars.em).select()
     if not rows: redirect(URL(r=request,f='page1'))
     return dict(name=rows.first().first_name)

 {{extend 'layout.html'}}Hello {{=name}}

 Mind that you do not need anything like this if your purpose is login.
 In that case web2py already provides method for login and the user
 info is simply in
 {{=auth.user.first_name}} {{=auth.user.last_name}}

 On Oct 9, 1:34 am, ed edbi...@rocketmail.com wrote:

  Hi Massimo,
  Okay, redirect returns page but without any variable. Any hint how to
  render a page name loggedin that says; Hi Ed, welcome! after a
  succesful login using the code i created?. Sorry, i'm a newbie with
  very limited web2py knowledge and stucked on this.  Thank you in
  advance Massimo.

  On Oct 9, 11:58 am, mdipierro mdipie...@cs.depaul.edu wrote:

   mind that redirect is a function that raises an HTTP exception which
   causes the server to send and HTTP 303 response. redirect never
   returns and your view is never rendered.

   Massimo

   On Oct 8, 9:22 pm, ed edbi...@rocketmail.com wrote:

The display went well because i filled a session with a constant Ed
and not a result of a db().select(). So, the constant variable was
displayed without a hitch. When i used db().select() the display went
like:
[{'first_name': 'Ed'}]
The above display is the result of the following code:
Controller:
if form.accepts(request.vars, session):
    em=request.vars.emailad
    name1 = db(db.auth_user.email==em).select(db.auth_user.first_name)
[0]
    name=name1.first_name
    return dict(red=redirect(URL(r=request,f='loggedin')), name=name)
..
View:
{{extend 'layout2.html'}}
p
ph3Hi {{=name}}/h3/p
p
.
 This was the result of the view, Hi [{'first_name': 'Ed'}]. I've
googled and searched the manual and tried examples but to no avail.
Thanks in advance.
--~--~-~--~~~---~--~~
You received this 

[web2py:32600] Re: newbie: returning Controller variable to View

2009-10-09 Thread Yarko Tymciurak
Think!   (ask these questions in your view, and think of how to handle it;
then think if there is any better place to handle it; then decide --- T H I
N K!!! ;-)


On Fri, Oct 9, 2009 at 9:40 PM, ed edbi...@rocketmail.com wrote:


 Hi Massimo,
 Your suggestion is very neat and beyond my limited web2py knowledge:

 
 Mind that you do not need anything like this if your purpose is login.
 In that case web2py already provides method for login and the user
 info is simply in
 {{=auth.user.first_name}} {{=auth.user.last_name}}

 --
 I tried the above code in the View p Hi, {{=auth.user.first_name}}/
 p unfortunately got an error;
 AttributeError: 'NoneType' object has no attribute 'first_name'

 ---
 I searched and found this at Mark Mail:
 auth.user.id  -- this is the global variable 'auth' which has a
 variable named 'user' which in turn has a named  variable called
 'id'.  This variable is valid only after a user is logged on and it
 refers to the id of the current user.  If no one is logged in,
 auth.user does not exist and has the value of 'None'.  But None has no
 named variable 'id' so you get an error if you try to use it.

 --
 So, definitely with the following Controller code i was not able to
 logged in since my View encountered an Attribute error: Nonetype
 object has no attribute 'first_name'  and failed to display
 {{=auth.user.first_name}}? The following is the actual code:
 Controller:
 def user:
if request.args(0)=='login':
form = SQLFORM.factory(
Field('emailad', 'emailad',requires=[IS_LENGTH
 (maxsize=30,error_message='Maximum length 30 chars..'),IS_EMAIL(),
 IS_IN_DB(db,'auth_user.email',error_message='Email address does not
 exist.')], required=True, label='Email Address'),
Field('password', 'password', requires=[IS_IN_DB
 (db,'auth_user.password',error_message='Password is not the
 same.')],label='Password'))
form[0][-1][1].append(INPUT
 (_type='button',_value='Cancel',_onclick=window.location='%s';%URL
 (r=request,f='index')))

if form.accepts(request.vars, session):
em=request.vars.emailad
 session.flash = 'You are now logged in %s .' %
 name
 redirect(URL(r=request,f='loggedin'))
 return dict(form=form)
 View:
 {{extend 'layout2.html'}}
 p
 ph3Hi {{=auth.user.first_name}}/h3/p
 p
 .
 Massimo, i tried to adopt your code but an error was encountered
 during the run. What shall i do to adopt your code which is very
 simple? Thank you again for your patience and very prompt responses.

 On Oct 9, 8:59 pm, mdipierro mdipie...@cs.depaul.edu wrote:
  Something like this?
 
  def page1():
  form=SQLFORM.factory(Field('email',requires=IS_IN_DB
  (db,'auth_user.email')))
  if form.accepts(request.vars, session):
redirect(URL(r=request,f='page2',dict(em=form.vars.email))
  return dict(form=form)
 
  {{extend 'layout.html'}}{{=form}}
 
  def page2():
  rows=db(db.auth_user.email==request.vars.em).select()
  if not rows: redirect(URL(r=request,f='page1'))
  return dict(name=rows.first().first_name)
 
  {{extend 'layout.html'}}Hello {{=name}}
 
  Mind that you do not need anything like this if your purpose is login.
  In that case web2py already provides method for login and the user
  info is simply in
  {{=auth.user.first_name}} {{=auth.user.last_name}}
 
  On Oct 9, 1:34 am, ed edbi...@rocketmail.com wrote:
 
   Hi Massimo,
   Okay, redirect returns page but without any variable. Any hint how to
   render a page name loggedin that says; Hi Ed, welcome! after a
   succesful login using the code i created?. Sorry, i'm a newbie with
   very limited web2py knowledge and stucked on this.  Thank you in
   advance Massimo.
 
   On Oct 9, 11:58 am, mdipierro mdipie...@cs.depaul.edu wrote:
 
mind that redirect is a function that raises an HTTP exception which
causes the server to send and HTTP 303 response. redirect never
returns and your view is never rendered.
 
Massimo
 
On Oct 8, 9:22 pm, ed edbi...@rocketmail.com wrote:
 
 The display went well because i filled a session with a constant
 Ed
 and not a result of a db().select(). So, the constant variable was
 displayed without a hitch. When i used db().select() the display
 went
 like:
 [{'first_name': 'Ed'}]
 The above display is the result of the following code:
 Controller:
 if form.accepts(request.vars, session):
 em=request.vars.emailad
 name1 =
 db(db.auth_user.email==em).select(db.auth_user.first_name)
 [0]
 name=name1.first_name
 return dict(red=redirect(URL(r=request,f='loggedin')),
 name=name)
 

[web2py:32601] Re: newbie: returning Controller variable to View

2009-10-09 Thread Yarko Tymciurak
On Fri, Oct 9, 2009 at 9:46 PM, Yarko Tymciurak yark...@gmail.com wrote:

 Think!   (ask these questions in your view, and think of how to handle it;
 then think if there is any better place to handle it; then decide --- T H I
 N K!!! ;-)



Oh, heck - you're a newbie, and hopefully you did some more thinking before
you see this response...

Massimo is fond of showing the right answers (which is great, don't get me
wrong);
I find more joy in finding the right questions (for they lead to the right
answers, or sometimes more than one...)

So -

one thing you are missing (I think) is that the view and the controller do
not share variables - you have to pass them in a dict; you are only passing
form;   Massimo's example passed a value.  That' step one.  You discovered
step two - you must somewhere be sure that the value is a valid string (even
if empty).



return dict(form=form, name=auth_user.first_name)



{{ if not name:   name =  }}



Does that help?

- Yarko

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32602] Re: Could someone clear up some questions about cache?

2009-10-09 Thread Iceberg

On Oct10, 10:28am, Thadeus Burgess thade...@thadeusb.com wrote:
 Is there a way to cache two different versions of a function?

 Say you have a contact page, that when users are logged in, includes a
 comments and suggestions form, however when your not logged in, does not
 display this form.

 Is there a way to cache one version for logged in users, and the other
 version for everyone else? The html never changes except for the display of
 the form.

 -Thadeus


Perhaps you can use:

@cache( '%s_%s' % ( request.env.path_info, auth.is_logged_in() ), ...)
def foo():
  # your stuff

However I doubt a cached form would ever get processed when it is self-
submit (to the same url). Did not try that before. Please post your
test result.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32603] Re: newbie: returning Controller variable to View

2009-10-09 Thread ed

Hi Yarko,
Of course i did some thinking, %$# ;-)  This is  a redirect not a
a return dict() issue wherein variables are not passed as per Massimo
and what i also observed.  No, your solution did not help! So, review
your solution and T H I N K ;-)

On Oct 10, 11:07 am, Yarko Tymciurak yark...@gmail.com wrote:
 On Fri, Oct 9, 2009 at 9:46 PM, Yarko Tymciurak yark...@gmail.com wrote:
  Think!   (ask these questions in your view, and think of how to handle it;
  then think if there is any better place to handle it; then decide --- T H I
  N K!!! ;-)

 Oh, heck - you're a newbie, and hopefully you did some more thinking before
 you see this response...

 Massimo is fond of showing the right answers (which is great, don't get me
 wrong);
 I find more joy in finding the right questions (for they lead to the right
 answers, or sometimes more than one...)

 So -

 one thing you are missing (I think) is that the view and the controller do
 not share variables - you have to pass them in a dict; you are only passing
 form;   Massimo's example passed a value.  That' step one.  You discovered
 step two - you must somewhere be sure that the value is a valid string (even
 if empty).

 

 return dict(form=form, name=auth_user.first_name)

 

 {{ if not name:   name =  }}

 

 Does that help?

 - Yarko
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32604] ajax with javascript

2009-10-09 Thread weheh

I have an ajax call that updates the contents of a div. The code that
generates the div contents also embeds some javascripts into the div.
For example, one of the javascripts is the ubiquitous share this
button. A simple test case, therefore, is a div that just inserts the
sharethis button and changes the url, title, and summary of the
SHARETHIS.addEntry({title:new title,url:http://www.mydomain.com/
12345,summary:We are great ... etc.

Upon initial creation of the web page, the share this button is
visible. However, after regenerating the contents of the div using the
ajax call, the share this button disappears.

I am also trying this with other javascript programs and they also
don't function.

So, I'm wondering if I have to do something special to get a
javascript to run if the javascript is created by an ajax call?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32605] Re: Could someone clear up some questions about cache?

2009-10-09 Thread Thadeus Burgess
ahh yes, it just appears on the page with no message on submit, so caching a
page with a form that submits to itself does not work (perhaps if the form
was changed to submit elsewhere.

What about only caching if auth.is_logged_in() == False?

-Thadeus




On Fri, Oct 9, 2009 at 10:37 PM, Iceberg iceb...@21cn.com wrote:


 On Oct10, 10:28am, Thadeus Burgess thade...@thadeusb.com wrote:
  Is there a way to cache two different versions of a function?
 
  Say you have a contact page, that when users are logged in, includes a
  comments and suggestions form, however when your not logged in, does not
  display this form.
 
  Is there a way to cache one version for logged in users, and the other
  version for everyone else? The html never changes except for the display
 of
  the form.
 
  -Thadeus


 Perhaps you can use:

 @cache( '%s_%s' % ( request.env.path_info, auth.is_logged_in() ), ...)
 def foo():
  # your stuff

 However I doubt a cached form would ever get processed when it is self-
 submit (to the same url). Did not try that before. Please post your
 test result.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32606] Re: ajax with javascript

2009-10-09 Thread Thadeus Burgess
In your callback, instead of replacing the HTML, eval the response

success=function (msg){ eval(msg); };

So you would return javascript to accomplish what you want

from your view

return 
jQuery('#mydiv').html('%s');
jQuery('#otherdiv').css({color: red});
 % (DIV(Hi))



-Thadeus




On Fri, Oct 9, 2009 at 10:59 PM, weheh richard_gor...@verizon.net wrote:

 ave an ajax call that updates the contents of a div. The code that
 generates the div contents also embeds some javascripts into the div.
 For example, one of the javascripts is the ubiquito


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32607] Re: Try out admin editor

2009-10-09 Thread weheh

You don't have to be old like Yarko and me to remember ^S ^Q. Just
open a DOS window and do a dir /s from the c: drive. Then trip down
memory lane as you exercise your left hand's 3rd, 4th and 5th fingers.

On Oct 9, 10:33 pm, Yarko Tymciurak yark...@gmail.com wrote:
 On Fri, Oct 9, 2009 at 9:01 PM, Iceberg iceb...@21cn.com wrote:

  You are right, Yarko. And perhaps that is exactly why we can not
  expect much from those editors-inside-a-browser-window. Let it be. :-)

  hehehe yes, and I have some ancient, reptilian memory of CTRL-S
 being used to stop output at the terminal (and I think it used to send a
 NACK down the 300 baud lines; back in those days - which were SO much nicer
 than punched cards and printouts -  at 300 baud, or about 30 characters per
 second   yes, 2-3 seconds per LINE of output on your terminal!!!  
 you simply did NOT need paging programs much, and interactive editors had to
 be EXTREMELY efficient in output, or no one would use them!

 Ah,,,   Good old  CTRL-S / CTRL-Q    for STOP and RERUME output;
 _those were the days!

 NOT! :-)



  On Oct10, 2:55am, Yarko Tymciurak yark...@gmail.com wrote:
   CTRL-S  is too old, and too widely used;  it's save from probably every
   browser in every environment in existence

   In ASCII, it is Device Control 3, and has been used for terminal
  control
   since the beginnings of the use of terminals.

   On Fri, Oct 9, 2009 at 3:52 AM, Iceberg iceb...@21cn.com wrote:

Do you mean that the ctrl+s is already implemented in current web2py
latest trunk?

But I tried in IE7, ctrl+s doesn't invoke any action. And I tried in
Chrome3, ctrl+s just invoke the browser's built-in save current page
to local harddisk feature.

Well, not a big deal. I am just curious to know whether ctrl+s works
in other user's environment. If it does not work, I won't mind because
it is not really my first choice to edit my app. :-)

On Oct7, 10:10pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Please check again it should be there

 On Oct 7, 4:26 am, Iceberg iceb...@21cn.com wrote:

  Looks like the problem is already addressed 3 weeks ago. But I did
  not
  find a file named keyboard.js in our web2py admin.

   http://sourceforge.net/projects/editarea/forums/forum/556921/topic/33.
  ..

  On Oct7, 11:24am, mdipierro mdipie...@cs.depaul.edu wrote:

   Can you send me a patch?

   On Oct 6, 7:30 am, Kuba Kucharski kuba.kuchar...@gmail.com
  wrote:

Still the main problem with admin editor is this
wrong-refreshing/wrong-displaying trauma - never solved or did
  I
miss smth ?

On Oct 5, 2009 3:47 AM, Iceberg iceb...@21cn.com wrote:

Did not really try the admin editor until recently. Nice as a
  handy
tool for some quick typing, the only inconvenience is the lack
  of
ctrl
+s shortcut to save a file. Is it possible to add this feature?
Since
I notice the ctrl+f etc can work.

BTW, the word_wrap.gif icon is missing in the toolbar.

Regards,
Iceberg- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32608] Re: ajax with javascript

2009-10-09 Thread weheh

OK, that explains the doc a little better. The doc gives an example of
eval in the callback but I couldn't get it to work earlier. Now that I
really need it, I'm going to have to bang my head on it a bit to get
it working. The doc was a little thin about exactly why it was needed.
Now I understand.

On Oct 10, 12:06 am, Thadeus Burgess thade...@thadeusb.com wrote:
 In your callback, instead of replacing the HTML, eval the response

 success=function (msg){ eval(msg); };

 So you would return javascript to accomplish what you want

 from your view

 return 
 jQuery('#mydiv').html('%s');
 jQuery('#otherdiv').css({color: red});
  % (DIV(Hi))

 -Thadeus



 On Fri, Oct 9, 2009 at 10:59 PM, weheh richard_gor...@verizon.net wrote:
  ave an ajax call that updates the contents of a div. The code that
  generates the div contents also embeds some javascripts into the div.
  For example, one of the javascripts is the ubiquito- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32609] Re: t3 app with latest w2p trunk

2009-10-09 Thread Wes James

Massimo,

I'll look at my server monday.  I just brought the w2p app to a
macbook pro, installed postgres 8.4.1, installed mod_wsgi and got
psycopg2 2.0.13 and it worked without an error.

Sorry for the hassle.

-wes

On Fri, Oct 9, 2009 at 4:17 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 Are you using source or binary? the binary version does not see your
 modules. You should use source.

 On Oct 9, 4:52 pm, Wes James compte...@gmail.com wrote:
 I changed the db source in db.py from sqlite to postgres and I get:

 NameError: global name 'psycopg2' is not defined

 If I run python I can import psycopg2.

 I notice that when I run w2p from the cli it says it sees sqlite, but
 it does not say that it sees postgres.

 ??

 thx,

 -wes
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---