[web2py] Re: Online classes

2013-12-23 Thread Chun-Hung Chen
Hi,

This is awesome. Are these links added and updated on the website?

Massimo Di Pierro於 2013年12月3日星期二UTC+8下午2時34分18秒寫道:
>
> Hello everybody,
>
> As you know I teach a certification program about web development with 
> Python and I use web2py. 
> I posted my most recent classes online:
>
> https://vimeo.com/75499986
> https://vimeo.com/76047107
> https://vimeo.com/76608898
> https://vimeo.com/77179700
> https://vimeo.com/77654974
>
> It is about of 13 hours of web2py lessons and coding.
> Please join me in thanking the students who enrolled in the program and 
> supported these classes.
>
> Massimo
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: javascript in controller

2013-12-23 Thread Chun-Hung Chen
Special characters are automatically escaped in case of flaws. If you are 
100% sure, you could make the text unescaped. However, it just affects how 
it looks in the source code and not relevant to your execution results.

sonu kumar於 2013年12月21日星期六UTC+8上午6時56分34秒寫道:
>
> Hi,
>
> When I use below code in controller to show form. It works fine but when I 
> see html source of html page...it shows some charachters...which is shown 
> in red below. how to remove them?
>
> form=FORM(TABLE(TR('Select 
> protease:',SELECT(values,requires=IS_NOT_EMPTY("choose one 
> value"),_name='protease',_onchange="jQuery.post('%s',{'protease':jQuery(this).val()})"
>  
> % URL('mmp'))),
> TR('Enter sequence:',TEXTAREA(_name='fasta',_style = 
> 'font-family:Courier; width:550px;height:250px;')),
> 
> TR("",INPUT(_type="submit",_value="SUBMIT",_onclick='javascript:$.blockUI({message:
>  
> $("#domMessage") });'
>
> 
> Select protease:MMP2
> MMP3MMP8
> MMP9
> Enter fasta sequence: rows="10" style="font-family:Courier; width:550px;height:250px;">
> 
>  type="reset" value="Reset" />
> 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: forgot password not working anymore

2013-12-23 Thread Brian M
I recently experienced something like this as well. Are you trying to do 
the reset from localhost or remotely? When I experienced this I found that 
oddly while the forgotten password form would not work when connecting to 
localhost, if I connected from another computer it worked fine. From 
localhost it was if the forgotten password form wasn't even being processed 
at all (no error messages or anything). I was using an older version of 
web2py and upgrading to trunk seemed to get the password reset working 
again from localhost.  I thought it was just a fluke but now that someone 
else is mentioning it too, maybe it isn't? Bastiaan, what version are you 
using?

On Monday, December 23, 2013 9:27:22 PM UTC-6, Massimo Di Pierro wrote:
>
> Please open a ticket about this.
>
> On Monday, 23 December 2013 10:33:43 UTC-6, Bastiaan van der Veen wrote:
>>
>> I have a problem with forgot password. When I enter a username that does 
>> not exist, I get the red bar validator under the field saying "Invalid 
>> username", so that functions correct.
>> But when I enter a username that does exist, I get no validation error 
>> and the flash message says "Invalid username" and nothing happens. My 
>> username table is created by the auth.define_tables(username=True) function 
>> so it is correct.
>>
>> The forgot username function works properly and logging in etc. is all 
>> working.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to represent dynamic fields in table

2013-12-23 Thread Anthony
That's just Python. When the lambda's are called, they get the value of 
name from the scope in which they were defined, so all the lambdas will use 
the last value of name, which is the last month. Instead, you should pass 
in name as an argument to each lambda, which will put it in the scope of 
the lambda.

Anthony

On Monday, December 23, 2013 5:53:34 PM UTC-5, P T wrote:
>
> Thank you Anthony, that worked like a charm. Is this technique I should 
> learn in Python or Web2Py?
>
> PT
>
> On Monday, December 23, 2013 3:17:56 PM UTC-6, Anthony wrote:
>>
>> Try:
>>
>> lambda value, row, name=name: ...
>>
>> Anthony
>>
>> On Monday, December 23, 2013 11:38:08 AM UTC-5, P T wrote:
>>>
>>> I am using the following for "represent" fields in the table:
>>> *{Field(name, 'integer', default=0, represent = lambda value, row: 
>>> DIV(value 
>>> if value else '-',_class='month', _id=str(row.id) +'.'+name)) for name 
>>> in fields}
>>>
>>>
>>> The intention is to use jeditable for which I need a class and an id for 
>>> each td element. But, all the td elements in a row are getting the same 
>>> month (specifically last month in the list) in the id, e.g. each td element 
>>> id is 72.Dec_2014. I am expecting 72.Jan_2014, 72.Feb_2014, 
>>> 72.Mar_2014,..., 72.Dec_2014. How should do I modify definition of 
>>> represent? 
>>>  
>>>
>>> Here is complete definition of tables:
>>>
>>> fields=[] 
>>> for row in  db(db.months).select(): 
>>> fields.append(row.effort_month.strftime('%b_%Y'))
>>>
>>>
>>> db.define_table("monthly_projections", 
>>> Field('employee', 'reference auth_user', default=auth.
>>> user_id, writable=False), 
>>> Field('costcode', 'reference costcodes', notnull=True),
>>> *{Field(name, 'integer', default=0, represent = lambdavalue
>>> , row: DIV(value if value else '-',_class='month', _id=str(row.id) +'.'+
>>> name)) for name in fields}
>>> )
>>>
>>>
>>> Thanks for your help,
>>>
>>> PT 
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: forgot password not working anymore

2013-12-23 Thread Massimo Di Pierro
Please open a ticket about this.

On Monday, 23 December 2013 10:33:43 UTC-6, Bastiaan van der Veen wrote:
>
> I have a problem with forgot password. When I enter a username that does 
> not exist, I get the red bar validator under the field saying "Invalid 
> username", so that functions correct.
> But when I enter a username that does exist, I get no validation error and 
> the flash message says "Invalid username" and nothing happens. My username 
> table is created by the auth.define_tables(username=True) function so it is 
> correct.
>
> The forgot username function works properly and logging in etc. is all 
> working.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: trying to add a submit button to SQLFORM but it does nothing

2013-12-23 Thread Tim Richardson
This works:


grid_form = 
FORM(INPUT(_type="submit",_name="testsubmit",_value="testsubmit"),grid,INPUT(_type="submit",_name="testsubmit1",_value="testsubmit1",_class='btn'),
 )

That is, adding the submit button before the grid works (the second button 
still doesn't work)



On Tuesday, 24 December 2013 09:39:36 UTC+11, Tim Richardson wrote:
>
> def test_form():
> grid = SQLFORM.grid(db.person,
> links=[dict(header='field1',body=lambda row: INPUT
> (_type='text',value='123',_name='field1 %s ' % row.id))])
>
> grid_form = FORM(grid,INPUT(_type="submit",_name="testsubmit",_value=
> "testsubmit"))
>
> if grid_form.accepts(request,session):
> print "submit successful"   #never happens
>
> return dict(form=grid_form,simple_form=simple_form)
>
>
> In the grid_form, the submit button doesn't submit anything and 
> grid_form.accepts() is therefore never true.
> It works if I replace grid_form with a simple FORM (the example for FORM 
> in the book). 
>
> This is with trunk, on os x, python 2.7.6
>
> The HTML looks fine. I am using a simple view {{=form}}
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Help me understand how to create a search

2013-12-23 Thread Marco Mansilla
El Mon, 23 Dec 2013 13:08:20 -0800 (PST)
Keith Planer  escribió:

> I'm new to web2py, and Python. I created a database, and I want to
> create a page where I can return records from a table of people,
> using their first and last names as search terms. What I have so far
> is:
> 
> def patient_lookup():
> 
> #form = SQLFORM.grid(db.consumer, deletable = True)
> 
>form=SQLFORM.factory(
>  Field('Lname', requires=IS_IN_SET(consumer)),
>  Field('Fname', requires=IS_IN_SET(consumer)),
>  submit_button="Search")
> if form.accepts(request.vars, session):
> consumer=db.consumer(id).select()
> return dict(form=form)
> 
> 
> My error:
> 
> 
> Traceback (most recent call last):
>   File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line
> 217, in restricted File
> "C:/web2py_src/web2py/applications/facesheet/controllers/default.py",
> line 64, in  File
> "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 372, in
>  File
> "C:/web2py_src/web2py/applications/facesheet/controllers/default.py",
> line 38, in patient_lookup Field('Lname',
> requires=IS_IN_SET(consumer)), UnboundLocalError: local variable
> 'consumer' referenced before assignment
> 
> 
> 

Would you please show your model file?... it seems that consumer table
isn't created yet... is this right?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Wiki.auth 401 error

2013-12-23 Thread jimbo
Thanks again Alan, will play about with it over Xmas. I am running on 
Pythonanywhere.

As I said, the built in Wiki worked when I tried it several months ago.

Cheers! 

On Sunday, 22 December 2013 19:54:25 UTC, jimbo wrote:
>
> This used to work, activate the built in wiki, then register, log in and I 
> got the wiki available. Now when I try to make a new wiki I get 401 even 
> though it lets me log on.
>
> Tried today and I get a 401 error when app accesses 
> /default/index/_create/index
>
>
> Thanks, Jimmy
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Rendering 'raw' HTML for AngularJS with Web2py

2013-12-23 Thread António Ramos
Nice examples posted.
I just changed my view like the following

*{{response.files.append(URL('static','angular-1.2.2/angular.js'))}}*
*{{response.files.append(URL('static','controllers.js'))}}*
*{{extend 'layout.html'}}*

*
  
  
  
  [[x]]
  

  
**

This way i have both at the same time, web2py goodies and angular goodies.

Regards
António


2013/12/23 rppowell 

> There are several ways to overcome the syntax collision with handlebars:
> 1. Change web2py's delimiter syntax to something other than
> double-curly-braces.
> 2. Have custom web2py html-helpers
> 3. Change handlebars's delimiter syntax.
> 4a. Have separate files for the handlebars templates - ng-include.
> 4b. Have separate files for the handlebars templates - templateURL.
> 5. Avoid using expressions
>
> See the following:
>
> http://www.web2pyslices.com/slice/show/1894/web2py-and-angularjs-handlebars-delimiters
>
>
> On Tuesday, January 29, 2013 8:12:30 AM UTC-8, Dirk Krause wrote:
>>
>> Hi,
>>
>> I am trying to use web2py to manage a database and display the resulting
>> JSON in AngularJS.  To render an angular compatible view I need to pass raw
>> html in a view (for example the html needs to start with ''
>> and so forth). Of course I could place the files in the static folder, but
>> then I can't protect the files via @auth.requires_login() etc.
>>
>> What would be the best way to achieve that?
>>
>> Thank you,
>>   Dirk
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Integrated IDE does not color javascript code

2013-12-23 Thread paolo.vall...@gmail.com
Have you upgraded web2py?
I've just double checked with web2py 2.8.2 and it works well

 Paolo


2013/12/23 António Ramos 

> I dont see it working.
> What is the status of javascript coloring?
>
> Thank you
>
>
> 2013/10/18 paolo.vall...@gmail.com 
>
>> It should be fixed in trunk. Please have a try
>>
>> Paolo
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/CA2vixMUSZk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to represent dynamic fields in table

2013-12-23 Thread P T
Thank you Anthony, that worked like a charm. Is this technique I should 
learn in Python or Web2Py?

PT

On Monday, December 23, 2013 3:17:56 PM UTC-6, Anthony wrote:
>
> Try:
>
> lambda value, row, name=name: ...
>
> Anthony
>
> On Monday, December 23, 2013 11:38:08 AM UTC-5, P T wrote:
>>
>> I am using the following for "represent" fields in the table:
>> *{Field(name, 'integer', default=0, represent = lambda value, row: DIV(value 
>> if value else '-',_class='month', _id=str(row.id) +'.'+name)) for name 
>> infields
>> }
>>
>>
>> The intention is to use jeditable for which I need a class and an id for 
>> each td element. But, all the td elements in a row are getting the same 
>> month (specifically last month in the list) in the id, e.g. each td element 
>> id is 72.Dec_2014. I am expecting 72.Jan_2014, 72.Feb_2014, 
>> 72.Mar_2014,..., 72.Dec_2014. How should do I modify definition of 
>> represent? 
>>  
>>
>> Here is complete definition of tables:
>>
>> fields=[] 
>> for row in  db(db.months).select(): 
>> fields.append(row.effort_month.strftime('%b_%Y'))
>>
>>
>> db.define_table("monthly_projections", 
>> Field('employee', 'reference auth_user', default=auth.
>> user_id, writable=False), 
>> Field('costcode', 'reference costcodes', notnull=True),
>> *{Field(name, 'integer', default=0, represent = lambdavalue
>> , row: DIV(value if value else '-',_class='month', _id=str(row.id) +'.'+
>> name)) for name in fields}
>> )
>>
>>
>> Thanks for your help,
>>
>> PT 
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to run a web2py project from within PyCharm?

2013-12-23 Thread Avi A
run web2py.py. 

On Monday, December 23, 2013 11:05:22 PM UTC+2, Hoon Chung wrote:
>
> Hi, I just started to experiment with web2py by creating a blank project 
> in PyCharm. Can somebody tell me how to run it from within PyCharm? The 
> only documentation on web2py in PyCharm was to how create it but it doesn't 
> mention how to run the project. Thanks for your help in advance.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to run a web2py project from within PyCharm?

2013-12-23 Thread Tim Richardson
Do you have the professional or community edition of pycharm?

If if the professional version, you actually run the web2py server (using 
its built in webserver, rocket), not a particular application.

I open pycharm in the web2py directory, not the directory of my app. 
This means in the project tree you see all applications; just work with the 
one of interest. If you're using git you can still have separate repos per 
application. 

You can run web2py in debug mode; I have a preconfigured web2py run/debug 
configuration which pycharm added for me. 
It calls the script web2py.py in "single instance only" mode. When you run 
or debug, it starts web2py as if you ran the script yourself, but in debug 
mode it binds to the server allowing you to out breakpoints in controllers 
(pydev does this too). 
You use your browser to call the URL of interest (the web2py server gui has 
a convenient pages menu which lets you quickly go to the home page of your 
applications).

Clicking the debug icon again prompts you to close and restart the web2py 
server. 







On Tuesday, 24 December 2013 08:05:22 UTC+11, Hoon Chung wrote:
>
> Hi, I just started to experiment with web2py by creating a blank project 
> in PyCharm. Can somebody tell me how to run it from within PyCharm? The 
> only documentation on web2py in PyCharm was to how create it but it doesn't 
> mention how to run the project. Thanks for your help in advance.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Integrated IDE does not color javascript code

2013-12-23 Thread António Ramos
I dont see it working.
What is the status of javascript coloring?

Thank you


2013/10/18 paolo.vall...@gmail.com 

> It should be fixed in trunk. Please have a try
>
> Paolo
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] trying to add a submit button to SQLFORM but it does nothing

2013-12-23 Thread Tim Richardson
def test_form():
grid = SQLFORM.grid(db.person,
links=[dict(header='field1',body=lambda row: INPUT(
_type='text',value='123',_name='field1 %s ' % row.id))])

grid_form = FORM(grid,INPUT(_type="submit",_name="testsubmit",_value=
"testsubmit"))

if grid_form.accepts(request,session):
print "submit successful"   #never happens

return dict(form=grid_form,simple_form=simple_form)


In the grid_form, the submit button doesn't submit anything and 
grid_form.accepts() is therefore never true.
It works if I replace grid_form with a simple FORM (the example for FORM in 
the book). 

This is with trunk, on os x, python 2.7.6

The HTML looks fine. I am using a simple view {{=form}}




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Adding a user to a group if form.process().accepted

2013-12-23 Thread Avi A
Hi,
How do I add records to some auth tables after submitting a form?
I need something like that:
First case:
# creating a new group named as the new organization created with the form.
if form.process().accepted:
new_group = db.auth.settings.table_group.insert(role = 
form.vars.f_org_name ) #it renders  'some name' for example

(I'll get back to the second case if I won't succeed )
Thanks.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Postgres: what am i doing wrong ?

2013-12-23 Thread Niphlod
PS: there are a few helpers scripts in the scripts/ folder that can create 
models doing introspection, with some limits imposed on the complexity of 
the underlying existing data model.

extract_mysql_models.py
extract_oracle_models.py
extract_pgsql_models.py
extract_sqlite_models.py

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Postgres: what am i doing wrong ?

2013-12-23 Thread Niphlod
apart from replying to a 4 months old thread. 
auto_import just imports .table files that are in the databases/* folder, 
so anything created strictly by web2py, i.e. exactly as described in the 
link

http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define-tables

tl;dr : in web2py's DAL you MUST have a definition of every table you need 
to read/update/delete . DAL doesn't do any introspection about what tables 
are there yet in the database (i.e. created manually or with another 
framework)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Postgres: what am i doing wrong ?

2013-12-23 Thread Kirill Surnov
PS: I want to use DAL for work with many tables and 2 databases at least , 
which are created by another noWeb2Py application.

вторник, 24 декабря 2013 г., 1:32:18 UTC+4 пользователь Kirill Surnov 
написал:
>
> Just tried it with postgresql:
> there are some tables without web2py definition, and I dont see it!
> other tables created on web2py I see.
> trying in python shell from 2.7.4 + timestamp.2013.10.14.15.16.29
> db= DAL('postgresql://postgres:***@localhost/test',auto_import = True)
>
>
>
> вторник, 7 февраля 2012 г., 21:26:05 UTC+4 пользователь Anthony написал:
>>
>> Just tried it -> same results. 
>>> FYI, I'm only using the interactive python shell to illustrate the 
>>> problem I face I my app... 
>>>
>>
>> When you use the -M option to load your models, are you then still doing 
>> this in your shell session:
>>
>> >>> db = DAL('postgres://postgres:@localhost/courier')  
>>
>> If so, don't -- the db object will already be defined when your db.py 
>> file is executed, and the above will end up overwriting it (and therefore 
>> losing all of its table definitions from db.py). Just do:
>>
>> python web2py.py -S courier -M -N
>> >>> db.tables
>>
>> (Note the -N option -- that prevents cron from starting.)
>>
>> If you're using the DAL outside of a web2py app, then you'll still need 
>> to create model definitions (i.e., with db.define_table) in your code -- 
>> the DAL doesn't know what tables and fields are in your db unless you tell 
>> it by defining the models. However, if you have already defined the models 
>> in an app somewhere, you might be able to make use of auto_import: 
>> http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define-tables
>> .
>>
>> Anthony
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Postgres: what am i doing wrong ?

2013-12-23 Thread Kirill Surnov
Just tried it with postgresql:
there are some tables without web2py definition, and I dont see it!
other tables created on web2py I see.
trying in python shell from 2.7.4 + timestamp.2013.10.14.15.16.29
db= DAL('postgresql://postgres:***@localhost/test',auto_import = True)



вторник, 7 февраля 2012 г., 21:26:05 UTC+4 пользователь Anthony написал:
>
> Just tried it -> same results. 
>> FYI, I'm only using the interactive python shell to illustrate the 
>> problem I face I my app... 
>>
>
> When you use the -M option to load your models, are you then still doing 
> this in your shell session:
>
> >>> db = DAL('postgres://postgres:@localhost/courier')  
>
> If so, don't -- the db object will already be defined when your db.py file 
> is executed, and the above will end up overwriting it (and therefore losing 
> all of its table definitions from db.py). Just do:
>
> python web2py.py -S courier -M -N
> >>> db.tables
>
> (Note the -N option -- that prevents cron from starting.)
>
> If you're using the DAL outside of a web2py app, then you'll still need to 
> create model definitions (i.e., with db.define_table) in your code -- the 
> DAL doesn't know what tables and fields are in your db unless you tell it 
> by defining the models. However, if you have already defined the models in 
> an app somewhere, you might be able to make use of auto_import: 
> http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define-tables
> .
>
> Anthony
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] How to run a web2py project from within PyCharm?

2013-12-23 Thread Hoon Chung
Hi, I just started to experiment with web2py by creating a blank project in 
PyCharm. Can somebody tell me how to run it from within PyCharm? The only 
documentation on web2py in PyCharm was to how create it but it doesn't 
mention how to run the project. Thanks for your help in advance.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Help me understand how to create a search

2013-12-23 Thread Keith Planer
I'm new to web2py, and Python. I created a database, and I want to create a 
page where I can return records from a table of people, using their first 
and last names as search terms. What I have so far is:

def patient_lookup():

#form = SQLFORM.grid(db.consumer, deletable = True)

   form=SQLFORM.factory(
 Field('Lname', requires=IS_IN_SET(consumer)),
 Field('Fname', requires=IS_IN_SET(consumer)),
 submit_button="Search")
if form.accepts(request.vars, session):
consumer=db.consumer(id).select()
return dict(form=form)


My error:


Traceback (most recent call last):
  File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line 217, in 
restricted
  File "C:/web2py_src/web2py/applications/facesheet/controllers/default.py", 
line 64, in 
  File "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 372, in 

  File "C:/web2py_src/web2py/applications/facesheet/controllers/default.py", 
line 38, in patient_lookup
Field('Lname', requires=IS_IN_SET(consumer)),
UnboundLocalError: local variable 'consumer' referenced before assignment



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to represent dynamic fields in table

2013-12-23 Thread Anthony
Try:

lambda value, row, name=name: ...

Anthony

On Monday, December 23, 2013 11:38:08 AM UTC-5, P T wrote:
>
> I am using the following for "represent" fields in the table:
> *{Field(name, 'integer', default=0, represent = lambda value, row: DIV(value 
> if value else '-',_class='month', _id=str(row.id) +'.'+name)) for name 
> infields
> }
>
>
> The intention is to use jeditable for which I need a class and an id for 
> each td element. But, all the td elements in a row are getting the same 
> month (specifically last month in the list) in the id, e.g. each td element 
> id is 72.Dec_2014. I am expecting 72.Jan_2014, 72.Feb_2014, 
> 72.Mar_2014,..., 72.Dec_2014. How should do I modify definition of 
> represent? 
>  
>
> Here is complete definition of tables:
>
> fields=[] 
> for row in  db(db.months).select(): 
> fields.append(row.effort_month.strftime('%b_%Y'))
>
>
> db.define_table("monthly_projections", 
> Field('employee', 'reference auth_user', default=auth.
> user_id, writable=False), 
> Field('costcode', 'reference costcodes', notnull=True),
> *{Field(name, 'integer', default=0, represent = lambdavalue
> , row: DIV(value if value else '-',_class='month', _id=str(row.id) +'.'+
> name)) for name in fields}
> )
>
>
> Thanks for your help,
>
> PT 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] server slow down when face multiple requests

2013-12-23 Thread sonu kumar
@Paolo, I am using web2py Version 2.7.4
@viniciusban, I am not using sqlite



On Sunday, 22 December 2013 01:16:50 UTC-8, Paolo Valleri wrote:
>
> what web2py version are you using?
> have you already had a look here: 
> http://web2py.com/books/default/chapter/29/13/deployment-recipes#Efficiency-and-scalability?
>
> Paolo
> On Sunday, December 22, 2013 1:48:56 AM UTC+1, viniciusban wrote:
>>
>> If you're using sqlite or migrations are enabled, this can be a 
>> bottleneck. 
>>
>> On Fri, Dec 20, 2013 at 7:28 PM, sonu kumar 
>>  wrote: 
>> > Hi All, 
>> > I have built one application using web2py and running on Apache server 
>> on 
>> > unix environment. During testing of this application what I found is 
>> slowing 
>> > down of my application when two users from different computer request 
>> my 
>> > application or submit any job. 
>> > I have no idea why it is happening. Are there any changes need at 
>> Apache 
>> > server side for handling multiple request or at web2py side. 
>> > 
>> > Please let me know. 
>> > Thanks 
>> > 
>> > -- 
>> > Resources: 
>> > - http://web2py.com 
>> > - http://web2py.com/book (Documentation) 
>> > - http://github.com/web2py/web2py (Source code) 
>> > - https://code.google.com/p/web2py/issues/list (Report Issues) 
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "web2py-users" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> > email to web2py+un...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Trouble setting up database that chooses predefined options.

2013-12-23 Thread Cliff
Thanks Dave!

You have been very helpful. I should be able to find my way from here. 
Thanks again :)


On Friday, December 20, 2013 2:46:56 PM UTC-5, Dave S wrote:
>
>
> On Thursday, December 19, 2013 9:06:27 PM UTC-8, Cliff wrote:
>>
>> Hi Dave
>>
>> Thanks for the reply! That was somewhat the path I was on. I like the 
>> boolean idea. Where I am hung up now though is how I would list all the 
>> bowl games on a page then update picks, like how i mentioned before. Would 
>> I be able to use SQLFORM to do this? This is my database setup, i have kept 
>> it simple for now.
>>
>>
> As a start, you might look at Loic's answer he linked in to the other 
> thread.  Your database should be small enough that Anthony's concern won't 
> be a problem.
> <
> http://stackoverflow.com/questions/20697034/how-can-i-join-3-tables-and-output-a-the-all-three-together-joined-in-web2py/20698864#20698864
> >
>
> (I use SQLFORM in my current, but just for a simple table; the trickiest 
> thing I do is figuring out maxid so I can limit the range of the table.)
>  
>
>>
>> db.define_table('persons', Field('person'), Field('email'))
>> db.define_table('teams', Field('teamname'), Field('winner', 'boolean', 
>> default=False))
>> db.define_table('bowls', Field('name'), Field('team1', 'reference 
>> teams'),Field('team2', 'reference teams'), Field('gametime', 'date')) 
>> db.define_table('picks', Field('person', 'reference persons'), 
>> Field('pick', 'reference teams'))
>> db.persons.email.requires = IS_EMAIL()
>> db.picks.person.requires = IS_IN_DB(db, db.persons.id, '%(person)s')
>> db.bowls.team1.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')
>> db.bowls.team2.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')
>>
>> On Thursday, December 19, 2013 2:30:20 PM UTC-5, Cliff wrote:
>>>
>>> Hello.
>>>
>>> General question here. Me and some friends guess who is going to win 
>>> NCAAF bowl games so I thought I would try and make an app for it. So I 
>>> started off making a table for users, games, picks. 
>>>
>>> Users -> Person name | email
>>> bowls -> Bowl name | team 1 | team 2 | time | winner
>>> picks - > person (reference user) | pick (reference unsure) 
>>>
>>> What I would like to do is make a page with an arg for user where I can 
>>> enter their picks and it store it in a DB for that user. An example would 
>>> be Bowl game 1: Team 1 vs Team 2 then a drop down list or radio button to 
>>> select the team. Bowl game 2: team 1 vs team 2 drop down list to select the 
>>> team etc etc.. Then later be able to list what user is ahead by wins. What 
>>> I am getting caught up with is how to setup my databases. 
>>>
>>> If someone could point me in the right direction I would greatly 
>>> appreciate it. 
>>>
>>
>
> /dps
>
>  
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: splitting fields from one table across two functions/views

2013-12-23 Thread lucas
yes, i thought those lines did absolutely nothing, however, when the 
simplest most stripped down code doesn't work and you start adding code in 
the hope something will provide a solution.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Rendering 'raw' HTML for AngularJS with Web2py

2013-12-23 Thread rppowell
There are several ways to overcome the syntax collision with handlebars:
1. Change web2py's delimiter syntax to something other than 
double-curly-braces.
2. Have custom web2py html-helpers
3. Change handlebars's delimiter syntax.
4a. Have separate files for the handlebars templates - ng-include.
4b. Have separate files for the handlebars templates - templateURL.
5. Avoid using expressions

See the following:
http://www.web2pyslices.com/slice/show/1894/web2py-and-angularjs-handlebars-delimiters


On Tuesday, January 29, 2013 8:12:30 AM UTC-8, Dirk Krause wrote:
>
> Hi,
>
> I am trying to use web2py to manage a database and display the resulting 
> JSON in AngularJS.  To render an angular compatible view I need to pass raw 
> html in a view (for example the html needs to start with '' 
> and so forth). Of course I could place the files in the static folder, but 
> then I can't protect the files via @auth.requires_login() etc.
>
> What would be the best way to achieve that?
>
> Thank you,
>   Dirk
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Wiki.auth 401 error

2013-12-23 Thread Alan Etkin

>
> Hi Alan, it's 2.8.2
>

I think we need to see the source; I tried to reproduce it, but couldn't.

My system environment:
2.8.2-stable+timestamp.2013.12.20.15.08.47
(Running on Rocket 1.2.6, Python 2.7.3)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Request password reset not working

2013-12-23 Thread Bastiaan van der Veen
I have a auth table with usernames ( auth.define_tables(signature=True, 
username=True)) and my forgot password is not working anymore.
It's the standard function:
def user():
"""
exposes:
http:///[app]/default/user/login
http:///[app]/default/user/logout
http:///[app]/default/user/register
http:///[app]/default/user/profile
http:///[app]/default/user/retrieve_password
http:///[app]/default/user/change_password
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control
"""
return dict(form=auth())
 but i get 'Invalid Username' in the flash all the time, but no validation 
error! The username does exist. If i enter something else in the field, i 
get validation error.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] forgot password not working

2013-12-23 Thread Bastiaan van der Veen
I use usernames with my auth table, but the forgot password function 
stopped working. When I enter a username that does not exist, I get a 
validation error(the red bar under the field saying 'Invalid Username'). 
But when I enter a username that does exist, I get no validation error, but 
the flash is saying invalid username and nothing happens further.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] forgot password not working anymore

2013-12-23 Thread Bastiaan van der Veen
I have auth table with username and when I try forgot password the function 
fails. When I enter a non existing username, the validator says Invalid 
username. But when I enter a existing username the flash is shown with 
"Invalid username" but the field validates fine and the email is not being 
sent.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] forgot password not working anymore

2013-12-23 Thread Bastiaan van der Veen
I have a problem with forgot password. When I enter a username that does 
not exist, I get the red bar validator under the field saying "Invalid 
username", so that functions correct.
But when I enter a username that does exist, I get no validation error and 
the flash message says "Invalid username" and nothing happens. My username 
table is created by the auth.define_tables(username=True) function so it is 
correct.

The forgot username function works properly and logging in etc. is all 
working.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Problem w/ cpdb.py script

2013-12-23 Thread Alan Etkin

>
> Note that, when I tried to use the script to copy to a MySQL DB on 
> pythonanywhere, I got a 150 error, that it couldn't create an auth table, 
> and  this may be related to foreign keys as well.
>

Note that there is another issue about cpdb (actually about the DAL class 
constructor and the table creation order), check that this not the same.

https://code.google.com/p/web2py/issues/detail?id=1799&start=100

Some backends allow to disable constraint checks (i.e. postgresql), maybe 
you can try issuing a command to disable them with executesql before the 
inserts (editing the script)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: splitting fields from one table across two functions/views

2013-12-23 Thread Leonel Câmara
It should be clear that these 3 lines do absolutely nothing :)

sform.vars.mtn_introduction = sform.vars.mtn_introduction
sform.vars.mtn_body = sform.vars.mtn_body
sform.vars.mtn_closing = sform.vars.mtn_closing

These also don't do anything:

v.mtn_introduction = v.mtn_introduction
v.mtn_body = v.mtn_body
v.mtn_closing = v.mtn_closing

What I think you wanted to try is to declare the current values as the 
default for the fields in question before the SQLFORM call.

However, frankly this code needs refactoring as it's very hard to read as 
it is now.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Problem w/ cpdb.py script

2013-12-23 Thread Scott Hunter
Note that, when I tried to use the script to copy to a MySQL DB on 
pythonanywhere, I got a 150 error, that it couldn't create an auth table, 
and  this may be related to foreign keys as well.

- Scott

On Sunday, December 22, 2013 3:36:47 PM UTC-5, Scott Hunter wrote:
>
> I'm trying to use the cpdb.py script to copy one sqlite db to another.  It 
> makes the tables & exports the old data to its own satisfaction, but when 
> it tries to import the data, I get:
>
> EXCEPTION: could not make a copy of the database
> foreign key constraint failed
>
> I had run into a similar problem when I upgraded to the latest version of 
> web2py; the default settings for sqlite had changed, and I had to add a 
> IS_EMPTY_OR(IS_IN_DB(...)) requirement for my reference fields where I had 
> just been using the default requirement (
> https://groups.google.com/forum/#!topic/web2py/klspqXpha4E), which makes 
> me wonder if this is related.
>
> Whatever the cause, this sounds like a problem w/ the script or something 
> it relies on.
>
> - Scott
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py Jobs and meetups

2013-12-23 Thread P T
I am also interested in meet ups in Chicago area.

PT

On Wednesday, December 18, 2013 12:06:05 PM UTC-6, Michael Gheith wrote:
>
> I would love to attend any and all meet ups in Chicago.  web2py has been 
> my bread and butter ever since I learned it :)
>
> On Tuesday, December 17, 2013 2:06:48 PM UTC-6, Massimo Di Pierro wrote:
>>
>> I am interested in knowing who are the web2py developers in Illinois and 
>> in California (possibly around San Francisco) for possible meet ups.
>>
>> If you live near Chicago or near San Francisco, please email me.
>>
>> If you do not leave in one of these places but you would be interested in 
>> moving to the US for a web2py job, also let me know.
>>
>> Massimo
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] How to represent dynamic fields in table

2013-12-23 Thread P T
I am using the following for "represent" fields in the table:
*{Field(name, 'integer', default=0, represent = lambda value, row: DIV(value 
if value else '-',_class='month', _id=str(row.id) +'.'+name)) for name infields
}


The intention is to use jeditable for which I need a class and an id for 
each td element. But, all the td elements in a row are getting the same 
month (specifically last month in the list) in the id, e.g. each td element 
id is 72.Dec_2014. I am expecting 72.Jan_2014, 72.Feb_2014, 
72.Mar_2014,..., 72.Dec_2014. How should do I modify definition of 
represent? 
 

Here is complete definition of tables:

fields=[] 
for row in  db(db.months).select(): 
fields.append(row.effort_month.strftime('%b_%Y'))


db.define_table("monthly_projections", 
Field('employee', 'reference auth_user', default=auth.
user_id, writable=False), 
Field('costcode', 'reference costcodes', notnull=True),
*{Field(name, 'integer', default=0, represent = lambda value
, row: DIV(value if value else '-',_class='month', _id=str(row.id) +'.'+name
)) for name in fields}
)


Thanks for your help,

PT 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] import_from_csv_file (DAL) broken in 2.8.2?

2013-12-23 Thread David Manns
Using db.import_from_csv_file(...) to restore a complete database from a 
file created using db.export_to_csv_file(...) used to work.

With 2.8.2 the process (at least in the development environment - I haven't 
tried in production environment) loops forever.

The problem seems to be in gluon\dal.py at line 8414 (#if id_map ...)

   def import_from_csv_file(self, ifile, id_map=None, null='',
 unique='uuid', map_tablenames=None,
 ignore_missing_tables=False,
 *args, **kwargs):
#if id_map is None: id_map={}
id_offset = {} # only used if id_map is None

Uncommenting this line to initialize id_map seems to fix the problem ... 
don't know why it was commented out, perhaps this breaks some other case?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Password Transmitted in plain text

2013-12-23 Thread P T
It took a while, but I created a self-signed certificate, installed and 
configured Apache. Now, all the packets are transmitted as encrypted. 

Thanks for your help!

PT

On Tuesday, December 17, 2013 4:37:27 PM UTC-6, Jonathan Lundell wrote:
>
> On 17 Dec 2013, at 2:28 PM, P T > wrote:
>
> Thank you Leonel and Jonathan,
>
> But, thees lines require that I run a https server. Can we configure 
> Rocket server for https or should I deploy something like Apache?
>
>
> Rocket supports SSL if the ssl module is available on the system.
>
> You'll need a certificate. Depending on what you're doing with it, a 
> self-signed certificate might be adequate. Otherwise you can get a free 
> single-host certificate from someone like: http://www.startssl.com/?app=40
>
>
>
> Thanks for the help,
> PT
>
>
>
> On Tuesday, December 17, 2013 4:11:57 PM UTC-6, Leonel Câmara wrote:
>>
>> Of course they are. Use HTTPS if you don't want that to happen.
>>
>> request.requires_https()
>>
>> and
>>
>> session.secure()
>>
>> Are your friends.
>>
>> Terça-feira, 17 de Dezembro de 2013 22:08:34 UTC, P T escreveu:
>>>
>>> I deployed a small app on the intranet and noticed that the username and 
>>> password are transmitted in plain text (using a tool WireShark, 
>>> http://www.wireshark.org/).
>>>
>>> Here is my setup: 
>>> 2.8.2-stable+timestamp.2013.11.28.13.54.07
>>> (Running on Rocket 1.2.6, Python 2.7.6) 
>>> Database: Postgresql
>>>
>>> So, I checked the model and noticed that my auth did not include 
>>> hmac_key. So, I changed that to
>>>
>>> auth = Auth(db, hmac_key=Auth.get_or_create_key()) 
>>>
>>> But, this did not help either.
>>>
>>> What should I do to make sure that user's passwords are transmitted as 
>>> encrypted? 
>>>
>>> Thanks,
>>> PT
>>>
>>
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Online classes

2013-12-23 Thread weheh
Wonderful, wonderful.

On Tuesday, December 3, 2013 2:34:18 PM UTC+8, Massimo Di Pierro wrote:
>
> Hello everybody,
>
> As you know I teach a certification program about web development with 
> Python and I use web2py. 
> I posted my most recent classes online:
>
> https://vimeo.com/75499986
> https://vimeo.com/76047107
> https://vimeo.com/76608898
> https://vimeo.com/77179700
> https://vimeo.com/77654974
>
> It is about of 13 hours of web2py lessons and coding.
> Please join me in thanking the students who enrolled in the program and 
> supported these classes.
>
> Massimo
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Can't pickle instancemethod objects -- web2py [Closed]

2013-12-23 Thread weheh
Phew, finally figured it out. session.myvar was getting assigned a default 
value from a db field, so couldn't be pickled.

On Monday, December 23, 2013 8:54:32 PM UTC+8, weheh wrote:
>
> I have more details. As stated before, I erased all sessions. That didn't 
> fix the problem.
>
> I then did a session.forget() from within my main routine. That got past 
> the pickle problem temporarily, but created a lot of other problems. After 
> that, I removed the session.forget() operation from the main routine and 
> things got back to normal. BUT only for my session.
>
> If I open another session in a different browser. I'm back to square one 
> with that browser session. Same TypeError: can't pickle instancemethod 
> objects. If I go through the session.forget() and then remove 
> session.forget() procedure again, it starts to work in the new browser 
> session.
>
> But it seems to be a one shot deal with each new session. I don't see that 
> it's tenable to go through this every time someone first surfs to the site.
>
> On Monday, December 23, 2013 7:33:56 PM UTC+8, weheh wrote:
>>
>> Yes, I already did that. It didn't fix it.
>>
>> On Monday, December 23, 2013 6:38:57 PM UTC+8, Leonel Câmara wrote:
>>>
>>> Delete all session files.  
>>>   
>>> I have also found that in windows boxes running apache + mod_wsgi, you 
>>> will constantly run into session errors if you're running more than one 
>>> web2py instalation as WSGIDaemonProcess doesn't work on windows so you 
>>> can't have a dedicated wsgi process for each of them.
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: dropdown menu repopulate from database

2013-12-23 Thread Anthony
If you want the dropdown list to be updated without a page refresh, you'll 
have to make an Ajax call to retrieve the updated list and replace the HTML 
inside the UL with the new list.

Anthony

On Thursday, December 19, 2013 7:16:08 AM UTC-5, Yebach wrote:
>
> Hello
>
> I have the following question
>
> On my page I have a drop down menu where user selects some texts from db 
> and it is then inserted into into ace editor. the user then saves the 
> script using bootstrap modal with a new name.
>
> After he enters the new name of the text it is saved, but the drop down 
> menu list is not updated.
>
> here is my code
>
> this populates drop down 
>
>  aria-labelledby="dropdownMenu1">
> {{for item in skripte:}}
>  href="#">{{=item}}
> {{pass}}
>   
>
>
> my controler/editor.py  for editor.html is 
>
> def editor():
> uid =  auth.user_id
> #print uid
> record = db((db.script.sc_user == db.auth_user.id) & 
> (db.script.sc_user == uid)).select(db.script.sc_name)
> #print record
> skripte = []
> for rec in record:
> skripte.append(rec.sc_name)
> 
> form=SQLFORM.factory(db.script.sc_name)
> 
> return dict(skripte = skripte, form = form)
>
> thank you
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: login crash under 2.8.2

2013-12-23 Thread LightDot
Apache and mod_wsgi under CentOS 6.x (or any other RHEL derivative, like 
Scientific Linux) tick like a clock. We us this combo for web2py almost 
everywhere.

Are you using mod_wsgi as a deamon? Have you set up different process 
groups, users etc. for different virtual hosts? You could post the relevant 
parts of your virtualhost configs if you wish.

Regards

On Monday, December 23, 2013 2:23:04 PM UTC+1, lucas wrote:
>
> oh yeah, i forgot to mention.  i am running multiple domain names and i am 
> using VirtualHost under apache to redirect to the proper web2py 
> application.  could that be the problem?  i am using the session as files, 
> i like that better then the DB option because, well, i just like it because 
> it is more direct from a developer point of view to just access the file 
> directly if need be.  wouldn't it be faster also?
>
> anyway, i didn't understand all of that business with the __getstate__ and 
> such.  that is way deep for me without knowing much more about the inner 
> workings of python.  not that i am adverse to learning them, i am just not 
> that intimate with python yet.  so i will have a learning curve with this 
> bug and thread.
>
> On Monday, December 23, 2013 8:00:16 AM UTC-5, Leonel Câmara wrote:
>>
>> No it's not wrong to use apache and wsgi, although there are better 
>> options if you use Linux, in my experience there's only a problem if you're 
>> running it on ms windows and you have more than one web2py instance as they 
>> share the same embedded mod_wsgi.
>>
>
> does apache under centos do such a thing?  run multiple web2py instances 
> while sharing the same mod_wsgi? 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Detecting MYSQL running status

2013-12-23 Thread Raj Chinna
Paolo,

Thanks for the response. 

I just put 404 for as an example, I am may end up showing a page which asks 
the end user to contact the System Admin to fix the issue. What am doing is 
an webapp for a enterprise task. So, I may show few details about the issue.

On Thursday, December 19, 2013 7:47:00 PM UTC+5:30, Paolo Valleri wrote:
>
> I've the same problem, I don't think DAL has this kind of ability but I 
> leave the word to others in such cases.
> Are you interested in showing the 404 page for all tickets or only for 
> those the involve the db connection?
>
> Paolo
> On Thursday, December 19, 2013 7:35:24 AM UTC+1, Raj Chinna wrote:
>>
>> Hi,
>>
>> I have web2py application which talks with MYSQL and i have my db 
>> connection strings in db.py module. Sometime the web2py server is running 
>> without any issues, but mysql goes offline now and then. So, I am getting 
>> the ticket generated saying that *"Failure to connect, tried 5 times: 
>> Traceback (most recent call last): ".*
>>
>> All I wanted to do is to check if this error comes out (that's mysql is 
>> not running) I need to redirect the user to something like 404/database 
>> error page. Can someone tell me where and how can I detect this database 
>> connectivity failure and show some meaningful error message. 
>>
>> Thanks, 
>> Raj Chinna
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: bulk_upload to GAE development datastore no longer works?

2013-12-23 Thread David Manns
Here is the solution. The trick that is not well documented relates to how 
the new GAE SDK opens service ports.

After starting the application using the launcher the GAE SDK log shows:

2013-12-23 08:32:28 Running command: "['C:\\Python27\\pythonw.exe', 
'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', 
'--skip_sdk_update_check=yes', '--port=12080', '--admin_port=8004', 
'--datastore_path=C:\\Users\\David\\Google Drive\\ocsnedb backups and test 
data\\ocsnedb.dat', 'C:\\Users\\David\\Google Drive\\My 
Documents\\ocsnedb31']"
INFO 2013-12-23 08:32:30,825 devappserver2.py:660] Skipping SDK update 
check.
INFO 2013-12-23 08:32:30,871 api_server.py:138] Starting API server at: 
http://localhost:52945
INFO 2013-12-23 08:32:30,871 dispatcher.py:171] Starting module 
"default" running at: http://localhost:12080
INFO 2013-12-23 08:32:30,871 admin_server.py:117] Starting admin server 
at: http://localhost:8004

Note that in this case the API server is opened on port 52945. It appears 
that each time the SDK is started, a different port number is allocated. 
This port number must be used in the upload command:

appcfg.py upload_data --num_threads=1 --url=http://localhost:/_ah/remote_api --filename=

When appcfg prompts for the email address, hit Enter. It does not prompt 
for a password.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: splitting fields from one table across two functions/views

2013-12-23 Thread lucas
so let me explain the above code a little.  two views, two worksheets, via 
controller functions worksheet0 and worksheet0a.  if you go into 
worksheet0a and modify the data any of the three text fields, the data is 
stored fine in the DB after you press the SUBMIT which displays "Save 
Worksheet and Return to Main".  if you go into the main worksheet, 
worksheet0, and modify or not its field data, and press any of the three 
SUBMIT buttons, the data from the worksheet0a is wiped from the DB.  those 
three fields are mtn_introduction, mtn_body, and mtn_closing.  ok.  i hope 
the code reveals the problem in my approach.  thanx in advance and have a 
great day.  lucas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: splitting fields from one table across two functions/views

2013-12-23 Thread lucas
ok, here is the snippets of code:

@auth.requires_login()
def worksheet0():
chkSession()
msg = ""
cidi = args_to_int(0) #case id
tCase = db.cases
tSheet = db.case_worksheets
sCase = db(tCase.id==cidi).select().first()
now = datetime.datetime.utcnow()
if not sCase or (now > (sCase.modified_date + 
datetime.timedelta(days=7))): #prompt to update case information every 90 
days
redirect(URL(f="case", args=[cidi]))
sidi = args_to_int(1) #sheet id
aidi = args_to_int(2) #action id
if sidi:
""" commented for now; tried to leave out the 3 text fields but it 
didn't make a difference
uflds = []
flds = tSheet.fields
for f in flds:
if (f[:4] <> 'mtn_'):
uflds.append(f)
#return '%s' % uflds
"""
sform = SQLFORM(tSheet, record=sidi, buttons=[INPUT(_type='submit', 
_name='submit', _value='Save Worksheet', _style="width:410px;"), 
INPUT(_type='submit', _name='mtn_modify', _value='Save Worksheet and View 
Motion to Modify', _style="width:410px;"), INPUT(_type='submit', 
_name='summary', _value='Save Worksheet and View Analysis Summary', 
_style="width:410px;")])
sform.vars.case_id = sCase.id
#tried to include the 3 fields in the form to ensure the data won't 
get lost, but it still does
sform.vars.mtn_introduction = sform.vars.mtn_introduction
sform.vars.mtn_body = sform.vars.mtn_body
sform.vars.mtn_closing = sform.vars.mtn_closing
setstyles(sform, 700, "Save Worksheet")
if sform.process(onvalidation=chk_worksheet0).accepted:
if sform.vars.submit:
response.flash = "Worksheet Information Updated"
elif sform.vars.mtn_modify:
sidi = sform.vars.id #makes sure an appended record id gets 
to the summary
session.flash = "Worksheet Information Saved & Updated"
redirect(URL(f="worksheet0a", args=[sCase.id,sidi]))
elif sform.vars.summary:
sidi = sform.vars.id #makes sure an appended record id gets 
to the summary
session.flash = "Worksheet Information Saved & Updated"
redirect(URL(f="summary", args=[sCase.id,sidi]))
elif sform.errors:
response.flash = "Worksheet Errors"
try:
if sform:
pass
except:
sform = ""
slist = db(tSheet.case_id==cidi).select(orderby=~tSheet.input_date)
return dict(sCase=sCase, slist=slist, sform=sform, msg=msg)

def chk_worksheet0(f):
v = f.vars
v.sheet_name = v.sheet_name[:32]
v.sheet_notes = v.sheet_notes[:256]
#tried to make sure the three fields were included in the verification 
just to ensure the data doesn't get lost, but it still does
v.mtn_introduction = v.mtn_introduction
v.mtn_body = v.mtn_body
v.mtn_closing = v.mtn_closing
return f

@auth.requires_login()
def worksheet0a():
chkSession()
cidi = args_to_int(0) #case id
sidi = args_to_int(1) #sheet id
if cidi and sidi:
tCase = db.cases
tSheet = db.case_worksheets
sCase = db(tCase.id==cidi).select().first()
sSheet = db(tSheet.id==sidi).select().first()
sform = SQLFORM(tSheet, record=sidi, 
fields=['id','mtn_introduction','mtn_body','mtn_closing'], formstyle="divs")
setstyles(sform, 700, "Save Worksheet and Return to Main")
if sform.process().accepted:
session.flash = "Motion to Modify Updated"
redirect(URL(f="worksheet0", args=[sCase.id,sSheet.id]))
elif sform.errors:
response.flash = "Worksheet Errors"
return dict(sCase=sCase, sSheet=sSheet, sform=sform)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: login crash under 2.8.2

2013-12-23 Thread lucas
oh yeah, i forgot to mention.  i am running multiple domain names and i am 
using VirtualHost under apache to redirect to the proper web2py 
application.  could that be the problem?  i am using the session as files, 
i like that better then the DB option because, well, i just like it because 
it is more direct from a developer point of view to just access the file 
directly if need be.  wouldn't it be faster also?

anyway, i didn't understand all of that business with the __getstate__ and 
such.  that is way deep for me without knowing much more about the inner 
workings of python.  not that i am adverse to learning them, i am just not 
that intimate with python yet.  so i will have a learning curve with this 
bug and thread.

On Monday, December 23, 2013 8:00:16 AM UTC-5, Leonel Câmara wrote:
>
> No it's not wrong to use apache and wsgi, although there are better 
> options if you use Linux, in my experience there's only a problem if you're 
> running it on ms windows and you have more than one web2py instance as they 
> share the same embedded mod_wsgi.
>

does apache under centos do such a thing?  run multiple web2py instances 
while sharing the same mod_wsgi? 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: login crash under 2.8.2

2013-12-23 Thread Leonel Câmara
No it's not wrong to use apache and wsgi, although there are better options 
if you use Linux, in my experience there's only a problem if you're running 
it on ms windows and you have more than one web2py instance as they share 
the same embedded mod_wsgi.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: login crash under 2.8.2

2013-12-23 Thread lucas
sorry i dropped off the map for a while.  my server had a hard hardware 
crash and i have been managing its replacement.  i think the processor or 
motherboard went bad because the memory and HD are testing out ok.  i 
actually decided to goto amazon's EC2 and i am using centos 6,4 under that. 
 it is super fast.  i went back to web2py 2.4.6 and got my apps running 
again.  i ordered an NAS to use as my fileserver in my home and replace 
that section of the server that crashed.

the good thing about the EC2 is that i can copy my OS instance to another, 
then upgrade web2py and then test it separately without bringing down my 
main OS and site. so once i get my other bug fixed in the other thread, 
then i can work on this upgrade problem more.

is it really wrong or unstable to have web2py work under apache and 
mod_wsgi?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Help! Can't pickle instancemethod objects -- web2py FAIL!

2013-12-23 Thread weheh
I have more details. As stated before, I erased all sessions. That didn't 
fix the problem.

I then did a session.forget() from within my main routine. That got past 
the pickle problem temporarily, but created a lot of other problems. After 
that, I removed the session.forget() operation from the main routine and 
things got back to normal. BUT only for my session.

If I open another session in a different browser. I'm back to square one 
with that browser session. Same TypeError: can't pickle instancemethod 
objects. If I go through the session.forget() and then remove 
session.forget() procedure again, it starts to work in the new browser 
session.

But it seems to be a one shot deal with each new session. I don't see that 
it's tenable to go through this every time someone first surfs to the site.

On Monday, December 23, 2013 7:33:56 PM UTC+8, weheh wrote:
>
> Yes, I already did that. It didn't fix it.
>
> On Monday, December 23, 2013 6:38:57 PM UTC+8, Leonel Câmara wrote:
>>
>> Delete all session files.  
>>   
>> I have also found that in windows boxes running apache + mod_wsgi, you 
>> will constantly run into session errors if you're running more than one 
>> web2py instalation as WSGIDaemonProcess doesn't work on windows so you 
>> can't have a dedicated wsgi process for each of them.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Help! Can't pickle instancemethod objects -- web2py FAIL!

2013-12-23 Thread weheh
Yes, I already did that. 

On Monday, December 23, 2013 6:38:57 PM UTC+8, Leonel Câmara wrote:
>
> Delete all session files.  
>   
> I have also found that in windows boxes running apache + mod_wsgi, you 
> will constantly run into session errors if you're running more than one 
> web2py instalation as WSGIDaemonProcess doesn't work on windows so you 
> can't have a dedicated wsgi process for each of them.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Social Login - Twitter logs out plus some other issues- web2py 2.8.2 / Mac OS X 10.9.1

2013-12-23 Thread Leonel Câmara
I wouldn't bother, you shouldn't be using twitter login if you want to 
merge on email accounts as twitter does not provide you with the user's 
email.
  
So, you have conflicting requisites, you want to merge social logins based 
on email and you want to have twitter login.  
  
It's possible, you can always ask the user for his email, but if you're 
going to all that trouble just make him register.  
  
Clients need to be made aware that using twitter to login for websites is 
mostly stupid unless your website is actually based around interacting with 
twitter as most websites end up needing the user's email address anyway.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Help! Can't pickle instancemethod objects -- web2py FAIL!

2013-12-23 Thread Leonel Câmara
Delete all session files.  
  
I have also found that in windows boxes running apache + mod_wsgi, you will 
constantly run into session errors if you're running more than one web2py 
instalation as WSGIDaemonProcess doesn't work on windows so you can't have 
a dedicated wsgi process for each of them.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Can't pickle instancemethod objects -- web2py FAIL!

2013-12-23 Thread weheh
Was doing a db migration and ran into this nasty:

Traceback (most recent call last):

  File "C:\web2py\gluon\main.py", line 576, in wsgibase
session._try_store_in_cookie_or_file(request, response)
  File "C:\web2py\gluon\globals.py", line 749, in _try_store_in_cookie_or_file
self._try_store_in_file(request, response)
  File "C:\web2py\gluon\globals.py", line 755, in _try_store_in_file
if not response.session_id or self._forget or self._unchanged():
  File "C:\web2py\gluon\globals.py", line 711, in _unchanged
session_pickled = cPickle.dumps(dict(self))
  File "c:\Program Files (x86)\Python25\lib\copy_reg.py", line 69, in _reduce_ex
raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle instancemethod objects

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.