Re: [web2py] Re: basics of DOM manipulation with web2py

2012-12-25 Thread Bhaskar Ramachandran
Great!. Thank you all for the clarification. I will then re-write my code 
to have SQLFORM or SQLFORM.factory to later be able to inject html into the 
form. Really appreciate the help . I can now move forward!.

Regards,
Bhaskar


On Tuesday, December 25, 2012 9:43:52 AM UTC-6, Anthony wrote:


 But what about the DOM objects like radio buttons, text area etc in the 
 html ?. When the view file is processed and the response object is working 
 on it to generate pure HTML , won't it create a DOM tree structure in 
 memory. ?.


 No, if you just hand code the form HTML in the view but never create a 
 FORM or SQLFORM object, you don't get any server-side DOM. The server-side 
 DOM comes only with the use of the HTML helpers. If you want to take 
 advantage of the FORM DOM on the server but still want to customize your 
 HTML, check out http://web2py.com/books/default/chapter/29/07#Custom-forms
 .

 There are also other benefits of using FORM and SQLFORM in the controller 
 -- they automatically validate user inputs and return and display error 
 messages upon invalid input, and they add a special formkey token to the 
 form to prevent CSRF attacks and double form submission.

 Anthony 


-- 





[web2py] help with finding syntax error in nested if loop in view

2012-12-24 Thread Bhaskar Ramachandran
 a href=#i class={{if ans=='A': }} {{if ans==correctans: 
response.write('icon-ok') else:  response.write('icon-remove') pass }} {{ 
pass }}/i/a

I get a syntax error for the above code in view html file. I am trying to 
dynamically insert a tick icon or a cross icon depending on some variables. 
I tried different ways of expressing the if statements and none of them 
worked. I followed the book that says we should introduce a pass statement 
for every block (sometimes the block is obvious and in that case we don't 
need a pass statement).

Please help catch the cause for syntax error.. Thank you 

-- 





[web2py] basics of DOM manipulation with web2py

2012-12-24 Thread Bhaskar Ramachandran
I am new to web2py and wondering how i can manipulate elements in a form. 
This form is in the view file with the form tags all hand coded in html 
without using the web2py helpers.
Now when an user submits this form, i would like to make some decisions 
based on the user posted information (I could understand how to do this) by 
writing python code in controller. And then i want to change some of the 
elements in the form.
For example, i want to disable all radio buttons in the form and want to 
change some text color in the form.

I see that there is a .element() and .elements() functions to do DOM 
searching. But on what object will i do this search ?. What is the handle 
for the DOM tree structure ?. Is there an object created in memory for my 
form when the user submits the form ?. What will be this objects name. 
It doesn't seem to be same as my form name. I tried a few things and they 
didn't work.

I think in javascript, the client side DOM is accessed as 
document.getElementbyID(...). Similarly, like the document object, what is 
the name of the object that represents the entire html page and the object 
that represents the form within in the server side ?

Thanks in advance...
--Bhaskar

-- 





[web2py] Re: help with finding syntax error in nested if loop in view

2012-12-24 Thread Bhaskar Ramachandran
Hi Paolo, Roberto,

  Thank you very much. 
Paolo,

Your response helped me with the issue. Your option A) worked very 
well!!. Thanks again... However your option B) gave incorrect result. Your 
That is, it is thinking of the statement as follows:
  if ... :
  if . :
  else:
 
But what i intend to do is the following:
  if :
  if..:
 .
  else:
 

It gets very difficult to apply the if.. else statements in more complex 
situations inside the view html code if the basics are not clearly 
understood. So i really want to understand the exact new syntax of using 
the if... else... in view html files before i start using them more and 
more Your help is greatly appreciated. 

--Regards,
Bhaskar


On Monday, December 24, 2012 5:58:47 PM UTC-6, Paolo Caruccio wrote:

 else: statement is inline with if statement.
 the code wrapped in {{ }} follows python syntax rules.

 Alternatives below should work (not tested):

 A) using ternary operator
 a href=#i class={{if ans=='A': }} {{response.write('icon-ok') if 
 ans==correctans else response.write('icon-remove')}} {{ pass }}/i/a

 B) inline syntax with multiple {{ }}
 a href=#i class={{if ans=='A': }} {{if ans==correctans: 
 response.write('icon-ok')}} {{else:  response.write('icon-remove')}} 
 {{pass}} {{ pass }}/i/a

 C) syntax not in line

 a href=#i class={{if ans=='A': }}
 {{if ans==correctans: response.write('icon-ok')
   else:  response.write('icon-remove')
   pass }}
 {{ pass }}/i/a



 Il giorno martedì 25 dicembre 2012 00:40:01 UTC+1, Bhaskar Ramachandran ha 
 scritto:

  a href=#i class={{if ans=='A': }} {{if ans==correctans: 
 response.write('icon-ok') else:  response.write('icon-remove') pass }} {{ 
 pass }}/i/a

 I get a syntax error for the above code in view html file. I am trying to 
 dynamically insert a tick icon or a cross icon depending on some variables. 
 I tried different ways of expressing the if statements and none of them 
 worked. I followed the book that says we should introduce a pass statement 
 for every block (sometimes the block is obvious and in that case we don't 
 need a pass statement).

 Please help catch the cause for syntax error.. Thank you 



-- 





[web2py] Re: help with finding syntax error in nested if loop in view

2012-12-24 Thread Bhaskar Ramachandran
Hi Anthony,

I think it is better to keep these if else (or for or while) statements 
in separate lines for clarity. Otherwise, it is causing trouble... For 
example. how would you interpret the statement below 
a href=#i class={{if ans=='A': }} {{response.write('icon-ok') if 
ans==correctans else response.write('icon-remove')}} {{ pass }}/i/a
This assumes the following logic :
  if ... :
  if . :
  else:
 

But i was thinking that it will implement the following logic:
   if :
  if..:
 .
  else:
 

Most of the examples in the book are in separate lines... So it reduces the 
issues... But for compactness, i am trying to do it in one line... 
--Bhaskar


On Monday, December 24, 2012 10:14:35 PM UTC-6, Anthony wrote:

 It gets very difficult to apply the if.. else statements in more complex 
 situations inside the view html code if the basics are not clearly 
 understood. So i really want to understand the exact new syntax of using 
 the if... else... in view html files before i start using them more and 
 more Your help is greatly appreciated.


 It's exactly the same as in any Python code, except you have to close the 
 if/else with a {{pass}} statement (same with a for or while loop). Check 
 out http://web2py.com/books/default/chapter/29/05#The-views and 
 http://web2py.com/books/default/chapter/29/05#if...elif...else.

 Anthony 


-- 





[web2py] Re: basics of DOM manipulation with web2py

2012-12-24 Thread Bhaskar Ramachandran
Hi Anthony,

In my case, the form is displaying question, image and 4 choices from a 
database. Since the database has many other information like answers etc, i 
decided to customize the form completely by handcoding the html. In between 
the html, i am having statements like {{=db.quiz[1].Achoice}} to inject 
data from the database.
Now, when the user enters a choice by selecting a radio button and submits 
the form, I want to navigate the DOM. There is no statement like 
form=SQLFORM(...) or form=FORM() etc in my controller. So how should i 
now do the DOM parsing ?

Regards,
Bhaskar


On Monday, December 24, 2012 10:18:53 PM UTC-6, Anthony wrote:

 In web2py, you create a form like:

 form = SQLFORM(db.mytable).process()

 In that case, form is the HTML helper object. You would then do something 
 like:

 form.elements('input')

 to find all input elements within the form.

 Anthony

 On Monday, December 24, 2012 10:46:55 PM UTC-5, Bhaskar Ramachandran wrote:

 I am new to web2py and wondering how i can manipulate elements in a form. 
 This form is in the view file with the form tags all hand coded in html 
 without using the web2py helpers.
 Now when an user submits this form, i would like to make some decisions 
 based on the user posted information (I could understand how to do this) by 
 writing python code in controller. And then i want to change some of the 
 elements in the form.
 For example, i want to disable all radio buttons in the form and want to 
 change some text color in the form.

 I see that there is a .element() and .elements() functions to do DOM 
 searching. But on what object will i do this search ?. What is the handle 
 for the DOM tree structure ?. Is there an object created in memory for my 
 form when the user submits the form ?. What will be this objects name. 
 It doesn't seem to be same as my form name. I tried a few things and they 
 didn't work.

 I think in javascript, the client side DOM is accessed as 
 document.getElementbyID(...). Similarly, like the document object, what is 
 the name of the object that represents the entire html page and the object 
 that represents the form within in the server side ?

 Thanks in advance...
 --Bhaskar



-- 





Re: [web2py] Re: basics of DOM manipulation with web2py

2012-12-24 Thread Bhaskar Ramachandran
Thanks Alec,

I understand your point of why using helpers will be good. Since this 
is my first attempt at web2py, i didn't know that and already have a form 
that is coded directly in html with db statements spread into it here and 
there...
I can understand why the form object will not exist in memory when the user 
submits the form because there is no FORM object created in controller 
during execution. 

But what about the DOM objects like radio buttons, text area etc in the 
html ?. When the view file is processed and the response object is working 
on it to generate pure HTML , won't it create a DOM tree structure in 
memory. ?. If so, then at the point, before returning the html page to the 
user, i should be able to modify the DOM tree. But i don't know how to do 
this

Sorry if this is not making much sense ... But as I am learning web design, 
my knowledge is very rudimentary Thanks for your help..


On Monday, December 24, 2012 11:32:10 PM UTC-6, Alec Taylor wrote:

 Bhaskar: By using the web2py helpers you get a variety of security 
 protections including from: 
 - CSRF 
 - XSS 
 - Code injection 

 You can create custom form attributes that don't appear in your DB also. 

 As for the DOM stuff that you're talking about, listen to Anthony. 

 Also use JavaScript in order to not burden your server + give users' a 
 quicker, more responsive response 

 On Tue, Dec 25, 2012 at 4:18 PM, Bhaskar Ramachandran 
 rbh...@gmail.comjavascript: 
 wrote: 
  Bhaskar 


-- 





Re: [web2py] Re: web2py interactive shell in windows does not start the browser

2012-12-20 Thread Bhaskar Ramachandran
Thanks very much. This gives me a very good hold to understand web2py 
internals at my pace, understanding the internal workings step by step. 
Great!!.
Can someone explain the workflow in greater details than what is available 
in the web2py 4th edition (Chapter: THE CORE page 137). ?

One of you who have indepth understanding of the framework - if you could 
try to explain its internal process, Example of what i am looking for : 
What happens from the time someone makes a webpage request from the browser 
-- what objects are created in memory ... how the user inputs in forms are 
automatically processed by web2py,... how these objects are available to 
the user for modification through the controller code,... how the final 
response object is created and rendered as html back to the browser...

((For example, i was trying to set a break point in the view code 
layout.html, but this is never reached and i think this is because the view 
is not directly executed as it is html+python but some other web2py python 
code is text processing this view code and generating pure python code 
which then gets executed. This took quite some time and digging iinto 
the web2py book to figure out... Also , i am new to web development and 
don't have the correct basic instincts to yet know what to expect and what 
not :-))

I really want to understand more internal workings I am sure i will 
make use of the debugger and try to uncover these details one by one... But 
a documentation from the experts who created web2py would be of immense 
value to me and reduce my learning time 

I love web2py not just for its simplicity but more importantly for its 
wonderful support by people like you -- Thank you very much.

Regards,
Bhaskar



On Wednesday, December 19, 2012 10:18:44 PM UTC-6, rochacbruno wrote:

 FYK.

 I just tested the new WingIDE 4.1 with web2py for debugging and it is just 
 awesome!

 **maybe we can try to include this in the documentation

 Take a look at breakpoints, Stack data, debug probe and documentation on 
 the right panel!

 [image: Inline image 1]


-- 





[web2py] Re: Customizing auth login form but unable to set the form class name

2012-12-20 Thread Bhaskar Ramachandran
Hi Anthony,

   Your XML(form.custom..) command worked!!.* But simply writing the 
form statement in HTML did not .* I am customizing the auth.login() form 
here. In my default.py, i have dict(form=auth.login()) statement.
Now if i simply manually write a form in pure HTML in the view file, will 
web2py be able to map this form to the auth login form ?. Or do i need any 
form name to be specified ? This is the only form in my page.

Also, I am writing the form in the layout.html page and not index.html page 
because i want the login form to appear as part of my layout template 
itself for multiple pages so the user always sees the login form on top of 
the page until he decides to login. I assume writing this form in 
index.html or layout.html shouldn't make a difference.


On Wednesday, December 19, 2012 6:50:18 PM UTC-6, Anthony wrote:

 Sorry, I forgot this doesn't work with form.custom.begin, which is an XML 
 object rather than an HTML helper (because it includes only the opening 
 form tag). Instead, you could do this:

 {{=XML(form.custom.begin.replace('', ' class=myclass'))}}

 but it's probably more straightforward to just manually code the HTML:

 form action= enctype=multipart/form-data method=post class=
 myclass

 Anthony

 On Wednesday, December 19, 2012 6:38:42 PM UTC-5, Bhaskar Ramachandran 
 wrote:

 Hi Anthony,

   I tried that earlier also but that code didn't seem to work. I say so 
 because my html page still has that login form on the left side of the 
 navigation bar and looking at the source code, i see the following:
  form  action= enctype=multipart/form-data method=post
 No class is added.
 If I replace the custom form with a hard coded form with class name in 
 the form class=  then i am able to get the form in the right way.
 So, it looks like somehow those statements to set class name are 
 overridden by something else. I have these statements after the custom 
 begin and custom end block in my view file so this is the last thing that 
 is done to the form before it is rendered. 

 I tried both your statements below and both of them didn't do anything. 
 If you could also teach me how i can go and debug this situation, ( by 
 looking at the form object in real time if possible to see how it gets 
 modified during web2py execution on that page) it will help me in the long 
 run... 

 Thanks! 
 -Bhaskar


 On Wednesday, December 19, 2012 11:09:48 AM UTC-6, Anthony wrote:

 form['_class'] = 'myclass'

 or

 form.update(_class='myclass')

 A form is an HTML helper object, just like any other HTML helper, so the 
 usual rules apply: 
 http://web2py.com/books/default/chapter/29/05#HTML-helpers

 Anthony

 On Tuesday, December 18, 2012 11:33:32 PM UTC-5, Bhaskar Ramachandran 
 wrote:

 As listed in the view code below, i am trying to customize the form 
 returned by auth.login(). Note that i have in my controller return 
 dict(form=auth.login()). Then in the view code pasted below i am 
 customizing the login form.
 It seems to work fine except that i am unable to assign a class name to 
 this form. So my question is  How to set the class name for a form object 
 ?. There are posts in the mailing list to specify class name for elements 
 within the form object but i couldn't find one that explains how the class 
 name for the form object itself can be assinged. 
 Please let me know if my question needs more explanation. Thank you.
   {{
 if not auth.is_logged_in() :
   if not 'register' in auth.settings.
 actions_disabled:
form.add_button(T('Register'),URL(
 args='register'),_class='btn')
pass
if not 'request_reset_password' inauth
 .settings.actions_disabled:
  form.add_button(T('Lost Password'
 ),URL(args='request_reset_password'),_class='btn')
 pass 
  }}
 
 {{=form.custom.begin}}
a href=
 /myscienceapp/default/register?_next=/default/index style=margin-right: 
 10pxSign Up/a
   div class=input-append
  input id=user_username 
 class=input-small style=margin-right: 5px; border-radius: 5px 5px 5px 
 5px; type=text name=email placeholder=Email/
 input id=user_password class=input-smallstyle
 =margin-right: 2px; border-radius: 5px 5px 5px 5px; type=passwordname
 =password placeholder=Password/
   input class=btn btn-primary 
 style=margin-right: 
 5px; margin-bottom: 0px;border-radius: 5px 5px 5px 5px; size=5 type=
 submit name=commit value=Go! /
input id=user_remember_me 
 style=margin-right: 
 5px; margin-bottom: 16px; type=checkbox name=remember value=1 /
   label class=string optional 
 style=margin-right: 
 10px

[web2py] Re: Customizing auth login form but unable to set the form class name

2012-12-20 Thread Bhaskar Ramachandran
Great!. Thank you. Web2py is very much customizable!!.

Regards,
Bhaskar


On Thursday, December 20, 2012 10:55:29 PM UTC-6, Anthony wrote:

Your XML(form.custom..) command worked!!.* But simply writing the 
 form statement in HTML did not .* I am customizing the auth.login() form 
 here. In my default.py, i have dict(form=auth.login()) statement.

 Now if i simply manually write a form in pure HTML in the view file, will 
 web2py be able to map this form to the auth login form ?. Or do i need any 
 form name to be specified ? This is the only form in my page.


 I was only suggesting doing that first line manually, not the entire form. 
 When web2py serializes a form, it includes two hidden fields -- _formname 
 and _formkey, which are needed for processing. Those fields are included as 
 part of {{=form.custom.end}}, or you can insert them directly via 
 {{=form.hidden_fields()}}. The values of those fields are stored in 
 form.formname and form.formkey as well.

 Anthony


-- 





[web2py] Re: web2py interactive shell in windows does not start the browser

2012-12-19 Thread Bhaskar Ramachandran
Thanks Massimo. Again, i am so new to web development.  I learned from your 
web2py book that your framework goes through a series of actions and i am 
assuming it creates objects in memory and fills these objects with user 
data and then processes these objects according to the model, controller 
and view code written for that page request.

Is there a way of looking at the various web2py objects in memory at 
different instances of time for one http request ?. For example, when a 
user submits a login form from browser, it gets to web2py and then web2py 
sets up the enviroment (request, response, cache, session etc objects 
created in memory and populated with information contained in that post 
request from browser) . 
Now is the auth object created in memory with the user inputs of username 
and password  at this time ?. IF so, how can i see the contents of this 
objects at this time  before web2py proceeds further?.

Then web2py runs the model python code and then runs the controller. 
Finally the view. I could be changing the content of the objects, for 
example, the login form object anywhere in this chain - in model code, 
controller code or view code. Can i see how it is modified before it gets 
converted to html by the response object ?. And then can i see the final 
html code it generated at server side ?

Finally, when the html code from server reaches the client, the browser can 
show me the source code and i get to see what web2py has done. But i want 
to see the intermediate actions also

Regards,
Bhaskar


On Tuesday, December 18, 2012 11:20:02 PM UTC-6, Massimo Di Pierro wrote:

 You cannot do what you ask because it not logically possible. There is no 
 web2py global state. There is only a state per request for the duration of 
 an http request.

 When you open shell you are in a simulated http request which does not 
 require the server to be on. It is mostly used to programmatically interact 
 with the db.

 Imagine your web server being hit by many requests at the same time. How 
 would you select from the shell which one to interact with? Moreover each 
 request lasts ~5ms.

 Massimo



 On Tuesday, 18 December 2012 22:16:33 UTC-6, Bhaskar Ramachandran wrote:

 Thanks for the reply. But then how do i do interactive debug of the 
 web2py objects from the shell...?
 If I can either have the shell or the webserver running, but not both, 
 then what if i want to run my application and then access the web2py 
 objects in real time from the shell to know its state. ?
 By the way, what makes it more interesting to learn web2py is this 
 support from others  Thanks a lot.

 Regards,
 Bhaskar




 On Sunday, December 16, 2012 9:06:30 PM UTC-6, Massimo Di Pierro wrote:

 As you say -S appname starts the shell but not the web server. Without 
 -S it starts the web server.
 The reason is that you may want one without the other.


 On Sunday, 16 December 2012 14:38:53 UTC-6, Bhaskar Ramachandran wrote:

 I am new to web2py but very excited to learn and use it on a long term 
 from now. 
 I am having trouble starting an interactive shell (I am using Windows 7 
 OS and have installed python2.5 and pywin32 but not ipython as i don't 
 want 
 ipython shell). 
 I have the latest web2py source copied to C:\. 

 C:\web2pypython web2py.py -S welcome -M
 Sorry, -K only supported for python 2.6-2.7
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2012
 Version 2.3.1 (2012-12-14 15:24:12) stable
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(pg8000), IMAP(imaplib)
 WARNING:web2py:import IPython error; use default python shell
 Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit 
 (Intel)] on win32
 Type help, copyright, credits or license for more information.
 (InteractiveConsole)
 

 I get the shell but it does not start the browser. Even if i start the 
 browser and enter http://127.0.0.1:8000/welcome/default/index it 
 doesn't work.
 But if i try a non-interactive shell such as the following, i am able 
 to start the server and see the welcome page...

 C:\web2pypython web2py.py
 Sorry, -K only supported for python 2.6-2.7
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2012
 Version 2.3.1 (2012-12-14 15:24:12) stable
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(pg8000), IMAP(imaplib)
 --
 I get the pop up window to enter admin password and start the server 
 and everything works except an interactive shell...

 Please help.
 Thank you
 Bhaskar







-- 





[web2py] Re: Customizing auth login form but unable to set the form class name

2012-12-19 Thread Bhaskar Ramachandran
Hi Anthony,

  I tried that earlier also but that code didn't seem to work. I say so 
because my html page still has that login form on the left side of the 
navigation bar and looking at the source code, i see the following:
 form  action= enctype=multipart/form-data method=post
No class is added.
If I replace the custom form with a hard coded form with class name in the 
form class=  then i am able to get the form in the right way.
So, it looks like somehow those statements to set class name are overridden 
by something else. I have these statements after the custom begin and 
custom end block in my view file so this is the last thing that is done to 
the form before it is rendered. 

I tried both your statements below and both of them didn't do anything. If 
you could also teach me how i can go and debug this situation, ( by looking 
at the form object in real time if possible to see how it gets modified 
during web2py execution on that page) it will help me in the long run... 

Thanks! 
-Bhaskar


On Wednesday, December 19, 2012 11:09:48 AM UTC-6, Anthony wrote:

 form['_class'] = 'myclass'

 or

 form.update(_class='myclass')

 A form is an HTML helper object, just like any other HTML helper, so the 
 usual rules apply: 
 http://web2py.com/books/default/chapter/29/05#HTML-helpers

 Anthony

 On Tuesday, December 18, 2012 11:33:32 PM UTC-5, Bhaskar Ramachandran 
 wrote:

 As listed in the view code below, i am trying to customize the form 
 returned by auth.login(). Note that i have in my controller return 
 dict(form=auth.login()). Then in the view code pasted below i am 
 customizing the login form.
 It seems to work fine except that i am unable to assign a class name to 
 this form. So my question is  How to set the class name for a form object 
 ?. There are posts in the mailing list to specify class name for elements 
 within the form object but i couldn't find one that explains how the class 
 name for the form object itself can be assinged. 
 Please let me know if my question needs more explanation. Thank you.
   {{
 if not auth.is_logged_in() :
   if not 'register' in auth.settings.
 actions_disabled:
form.add_button(T('Register'),URL(args
 ='register'),_class='btn')
pass
if not 'request_reset_password' inauth
 .settings.actions_disabled:
  form.add_button(T('Lost Password'),
 URL(args='request_reset_password'),_class='btn')
 pass 
  }}
 
 {{=form.custom.begin}}
a href=
 /myscienceapp/default/register?_next=/default/index style=margin-right: 
 10pxSign Up/a
   div class=input-append
  input id=user_username 
 class=input-small style=margin-right: 5px; border-radius: 5px 5px 5px 
 5px; type=text name=email placeholder=Email/
 input id=user_password class=input-smallstyle
 =margin-right: 2px; border-radius: 5px 5px 5px 5px; type=passwordname
 =password placeholder=Password/
   input class=btn btn-primary 
 style=margin-right: 
 5px; margin-bottom: 0px;border-radius: 5px 5px 5px 5px; size=5 type=
 submit name=commit value=Go! /
input id=user_remember_me 
 style=margin-right: 
 5px; margin-bottom: 16px; type=checkbox name=remember value=1 /
   label class=string optional 
 style=margin-right: 
 10px; for=user_remember_meRemember me/label
   a href=/users/sign_up style=margin-right: 
 1pxForgot?/a 
  /div
  {{=form.custom.end}}
!--Using the command below,i am trying to set the class name for 
 the form.I was unable to do it both directly as well as using the parent() 
 method.. --
  {{form.element('div').parent['_class']='navbar-form pull-right 
 form-inline'}}
 
 {{pass}}
   



-- 





[web2py] Re: web2py interactive shell in windows does not start the browser

2012-12-18 Thread Bhaskar Ramachandran
Thanks for the reply. But then how do i do interactive debug of the web2py 
objects from the shell...?
If I can either have the shell or the webserver running, but not both, then 
what if i want to run my application and then access the web2py objects in 
real time from the shell to know its state. ?
By the way, what makes it more interesting to learn web2py is this support 
from others  Thanks a lot.

Regards,
Bhaskar




On Sunday, December 16, 2012 9:06:30 PM UTC-6, Massimo Di Pierro wrote:

 As you say -S appname starts the shell but not the web server. Without 
 -S it starts the web server.
 The reason is that you may want one without the other.


 On Sunday, 16 December 2012 14:38:53 UTC-6, Bhaskar Ramachandran wrote:

 I am new to web2py but very excited to learn and use it on a long term 
 from now. 
 I am having trouble starting an interactive shell (I am using Windows 7 
 OS and have installed python2.5 and pywin32 but not ipython as i don't want 
 ipython shell). 
 I have the latest web2py source copied to C:\. 

 C:\web2pypython web2py.py -S welcome -M
 Sorry, -K only supported for python 2.6-2.7
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2012
 Version 2.3.1 (2012-12-14 15:24:12) stable
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(pg8000), IMAP(imaplib)
 WARNING:web2py:import IPython error; use default python shell
 Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] 
 on win32
 Type help, copyright, credits or license for more information.
 (InteractiveConsole)
 

 I get the shell but it does not start the browser. Even if i start the 
 browser and enter http://127.0.0.1:8000/welcome/default/index it 
 doesn't work.
 But if i try a non-interactive shell such as the following, i am able to 
 start the server and see the welcome page...

 C:\web2pypython web2py.py
 Sorry, -K only supported for python 2.6-2.7
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2012
 Version 2.3.1 (2012-12-14 15:24:12) stable
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(pg8000), IMAP(imaplib)
 --
 I get the pop up window to enter admin password and start the server and 
 everything works except an interactive shell...

 Please help.
 Thank you
 Bhaskar







-- 





[web2py] Customizing auth login form but unable to set the form class name

2012-12-18 Thread Bhaskar Ramachandran
As listed in the view code below, i am trying to customize the form 
returned by auth.login(). Note that i have in my controller return 
dict(form=auth.login()). Then in the view code pasted below i am 
customizing the login form.
It seems to work fine except that i am unable to assign a class name to 
this form. So my question is  How to set the class name for a form object 
?. There are posts in the mailing list to specify class name for elements 
within the form object but i couldn't find one that explains how the class 
name for the form object itself can be assinged. 
Please let me know if my question needs more explanation. Thank you.
  {{
if not auth.is_logged_in() :
  if not 'register' in auth.settings.
actions_disabled:
   form.add_button(T('Register'),URL(args=
'register'),_class='btn')
   pass
   if not 'request_reset_password' in auth.
settings.actions_disabled:
 form.add_button(T('Lost Password'),URL(
args='request_reset_password'),_class='btn')
pass 
 }}

{{=form.custom.begin}}
   a href=
/myscienceapp/default/register?_next=/default/index style=margin-right: 
10pxSign Up/a
  div class=input-append
 input id=user_username class=input-small 
style=margin-right: 5px; border-radius: 5px 5px 5px 5px; type=text 
name=email placeholder=Email/
input id=user_password class=input-small 
style=margin-right: 
2px; border-radius: 5px 5px 5px 5px; type=password name=passwordplaceholder
=Password/
  input class=btn btn-primary 
style=margin-right: 
5px; margin-bottom: 0px;border-radius: 5px 5px 5px 5px; size=5 type=
submit name=commit value=Go! /
   input id=user_remember_me 
style=margin-right: 
5px; margin-bottom: 16px; type=checkbox name=remember value=1 /
  label class=string optional 
style=margin-right: 
10px; for=user_remember_meRemember me/label
  a href=/users/sign_up style=margin-right: 
1pxForgot?/a 

 /div
 {{=form.custom.end}}
   !--Using the command below,i am trying to set the class name for 
the form.I was unable to do it both directly as well as using the parent() 
method.. --
 {{form.element('div').parent['_class']='navbar-form pull-right 
form-inline'}}

{{pass}}
  

-- 





[web2py] web2py interactive shell in windows does not start the browser

2012-12-16 Thread Bhaskar Ramachandran
I am new to web2py but very excited to learn and use it on a long term from 
now. 
I am having trouble starting an interactive shell (I am using Windows 7 OS 
and have installed python2.5 and pywin32 but not ipython as i don't want 
ipython shell). 
I have the latest web2py source copied to C:\. 

C:\web2pypython web2py.py -S welcome -M
Sorry, -K only supported for python 2.6-2.7
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2012
Version 2.3.1 (2012-12-14 15:24:12) stable
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), IMAP(imaplib)
WARNING:web2py:import IPython error; use default python shell
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] 
on win32
Type help, copyright, credits or license for more information.
(InteractiveConsole)


I get the shell but it does not start the browser. Even if i start the 
browser and enter http://127.0.0.1:8000/welcome/default/index it 
doesn't work.
But if i try a non-interactive shell such as the following, i am able to 
start the server and see the welcome page...

C:\web2pypython web2py.py
Sorry, -K only supported for python 2.6-2.7
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2012
Version 2.3.1 (2012-12-14 15:24:12) stable
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), IMAP(imaplib)
--
I get the pop up window to enter admin password and start the server and 
everything works except an interactive shell...

Please help.
Thank you
Bhaskar





--