Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-11 Thread Caleb Hattingh
On 11 June 2011 04:55, Pierre Thibault pierre.thibau...@gmail.com wrote:
 2011/6/9 Pierre Thibault pierre.thibau...@gmail.com

 2011/6/9 caleb.hatti...@gmail.com

 On , Anthony abasta...@gmail.com wrote:
  Do you have an app to reproduce the problem? I created an app named
  Castalia (note the capitalization) with a module
  /modules/selfgroup/castalia/config.py, which I think is the same structure
  and naming as Alessandro's app. In a controller action, I then did:
 
  from selfgroup.castalia import config
 
  and it seems to work fine, though I believe Alessandro was getting an
  import error at that point. But maybe I'm missing something.

 I think we should ask him to make a small test app for us that
 demonstrates the problem. Else we're guessing.

 Alessandro, can you send us the code having the unexpected behavior so the
 Windows guys can take a look?

 As I understand, you have to remove the capitalization to make it work
 because otherwise even if the capitalization match, it does not import
 properly. Right?

 --

 OK, since we cannot reproduce the bug and we cannot know precisely what the
 bug is, we will consider the issue closed. Do you think there is something
 to add about this issue?

I would agree with that.  Anthony has tested the capitalization issue
directly (it works), and I checked what happens on Windows with
capitalized nested folders and import statements (they work if the
capitalization is matched).   I think we need a reproducible test case
here.


[web2py] where is facebook class GraphAPI() ?

2011-06-11 Thread Luis Goncalves
This seems like a silly question, but I can't figure it out!

Trying to follow the example in the book to use openAuth2.0 and facebook's 
graphAPI, we need to

 from facebook import GraphAPI

as suggested, I installed pyfacebook

first  via apt-cache search pyfacebook --  apt-get install python-facebook
(but that seemed not to be it)

and then via 

git clone https://github.com/sciyoshi/pyfacebook.git

However, it seems that neither one of these defines class GraphAPI()

so that I get a web2py error :

 from facebook import GraphAPI

ImportError: cannot import name GraphAPI


Are these both the wrong versions of a python facebook module?

Where can I get the proper one?

Thanks,
Luis. 


[web2py] Re: IS_IN_SET validator not working as expected

2011-06-11 Thread selecta


On Jun 10, 2:21 pm, Ross Peoples ross.peop...@gmail.com wrote:
 I'm sure you've already considered this, but maybe use a checkbox instead,
yes but this is a question of style an readability, radioboxes with
text are just far more descriptive an a single small checkbox
 as it's specifically designed to handle true/false. The SELECT widget and
 associated IS_IN_SET is designed to return a string value. So If you really
 want to use a select box for this instead of a checkbox, then you need to do
  the boolean parsing yourself.
:(
 Also, depending on the database you are
 using, you may be able to substitute 'True' and 'False' with 1 and 0, which
 the database may automatically parse to a boolean on insert/update.
i use sqlight, what would you recommend

i will try using 0 and 1 to see if maybe 0 is detected as False


[web2py] Re: BUG causes all error tickets to be unknown

2011-06-11 Thread selecta
I created a bug report, would be good if someone could confirm this
bug
http://code.google.com/p/web2py/issues/detail?id=301


[web2py] Re: where is facebook class GraphAPI() ?

2011-06-11 Thread Anthony
It appears the book is incorrect. I think you're looking for Facebook 
python-sdk (https://github.com/facebook/python-sdk), not pyfacebook.
 
Anthony

On Saturday, June 11, 2011 2:40:25 AM UTC-4, Luis Goncalves wrote:

 This seems like a silly question, but I can't figure it out! 

 Trying to follow the example in the book to use openAuth2.0 and facebook's 
 graphAPI, we need to

  from facebook import GraphAPI

 as suggested, I installed pyfacebook

 first  via apt-cache search pyfacebook --  apt-get install python-facebook
 (but that seemed not to be it)

 and then via 

 git clone https://github.com/sciyoshi/pyfacebook.git

 However, it seems that neither one of these defines class GraphAPI()

 so that I get a web2py error :

   from facebook import GraphAPI

 ImportError: cannot import name GraphAPI


 Are these both the wrong versions of a python facebook module?

 Where can I get the proper one?

 Thanks,
 Luis. 



[web2py] Re: where is facebook class GraphAPI() ?

2011-06-11 Thread Anthony
Now fixed in the book, with link to the Python SDK.

On Saturday, June 11, 2011 2:55:04 AM UTC-4, Anthony wrote:

 It appears the book is incorrect. I think you're looking for Facebook 
 python-sdk (https://github.com/facebook/python-sdk), not pyfacebook.
  
 Anthony

 On Saturday, June 11, 2011 2:40:25 AM UTC-4, Luis Goncalves wrote:

 This seems like a silly question, but I can't figure it out! 

 Trying to follow the example in the book to use openAuth2.0 and facebook's 
 graphAPI, we need to

  from facebook import GraphAPI

 as suggested, I installed pyfacebook

 first  via apt-cache search pyfacebook --  apt-get install 
 python-facebook
 (but that seemed not to be it)

 and then via 

 git clone https://github.com/sciyoshi/pyfacebook.git

 However, it seems that neither one of these defines class GraphAPI()

 so that I get a web2py error :

   from facebook import GraphAPI

 ImportError: cannot import name GraphAPI


 Are these both the wrong versions of a python facebook module?

 Where can I get the proper one?

 Thanks,
 Luis. 



[web2py] Re: where is facebook class GraphAPI() ?

2011-06-11 Thread Luis Goncalves
Awesome! Thank you!  Will check it out!

Luis.


[web2py] Web2py's editor abort and communication error

2011-06-11 Thread Phyo Arkar
It seems web2py editor's ajax save functtion abort too fast , abort and
connection timeout within 1-2 seconds which is unrealistic . Especially
working over online , to the office machine from home.

Can we increase timeout value? like 60 secs or more. It is unrelaistic to
work online especially countrys of different locations.


I am looking into code how to do it.


Re: [web2py] Web2py's editor abort and communication error

2011-06-11 Thread Phyo Arkar
Is there also normal save , not ajaxed one? I think i remember having one
long before.

doClickSave comes from where?

On Sat, Jun 11, 2011 at 2:04 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote:

 It seems web2py editor's ajax save functtion abort too fast , abort and
 connection timeout within 1-2 seconds which is unrealistic . Especially
 working over online , to the office machine from home.

 Can we increase timeout value? like 60 secs or more. It is unrelaistic to
 work online especially countrys of different locations.


 I am looking into code how to do it.








[web2py] FixComputerpProblemsSite Surely Knows How to Fix Computer Problems!

2011-06-11 Thread fix computer problems
 

I was having problems with my laptop before. Good thing *
FixComputerpProblemsSite* helped me fix it. And they are really the experts 
when it comes to solving any computer related issues. They can easily fix 
computer problems http://www.fixcomputerproblemssite.com/ without breaking 
a sweat. 

*FixComputerProblemsSite *expert computer technicians are very well trained 
to fix computer problems that we as computer users encounter in our PC.  They 
know how to properly diagnose the issues with computers and then give exact 
solutions for the said PC issues. They surely did know how to fix computer 
problems!

So if you need any help with your computer you can always count on 
*FixComputerProblemsSite 
*to fix computer problems that you can have with your PC.

To know more about *FixComputerProblemsSite *computer support services 
call*1-888-216-6589
* or log on to http://www.fixcomputerproblemssite.com


Re: [web2py] Re: ajax is not working in components

2011-06-11 Thread Stifan Kristi
thank you so much for corrected my mistook code, anthony, but the results is
same now the blog comment show appears loading...  First time my incorrect
code show the blog comment form page appears loading... and then right now
the blog comment show. actually i come from the simple things one (without
ajax, jquery, and component) and right now i try to learn and implement both
of it's.

any hints, suggestion or references?
thank you so much before.

On Sat, Jun 11, 2011 at 12:44 PM, Anthony abasta...@gmail.com wrote:

 I think you're specifying the target div name in the wrong place. Instead
 of:

  {{=LOAD('default', 'blog_comment_show.load', args = page.id, ajax =
 True)}}
 {{=LOAD('default', 'blog_comment_add.load', args = page.id,
 target = 'comments_%s hidden' % page.id, ajax = True)}}

 I think you want:

  {{=LOAD('default', 'blog_comment_show.load', args = page.id,
 target = 'comments_%s hidden' % page.id, ajax = True)}}
 {{=LOAD('default', 'blog_comment_add.load', args = page.id, ajax = True)}}


 Does that change help?

 Also, in __add_2(), you might want to return response.js conditionally,
 only when a new comment has actually been added -- otherwise, when the page
 first loads, the blog_comment_show() component will be called/load twice
 (once because of the LOAD, and once because of the response.js from the
 blog_component_add() component).

 If you're still having problems, I recommend creating a simplified version
 of the setup just to see if you can get the basic inter-component
 communication working -- then add in all the complexity and see where it
 breaks down.

 Anthony

 On Saturday, June 11, 2011 12:46:29 AM UTC-4, 黄祥 wrote:

 yes, i have.

  def blog_comment_show():
 return
 __show_2(blog, blog_index, blog_comment, blog_comment_blog_id, 
 blog_comment_active)

 @auth.requires_login()
 def __show_2(table_0, index_link, table_1, field, active):
 page = table_0(request.args(0)) or redirect(URL(index_link))
 results = db((field == page.id)  (active == True)).select(orderby =
 ~table_1.id,
cache =
 (cache.ram,

 10))
 return dict(page = page, results = results)

 i think the error is on target load, so that my page keep showing
 loading...

 did you have any way out for this probelm?
 thank you so much.

 On Sat, Jun 11, 2011 at 11:05 AM, Anthony abas...@gmail.com wrote:

 Do you have a blog_comment_show() action in your controller?

 On Friday, June 10, 2011 10:58:56 PM UTC-4, 黄祥 wrote:

   thank you so much for your hints, anthony, but, pardon me, the
 results on the form components is loading..., the page didn't show an 
 error,
 but keep loading..., is there something i missed in my code?

 e.g.
   *=== controller ===*

 blog = db.blog
 blog_comment = db.blog_comment
 blog_comment_blog_id = db.blog_comment.blog_id
 blog_comment_active = db.blog_comment.is_active

 def blog_comment_add():
 return __add_2(blog, blog_index, blog_comment, blog_comment_blog_id)

 @auth.requires_login()
 def __add_2(table_0, index_link, table_1, field):
 page = table_0(request.args(0)) or redirect(URL(index_link))
 field.default = page.id
 form = crud.create(table_1, message = T('Record Inserted'),
next = URL(args = page.id))
 *response.js = 'web2py_component(action = %s, target = %s)' *
 *  % (URL('blog_comment_show.load'), *
 *  'comments_%s hidden' % page.id)*
 return dict(page = page, form = form)

 *=== view ===*

 {{=LOAD('default', 'blog_comment_show.load', args = page.id, ajax =
 True)}}
 *{{=LOAD('default', 'blog_comment_add.load', args = page.id, *
 *target = 'comments_%s hidden' % page.id, ajax = True)}}*

 *=== blog_comment_show.load ===*

 {{if len(results):}}
 span onclick = jQuery('.comments_{{=page.id
 }}').slideToggle('slow');
 {{=A(T('Comments (%s)' % len(results)), _href = '#')}}
 /span

 div class = comments_{{=page.id}} hidden
 {{for blog_comment in results:}}
 {{=SPAN(db.auth_user[blog_comment.created_by].first_name, T(' on
 '),
 blog_comment.created_on, T(' Said '),
  blog_comment.comment)}}
 {{=BR()}}
 {{=SPAN(blog_comment.like,
 _id = 'blog_comment_like_%s' % blog_comment.id)}}
 {{=SPAN(T('People Like This'))}}

 span onclick=jQuery('#id').val('{{=blog_comment.id}}');
ajax('{{=URL('blog_comment_like.load')}}',
 ['id'], 'blog_comment_like_{{=blog_comment.id}}');
 {{=A(T('Like'), _href = '#')}}
 /span
 {{=BR()}}
 {{pass}}
 /div
 {{else:}}
 {{=DIV(B(T('No Comment Posted Yet')))}}
 {{pass}}

 *=== blog_comment_add.load ===*

 {{=DIV(A(T('Post a Comment'), _href = '#'), _class = 'post',
_onclick = jQuery('.form_%s').slideToggle('slow'); % page.id
 )}}

 {{=DIV(form, _class = 'form_%s hidden' % page.id,
_onsubmit = ajax('blog_comment_add', [], 'comments_%s 

Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-11 Thread Pierre Thibault
2011/6/11 Alessandro Iob alessandro@gmail.com

 Hi Pierre,

 I'll send a test application to Anthony this weekend.

 I've experienced the same problem under OS X (with a case-insensitive file
 system) when I've changed the case from Castalia to castalia:
 web2py tried to include the controllers from old Castalia path and not
 from the new lowercase version. Obviously I've closed and restarted web2py
 before changing the application name. I think OS X has a filename cache of
 some kind.

 Alessandro


OK, cool! I'll be the reference for questions on the code. If needed, you
may write directly to my personal mail box. I don't follow everything on the
web2py mailing list because there is too many messages so I may sometimes
miss something.
-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


Re: [web2py] Re: web2py 1.96.4 is OUT

2011-06-11 Thread Caleb Hattingh
On 11 June 2011 11:42, Pierre Thibault pierre.thibau...@gmail.com wrote:

 2011/6/11 Alessandro Iob alessandro@gmail.com

 Hi Pierre,

 I'll send a test application to Anthony this weekend.

 I've experienced the same problem under OS X (with a case-insensitive file
 system) when I've changed the case from Castalia to castalia:
 web2py tried to include the controllers from old Castalia path and not
 from the new lowercase version. Obviously I've closed and restarted web2py
 before changing the application name. I think OS X has a filename cache of
 some kind.

 Alessandro


 OK, cool! I'll be the reference for questions on the code. If needed, you
 may write directly to my personal mail box. I don't follow everything on the
 web2py mailing list because there is too many messages so I may sometimes
 miss something.


Ok, I am going to make a strategic exit here.  I think you guys will be able
to solve it, now that we know what to look for, and will have a test case.
 I looked over the code in custom_import and I couldn't find anything wrong
regarding casing.

kind regards
Caleb


[web2py] genrate daily value form for a month

2011-06-11 Thread max
I am trying to generate a custom form depending on he month for user
to add values to each day key
is there any idea how to do it dynamically?


[web2py] Re: Web2py and PyScripter debugging

2011-06-11 Thread Dmitriy
Here it is:

1. Download the latest web2py sources 
http://web2py.com/examples/default/download

2. Create the following 'web2py_no_threads.py' file at the web2py
directory:

### web2py_no_threads.py ###
from wsgiref.simple_server import make_server, demo_app
from gluon.main import wsgibase
httpd = make_server('', 8000, wsgibase)
print Serving HTTP on port 8000...
# Respond to requests until process is killed
httpd.serve_forever()
### end file ###

3. Download and install PyScripter 
http://code.google.com/p/pyscripter/downloads/list

4. Create new project in PyScripter.

5. Import all web2py or single application files to the project

6. Select Run-Python Engine-Remote in menu

7. Place somewhere in the sources break point (F5)

8. Open web2py_no_threads.py file

9. Start debugging the project (menu Run-Debug)

Sometimes PyScripter hangs on debug. Also you can't debug a modified
source code - you need to restart the debugging.
Despite these shortcomings, PyScripter is convenient tool for
debugging and editing web2py on Windows.


Re: [web2py] Re: ajax is not working in components

2011-06-11 Thread Anthony
Try getting rid of the hidden in your component target name. The target 
name is used as a CSS div id, and I don't think you can have multiple 
CSS ids for a single HTML element.
 
Anthony

On Saturday, June 11, 2011 5:39:42 AM UTC-4, 黄祥 wrote:

 thank you so much for corrected my mistook code, anthony, but the results 
 is same now the blog comment show appears loading...  First time my 
 incorrect code show the blog comment form page appears loading... and then 
 right now the blog comment show. actually i come from the simple things one 
 (without ajax, jquery, and component) and right now i try to learn and 
 implement both of it's.  

 any hints, suggestion or references? 
 thank you so much before.

 On Sat, Jun 11, 2011 at 12:44 PM, Anthony abas...@gmail.com wrote:

 I think you're specifying the target div name in the wrong place. Instead 
 of:
   
  {{=LOAD('default', 'blog_comment_show.load', args = page.id, ajax = 
 True)}}
 {{=LOAD('default', 'blog_comment_add.load', args = page.id, 
 target = 'comments_%s hidden' % page.id, ajax = True)}}
  
 I think you want:
  
  {{=LOAD('default', 'blog_comment_show.load', args = page.id,
  target = 'comments_%s hidden' % page.id, ajax = True)}}
 {{=LOAD('default', 'blog_comment_add.load', args = page.id, ajax = 
 True)}}
  
  
 Does that change help?
  
 Also, in __add_2(), you might want to return response.js conditionally, 
 only when a new comment has actually been added -- otherwise, when the page 
 first loads, the blog_comment_show() component will be called/load twice 
 (once because of the LOAD, and once because of the response.js from the 
 blog_component_add() component).
  
 If you're still having problems, I recommend creating a simplified version 
 of the setup just to see if you can get the basic inter-component 
 communication working -- then add in all the complexity and see where it 
 breaks down.
  
 Anthony
  
 On Saturday, June 11, 2011 12:46:29 AM UTC-4, 黄祥 wrote:

  yes, i have. 

  def blog_comment_show():
 return 
 __show_2(blog, blog_index, blog_comment, blog_comment_blog_id, 
 blog_comment_active)

 @auth.requires_login()
 def __show_2(table_0, index_link, table_1, field, active):
 page = table_0(request.args(0)) or redirect(URL(index_link))
 results = db((field == page.id)  (active == True)).select(orderby = 
 ~table_1.id, 
cache = 
 (cache.ram, 
 
 10))
 return dict(page = page, results = results)

 i think the error is on target load, so that my page keep showing 
 loading...

 did you have any way out for this probelm?
 thank you so much.

   On Sat, Jun 11, 2011 at 11:05 AM, Anthony aba...@gmail.com wrote:

   Do you have a blog_comment_show() action in your controller?
   
 On Friday, June 10, 2011 10:58:56 PM UTC-4, 黄祥 wrote:

thank you so much for your hints, anthony, but, pardon me, the 
 results on the form components is loading..., the page didn't show an 
 error, 
 but keep loading..., is there something i missed in my code? 

 e.g.
 *=== controller ===*

 blog = db.blog
 blog_comment = db.blog_comment
 blog_comment_blog_id = db.blog_comment.blog_id
 blog_comment_active = db.blog_comment.is_active

 def blog_comment_add():
 return __add_2(blog, blog_index, blog_comment, 
 blog_comment_blog_id)

 @auth.requires_login()
 def __add_2(table_0, index_link, table_1, field):
 page = table_0(request.args(0)) or redirect(URL(index_link))
 field.default = page.id
 form = crud.create(table_1, message = T('Record Inserted'), 
next = URL(args = page.id))
 *response.js = 'web2py_component(action = %s, target = %s)' *
 *  % (URL('blog_comment_show.load'), *
 *  'comments_%s hidden' % page.id)*
 return dict(page = page, form = form)

 *=== view ===*

 {{=LOAD('default', 'blog_comment_show.load', args = page.id, ajax = 
 True)}}
 *{{=LOAD('default', 'blog_comment_add.load', args = page.id, *
 *target = 'comments_%s hidden' % page.id, ajax = True)}}*
 
 *=== blog_comment_show.load ===*

 {{if len(results):}}
 span onclick = jQuery('.comments_{{=page.id
 }}').slideToggle('slow');
 {{=A(T('Comments (%s)' % len(results)), _href = '#')}}
 /span
 
 div class = comments_{{=page.id}} hidden
 {{for blog_comment in results:}}
 {{=SPAN(db.auth_user[blog_comment.created_by].first_name, T(' 
 on '), 
 blog_comment.created_on, T(' Said '), 
  blog_comment.comment)}}
 {{=BR()}}
 {{=SPAN(blog_comment.like, 
 _id = 'blog_comment_like_%s' % blog_comment.id)}}
 {{=SPAN(T('People Like This'))}}
 
 span onclick=jQuery('#id').val('{{=blog_comment.id}}');
ajax('{{=URL('blog_comment_like.load')}}', 
 ['id'], 'blog_comment_like_{{=blog_comment.id}}');
 

Re: [web2py] Re: Social network plug-in

2011-06-11 Thread Tito Garrido
+1

On Sat, Jun 11, 2011 at 12:47 AM, Luis Goncalves lgoncal...@gmail.comwrote:

 Ciao Massimo!

 Is it now available somewhere for download?   It will be very useful!!!

 Thanks,
 Luis.




-- 

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


Re: [web2py] Script TDD in web2py

2011-06-11 Thread Pierre Thibault
2011/6/10 contatogilson...@gmail.com contatogilson...@gmail.com

 Hello guys,

 I started to create a script to test the scripts that use the library
 unittest projects web2py. I usually like this:

 - I create the folder *tests* in the project;
 - Inside the tests folder create two folders: *models* and *controllers*;

 For now, I have done is to test the model layer. But I ask the help and
 contribution ofall to improve this script, and so we have a full support to
 the use of TDD in both themodel layer as the control. This is good for
 people like me, sympathized greatly with doctests.


Hello Gilson,

This is something I thought about. Here is my idea about web2py testing:

1) I want to use py.test (http://doc.pytest.org/en/latest/) for testing. I
don't want to have to create my test suits manually and with py.test I can
mark my functions with decorators to create test suits.

2) For the controllers, I want to create two types of tests: web GUI tests
and headless tests.

For the web gui tests, I plan to use Windmill (http://www.getwindmill.com/).

For the headless tests, I plan to use WebTest (
http://pythonpaste.org/webtest/).

More specifically, I want my test suits to start web2py on another thread.
This way pydev will be able to give me the code coverage at the end of my
tests. For headless tests, I plan with send my http request with a special
argument like test=true so my controller will know it is a test. Then I
will decorate my controller functions so that instead of returning a
dictionary to be rendered by the view, it will stream the dictionary as a
file and my tests will be able to easily analyze the results by downloading
the file and recreating the same dictionary.

Yet, I have to implemented this solution but this is what I have in mind.

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


Re: [web2py] Script TDD in web2py

2011-06-11 Thread contatogilson...@gmail.com
How to tests with web2py. Need importing gluon libs.
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*



2011/6/11 Pierre Thibault pierre.thibau...@gmail.com

 2011/6/10 contatogilson...@gmail.com contatogilson...@gmail.com

 Hello guys,

 I started to create a script to test the scripts that use the library
 unittest projects web2py. I usually like this:

 - I create the folder *tests* in the project;
 - Inside the tests folder create two folders: *models* and *controllers*;

 For now, I have done is to test the model layer. But I ask the help and
 contribution ofall to improve this script, and so we have a full support to
 the use of TDD in both themodel layer as the control. This is good for
 people like me, sympathized greatly with doctests.


 Hello Gilson,

 This is something I thought about. Here is my idea about web2py testing:

 1) I want to use py.test (http://doc.pytest.org/en/latest/) for testing. I
 don't want to have to create my test suits manually and with py.test I can
 mark my functions with decorators to create test suits.

 2) For the controllers, I want to create two types of tests: web GUI tests
 and headless tests.

 For the web gui tests, I plan to use Windmill (http://www.getwindmill.com/
 ).

 For the headless tests, I plan to use WebTest (
 http://pythonpaste.org/webtest/).

 More specifically, I want my test suits to start web2py on another thread.
 This way pydev will be able to give me the code coverage at the end of my
 tests. For headless tests, I plan with send my http request with a special
 argument like test=true so my controller will know it is a test. Then I
 will decorate my controller functions so that instead of returning a
 dictionary to be rendered by the view, it will stream the dictionary as a
 file and my tests will be able to easily analyze the results by downloading
 the file and recreating the same dictionary.

 Yet, I have to implemented this solution but this is what I have in mind.

 --


 A+

 -
 Pierre
 My blog and profile 
 (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
 YouTube page 
 (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
 Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2




Re: [web2py] Script TDD in web2py

2011-06-11 Thread contatogilson...@gmail.com
Show an example of how you use py.test to perform unit tests on the model
layer and controller.
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*


[web2py] Re: db.define_tables

2011-06-11 Thread Vineet
Anil,
In the View,
1) After the submit button, you have {{=
I wonder how it did not give a syntax error.
Remove it.

2) You have {{=display_string}} after FORM end tag.
Change it to {{=display_msg}}

Like this, it worked correctly on my PC.

Cheers,
Vineet
==
On Jun 10, 6:23 pm, anil manikyam anilmanikya...@gmail.com wrote:
 def login():
     if db((db.table1.username)== request.vars.visitor_name).select():
         redirect(URL('index'))
     else:
         msg='invalid syntax'

     return dict(display_msg=msg)

 form
   input name=visitor_name /
   input type=submit /
   {{=
 /form
 {{=display_string}}

 i tried it but when this display_string used in form it printed before the
 enter the submit button  plz send the code for this


Re: [web2py] Script TDD in web2py

2011-06-11 Thread Pierre Thibault
2011/6/11 contatogilson...@gmail.com contatogilson...@gmail.com

 Show an example of how you use py.test to perform unit tests on the model
 layer and controller.

 _
 *Gilson Filho*
 *Web Developer
 http://gilsondev.com*


I have nothing concrete yet. I am just thinking about what might be the best
strategy.

I don't know what I will do with the models. What one way would be a
controller made to return the globals. Do I need to test the models? It may
be seen as configuration files.

The other thing I plan to do is put the application logic in the modules
directory. This way, I can test the business logic without web2py and I
reuse the logic in other apps.

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


Re: [web2py] Script TDD in web2py

2011-06-11 Thread contatogilson...@gmail.com
Yes, I understand. But the issue is the use of the gluon. Perform tests is
fine, the problem is to run the same tests using the libraries and
gluon. Therefore
it has to import them. Hence the creation of this script.
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*


Re: [web2py] My talk at ChiPy about new features

2011-06-11 Thread Ovidio Marinho
Helo Massimo,

you can provide the applications that example?

Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 88269088
   Paraiba-Brasil



2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com

 http://blip.tv/carlfk/new-web2py-features-5264464

 This talk was kind of improvised. During the talk I discovered a bug
 in 1.96.4 and it is fixed in trunk.


Re: [web2py] My talk at ChiPy about new features

2011-06-11 Thread Ovidio Marinho
I can not get into the administrative interface


Traceback (most recent call last):

  File /home/www-data/web2py/gluon/restricted.py, line 181, in restricted

exec ccode in environment

  File /home/www-data/web2py/applications/apppos/models/db.py
http://127.0.0.1:8000/admin/default/edit/apppos/models/db.py, line
7, in module

auth = Auth(db)

  File /home/www-data/web2py/gluon/tools.py, line 807, in __init__

auth = session.auth

AttributeError: 'NoneType' object has no attribute 'auth'


Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 88269088
   Paraiba-Brasil



2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com

 Is is described in one of the videos here:

 http://vimeo.com/user315328/videos

 anyway, the source code is attached. You will have to delete everything in
 database since you have a different domain than mine.



[web2py] Re: My talk at ChiPy about new features

2011-06-11 Thread Massimo Di Pierro
Do you have the latest web2py?

On Jun 11, 2:23 pm, Ovidio Marinho ovidio...@gmail.com wrote:
 I can not get into the administrative interface

 Traceback (most recent call last):

   File /home/www-data/web2py/gluon/restricted.py, line 181, in restricted

     exec ccode in environment

   File /home/www-data/web2py/applications/apppos/models/db.py
 http://127.0.0.1:8000/admin/default/edit/apppos/models/db.py, line
 7, in module

     auth = Auth(db)

   File /home/www-data/web2py/gluon/tools.py, line 807, in __init__

     auth = session.auth

 AttributeError: 'NoneType' object has no attribute 'auth'

         Ovidio Marinho Falcao Neto
              ovidio...@gmail.com
                      88269088
                    Paraiba-Brasil

 2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com







  Is is described in one of the videos here:

 http://vimeo.com/user315328/videos

  anyway, the source code is attached. You will have to delete everything in
  database since you have a different domain than mine.


Re: [web2py] Re: My talk at ChiPy about new features

2011-06-11 Thread Ovidio Marinho
I did the update and gave crash web2py 196.4, my version is 195.1
Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 88269088
   Paraiba-Brasil



2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com

 Do you have the latest web2py?

 On Jun 11, 2:23 pm, Ovidio Marinho ovidio...@gmail.com wrote:
  I can not get into the administrative interface
 
  Traceback (most recent call last):
 
File /home/www-data/web2py/gluon/restricted.py, line 181, in
 restricted
 
  exec ccode in environment
 
File /home/www-data/web2py/applications/apppos/models/db.py
  http://127.0.0.1:8000/admin/default/edit/apppos/models/db.py, line
  7, in module
 
  auth = Auth(db)
 
File /home/www-data/web2py/gluon/tools.py, line 807, in __init__
 
  auth = session.auth
 
  AttributeError: 'NoneType' object has no attribute 'auth'
 
  Ovidio Marinho Falcao Neto
   ovidio...@gmail.com
   88269088
 Paraiba-Brasil
 
  2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com
 
 
 
 
 
 
 
   Is is described in one of the videos here:
 
  http://vimeo.com/user315328/videos
 
   anyway, the source code is attached. You will have to delete everything
 in
   database since you have a different domain than mine.



[web2py] Re: My talk at ChiPy about new features

2011-06-11 Thread Massimo Di Pierro
Are you saying it crashes with 1.96.4? It should not. What is the
traceback?

On Jun 11, 2:54 pm, Ovidio Marinho ovidio...@gmail.com wrote:
 I did the update and gave crash web2py 196.4, my version is 195.1
         Ovidio Marinho Falcao Neto
              ovidio...@gmail.com
                      88269088
                    Paraiba-Brasil

 2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com







  Do you have the latest web2py?

  On Jun 11, 2:23 pm, Ovidio Marinho ovidio...@gmail.com wrote:
   I can not get into the administrative interface

   Traceback (most recent call last):

     File /home/www-data/web2py/gluon/restricted.py, line 181, in
  restricted

       exec ccode in environment

     File /home/www-data/web2py/applications/apppos/models/db.py
   http://127.0.0.1:8000/admin/default/edit/apppos/models/db.py, line
   7, in module

       auth = Auth(db)

     File /home/www-data/web2py/gluon/tools.py, line 807, in __init__

       auth = session.auth

   AttributeError: 'NoneType' object has no attribute 'auth'

           Ovidio Marinho Falcao Neto
                ovidio...@gmail.com
                        88269088
                      Paraiba-Brasil

   2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com

Is is described in one of the videos here:

   http://vimeo.com/user315328/videos

anyway, the source code is attached. You will have to delete everything
  in
database since you have a different domain than mine.


Re: [web2py] Re: My talk at ChiPy about new features

2011-06-11 Thread Ovidio Marinho
 no, it does not crash, I could not upgrade to the version in web2py 196.4
 Ouvir
Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 88269088
   Paraiba-Brasil



2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com

 Are you saying it crashes with 1.96.4? It should not. What is the
 traceback?

 On Jun 11, 2:54 pm, Ovidio Marinho ovidio...@gmail.com wrote:
  I did the update and gave crash web2py 196.4, my version is 195.1
  Ovidio Marinho Falcao Neto
   ovidio...@gmail.com
   88269088
 Paraiba-Brasil
 
  2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com
 
 
 
 
 
 
 
   Do you have the latest web2py?
 
   On Jun 11, 2:23 pm, Ovidio Marinho ovidio...@gmail.com wrote:
I can not get into the administrative interface
 
Traceback (most recent call last):
 
  File /home/www-data/web2py/gluon/restricted.py, line 181, in
   restricted
 
exec ccode in environment
 
  File /home/www-data/web2py/applications/apppos/models/db.py
http://127.0.0.1:8000/admin/default/edit/apppos/models/db.py, line
7, in module
 
auth = Auth(db)
 
  File /home/www-data/web2py/gluon/tools.py, line 807, in __init__
 
auth = session.auth
 
AttributeError: 'NoneType' object has no attribute 'auth'
 
Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 88269088
   Paraiba-Brasil
 
2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com
 
 Is is described in one of the videos here:
 
http://vimeo.com/user315328/videos
 
 anyway, the source code is attached. You will have to delete
 everything
   in
 database since you have a different domain than mine.



Re: [web2py] Re: My talk at ChiPy about new features

2011-06-11 Thread Ovidio Marinho
 the option to upgrade the web2py is giving error. not upgraded to the new
version.
 Ouvir
Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 88269088
   Paraiba-Brasil



2011/6/11 Ovidio Marinho ovidio...@gmail.com

  no, it does not crash, I could not upgrade to the version in web2py 196.4
  Ouvir
 Ovidio Marinho Falcao Neto
  ovidio...@gmail.com
  88269088
Paraiba-Brasil




 2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com

 Are you saying it crashes with 1.96.4? It should not. What is the
 traceback?

 On Jun 11, 2:54 pm, Ovidio Marinho ovidio...@gmail.com wrote:
  I did the update and gave crash web2py 196.4, my version is 195.1
  Ovidio Marinho Falcao Neto
   ovidio...@gmail.com
   88269088
 Paraiba-Brasil
 
  2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com
 
 
 
 
 
 
 
   Do you have the latest web2py?
 
   On Jun 11, 2:23 pm, Ovidio Marinho ovidio...@gmail.com wrote:
I can not get into the administrative interface
 
Traceback (most recent call last):
 
  File /home/www-data/web2py/gluon/restricted.py, line 181, in
   restricted
 
exec ccode in environment
 
  File /home/www-data/web2py/applications/apppos/models/db.py
http://127.0.0.1:8000/admin/default/edit/apppos/models/db.py,
 line
7, in module
 
auth = Auth(db)
 
  File /home/www-data/web2py/gluon/tools.py, line 807, in __init__
 
auth = session.auth
 
AttributeError: 'NoneType' object has no attribute 'auth'
 
Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 88269088
   Paraiba-Brasil
 
2011/6/11 Massimo Di Pierro massimo.dipie...@gmail.com
 
 Is is described in one of the videos here:
 
http://vimeo.com/user315328/videos
 
 anyway, the source code is attached. You will have to delete
 everything
   in
 database since you have a different domain than mine.





[web2py] Re: My talk at ChiPy about new features

2011-06-11 Thread cjrh
On Jun 11, 5:29 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 http://blip.tv/carlfk/new-web2py-features-5264464

 This talk was kind of improvised. During the talk I discovered a bug
 in 1.96.4 and it is fixed in trunk.

Nice talk.  I need to look at .load more.


[web2py] Re: My talk at ChiPy about new features

2011-06-11 Thread cjrh
Also, how are plugins version-controlled?  They're not part of the web2py 
source repository as far as I can see.

Re: [web2py] Script TDD in web2py

2011-06-11 Thread Pierre Thibault
2011/6/11 contatogilson...@gmail.com contatogilson...@gmail.com

 Yes, I understand. But the issue is the use of the gluon. Perform tests is
 fine, the problem is to run the same tests using the libraries and gluon. 
 Therefore
 it has to import them. Hence the creation of this script.


The code to start web2py is in web2py.py. I'll have to create a similar code
to start it but I want to start it without a gui interface. I also want to
start it at the beginning of the tests and stop it at the end.

Your strategy is different: you are executing code like if that code was in
a web2py environment. I prefer to use another strategy: I run web2py itself
and I send real http request from a real client. This way, I cannot have
bugs because the mockup environment is different from the real one: I am
testing the real thing. I think it is a better approach.

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] Re: My talk at ChiPy about new features

2011-06-11 Thread Massimo Di Pierro
 plugin_wiki is version control under cube2py. Eventually all of them
should be under une bug plugins project.

On Jun 11, 3:59 pm, cjrh caleb.hatti...@gmail.com wrote:
 Also, how are plugins version-controlled?  They're not part of the web2py
 source repository as far as I can see.


Re: [web2py] how to use this ajax upload script with web2py?

2011-06-11 Thread Dr Schmulge
Take a slice )
http://web2pyslices.com/main/slices/take_slice/103

2011/6/11 danto web2py.n...@gmail.com:
 http://valums.com/ajax-upload/

 It's supposed to be a ready-to-use asyncronous upload (could be a widget,
 later) with load indicator, but I don't know how to integrate with my form.
 In fact, I get no errors on console (as the author say after set debug:
 true) but still my upload fails. I can tested with rocket and
 apache+mod_wsgi, but probably should blame my implementation:

 ### CONTROLLER:
 def post():
     response.files.append(URL('static','css/fileuploader.css'))
     response.files.append(URL('static','js/fileuploader.js'))
     form = SQLFORM.factory(
     Field('nombre'),
     Field('archivo','upload',uploadfolder='applications/test/uploads')
     )

     if form.accepts(request.vars,session):
     response.flash = 'ok'
     elif form.errors:
     response.flash = 'no'
     return locals()


 ### VIEW:

 {{extend 'layout.html'}}
 div id=fileuploader
     noscript
     pPlease enable JavaScript to use file uploader./p
     !-- or put a simple form for upload here --
     /noscript
 /div

 {{=response.toolbar()}}

 script
 var uploader = new qq.FileUploader({
     // pass the dom node (ex. $(selector)[0] for jQuery users)
     element: document.getElementById('fileuploader'),
     // path to server-side upload scripts
     action: 'post',
     debug: true,
 });
 /script

 thank you for your time



Re: [web2py] Re: Social network plug-in

2011-06-11 Thread Stifan Kristi
thank you so much for your shared, massimo.


[web2py] Re: My talk at ChiPy about new features

2011-06-11 Thread Luther Goh Lu Feng


On Jun 11, 11:29 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 http://blip.tv/carlfk/new-web2py-features-5264464

 This talk was kind of improvised. During the talk I discovered a bug
 in 1.96.4 and it is fixed in trunk.

Since it is possible to use DAL as outside of web2py, does it deserve
an entry in http://wiki.python.org/moin/HigherLevelDatabaseProgramming
?


[web2py] Re: My talk at ChiPy about new features

2011-06-11 Thread Massimo Di Pierro
I think so. WOuld you kindly app a link to the file in the mercurial
repo?

On Jun 11, 5:40 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:
 On Jun 11, 11:29 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:

 http://blip.tv/carlfk/new-web2py-features-5264464

  This talk was kind of improvised. During the talk I discovered a bug
  in 1.96.4 and it is fixed in trunk.

 Since it is possible to use DAL as outside of web2py, does it deserve
 an entry inhttp://wiki.python.org/moin/HigherLevelDatabaseProgramming
 ?


[web2py] How to access facebook graph of logged in user

2011-06-11 Thread Luis Goncalves
I've been trying to use OAuth2.0 and the facebook module to allow a user to 
login to my site, and then use the facebook API to obtain info about them 
via GraphAPI.

The web2py manual (8.1.6, subsection OAuth2.0 and facebook) describes two 
methods, the first to login to your own app, the second to a specific 
[user's] Facebook to access its API. 

I think the second one is what I want. I followed the example:

from facebook import GraphAPI 

... 

class FacebookAccount(OAuthAccount):

...

auth.settings.login_form =  FacebookAccount(globals())


But when I try it out, I get the error message from facebook:

{
   error: {
  type: OAuthException,
  message: Invalid redirect_uri: Given URL is not allowed by the 
Application configuration.
   } 

} 


I noticed that the redirect URL that is shown in the browser seems not to be 
that of the website running my web2py app (it has it's own domain name), but 
rather the IP address of my local connection at home (emphasized with bold 
and large font in the URL string below):

https://graph.facebook.com/oauth/authorize?redirect_uri=http%3A%2F%2F*
69.234.184.92*
%2Fsandbox_luis%2Fdefault%2Fuser%2Flogin%3F_next%3D%252Fsandbox_luis%252Fdefault%252Findexresponse_type=codeclient_id=219317251425055

 
What have I done wrong, or what else do I need to do?  
(I have registered the app on facebook, and defined the site URL and site 
domain there.)

Thanks,
Luis.


Re: [web2py] Script TDD in web2py

2011-06-11 Thread contatogilson...@gmail.com
So when you create the script makes available for us to test and to use =)
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*



2011/6/11 Pierre Thibault pierre.thibau...@gmail.com

 2011/6/11 contatogilson...@gmail.com contatogilson...@gmail.com

 Yes, I understand. But the issue is the use of the gluon. Perform tests is
 fine, the problem is to run the same tests using the libraries and gluon.
  Therefore it has to import them. Hence the creation of this script.


 The code to start web2py is in web2py.py. I'll have to create a similar
 code to start it but I want to start it without a gui interface. I also want
 to start it at the beginning of the tests and stop it at the end.

 Your strategy is different: you are executing code like if that code was in
 a web2py environment. I prefer to use another strategy: I run web2py itself
 and I send real http request from a real client. This way, I cannot have
 bugs because the mockup environment is different from the real one: I am
 testing the real thing. I think it is a better approach.


 --


 A+

 -
 Pierre
 My blog and profile 
 (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
 YouTube page 
 (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
 Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2




Re: [web2py] Re: ajax is not working in components

2011-06-11 Thread Stifan Kristi
thank you so much for your hints, anthony, i've already move out the hidden
class div but got the same results, the components show as a loading
i don't know where is the problem.


Re: [web2py] Script TDD in web2py

2011-06-11 Thread Pierre Thibault
2011/6/11 contatogilson...@gmail.com contatogilson...@gmail.com

 So when you create the script makes available for us to test and to use =)


Well, it is better than I thought. I don't even need such a script! Sorry to
say that. :-)

I can start web2py from Eclipse with code coverage. After that I can start,
also from Eclipse, my test suit (gui or headless) and I will get both my
test results and my code coverage for my tests after the tests has run. The
only thing I will need is the decorator thing I talked about. I don't think
it will be hard to do.
-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


Re: [web2py] Re: ajax is not working in components

2011-06-11 Thread Anthony
On Saturday, June 11, 2011 8:47:05 PM UTC-4, 黄祥 wrote: 

 thank you so much for your hints, anthony, i've already move out the hidden 
 class div but got the same results, the components show as a loading 
 i don't know where is the problem.

 
I'm not sure exactly where your problem is. The following very simple 
example works for me:
 
In default.py controller:
 
def index():
return dict()
 
def component1():
form=FORM('Comment:', INPUT(_name='comment'), INPUT(_type='submit'))
if request.vars:
response.js='web2py_component(action=%s, target=%s)' % 
(URL('component2'), 'component2')
return dict(form=form)
 
def component2():
return dict(time=request.now)
 
 
In default/index.html view:
 
{{extend 'layout.html'}}
 
h2Enter Comment/h2
{{=LOAD('default','component1.load',ajax=True)}}
 
h2Time/h2
{{=LOAD('default','component2.load',target='component2',ajax=True)}}
 
 
When I submit a comment in component1, it causes the time to be updated in 
component2. So, it is possible to set response.js in one component to reload 
another component. You must have an error somewhere else in your code. I 
would say start with something simple like my code above that you can get to 
work, and then gradually add in the additional complexity of your code, and 
see where it breaks.
 
Anthony
 
 


[web2py] Create tables with models in subfolders

2011-06-11 Thread contatogilson...@gmail.com
 When I put the scripts of a particular model in a subfolder, it does not
create tables in the database when I run web2py. I have not disabled the
migrate. By default it is not true?

app/ models/ tests/ tests.py
validators.py
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*


Re: [web2py] Create tables with models in subfolders

2011-06-11 Thread Bruno Rocha
Models on subfolders will run only if it matches the requested URL

All models under /models/ will be executed on every request, but models
under /models/tests/ will run only if your url matches
http://domain:8000/yourapp/tests/ and if you have a controller named
tests.py


On Sun, Jun 12, 2011 at 12:06 AM, contatogilson...@gmail.com 
contatogilson...@gmail.com wrote:

 When I put the scripts of a particular model in a subfolder, it does not
 create tables in the database when I run web2py. I have not disabled the
 migrate. By default it is not true?

 app/ models/ tests/ tests.py
 validators.py
 _
 *Gilson Filho*
 *Web Developer
 http://gilsondev.com*




Re: [web2py] Script TDD in web2py

2011-06-11 Thread anil manikyam
  *i want to update last row in a table in web2py how?*


-- 
@n!l m@n!ky@m


Re: [web2py] Re: Web2py and PyScripter debugging

2011-06-11 Thread anil manikyam
*i want to update last row in a table in web2py how?*


-- 
@n!l m@n!ky@m


Re: [web2py] FixComputerpProblemsSite Surely Knows How to Fix Computer Problems!

2011-06-11 Thread anil manikyam
*i want to update last row in a table in web2py how?*
-- 
@n!l m@n!ky@m


[web2py] How to implement a fail whale for a web2py website?

2011-06-11 Thread Luis Goncalves

Is there an easy/straightforward way to implement a fail whale for a 
web2py website?

I've noticed strange errors (some sort of timeout) when uploading files 
(running on Amazon ec2), and of course, the site is in beta and bad things 
may happen.

I'd like to have a graceful landing page the user is taken to irrespective 
of what error occurred.  Once there, the user can click to start over.

It's OK to give up admin ticket tracking,  I just don't want user to see 
strange errors, whatever they may be.

Thank you,
Luis.


Re: [web2py] Script TDD in web2py

2011-06-11 Thread Pierre Thibault
2011/6/12 anil manikyam anilmanikya...@gmail.com




  *i want to update last row in a table in web2py how?*


 --
 @n!l m@n!ky@m



Hi Anil, I think this is a bit out of subject. Please, open a new conversion
with a new subject.
-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] list:string and Update form

2011-06-11 Thread Oscar
Hi,

I have a model using a list:string field called type.

Validation for type field:
IS_IN_SET({'finished':T('Finished'),'service':T('Service')},
zero=T(-- Choose Type Of The Product --))),

So, when I create an update form using SQLFORM it shows the form fine
but, the dropdown thats belong to type doesn't have the right value or
selection, it just shows -- Choose Type Of The Product --

form = SQLFORM(db[main_data.settings.table_name_products],
   record = product_id,
   fields = product_fields,
   submit_button = submit_button,
   formstyle = 'divs')

I need that type field get the right value from the string stored in
the DB to get it showed in the dropdown. How I can do this?

Regards,

Oscar.


[web2py] Re: How to implement a fail whale for a web2py website?

2011-06-11 Thread Massimo Di Pierro
Look into the routes.examples.py and router.examples.py for onerror
parameters:

routes_onerror =
[
 (r'init/400', r'/init/default/
login'),
 (r'init/*', r'/init/static/
fail.html'),
 (r'*/404', r'/init/static/
cantfind.html'),
 (r'*/*', r'/init/error/
index'),
 ]

'*/*' means catch any app/any error and you can redirect to a static
page or another web2py app.



On Jun 12, 12:12 am, Luis Goncalves lgoncal...@gmail.com wrote:
 Is there an easy/straightforward way to implement a fail whale for a
 web2py website?

 I've noticed strange errors (some sort of timeout) when uploading files
 (running on Amazon ec2), and of course, the site is in beta and bad things
 may happen.

 I'd like to have a graceful landing page the user is taken to irrespective
 of what error occurred.  Once there, the user can click to start over.

 It's OK to give up admin ticket tracking,  I just don't want user to see
 strange errors, whatever they may be.

 Thank you,
 Luis.