[web2py] $.web2py.ajax_page and response.flash / response.js

2013-09-19 Thread Kurt Grutzmacher
Changeset a51d0877979c0846b420bee31102d162030f79ca in gluon/main.py now
checks for response.ajax being true before adding response headers for
web2py-component-flash and web2py-component-command. Unfortunately calls
manually utilizing web2py_ajax_page( ... ) are not being seen as ajax
because jQuery does not send the X-Requested-With header.

For instance in the I have this this:

var data = article= + checks;
url = {{=URL('hosts', 'delete.json', user_signature=True)}}
$.web2py.ajax_page( 'POST', url, data );

If I look at the request headers being send, X-Requested-With is not
set. Ajax calls that are set up by web2py functions such as LOAD(..,
ajax=True) seem to be ok.

This is acting like jQuery believes I'm sending a cross-domain ajax,
which would should not send the header.

A work-around can be done by setting both the response.flash/response.js
entries as well as the corresponding header entries but that seems
counterintuitive since main.py/wsgibase should be setting these accordingly.

-- 
- grutz;

-- 
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.ajax_page and response.flash / response.js

2013-09-19 Thread Niphlod
I'm missing a point . the only reliable way to detect a request cming 
from ajax is indeed the presence of the x-requested-with header . are 
you saying that you can replicate consistently a behaviour where jquery 
doesn't add the x-requested-with header ?

Il giorno giovedì 19 settembre 2013 08:05:46 UTC+2, Kurt Grutzmacher ha 
scritto:

 Changeset a51d0877979c0846b420bee31102d162030f79ca in gluon/main.py now 
 checks for response.ajax being true before adding response headers for 
 web2py-component-flash and web2py-component-command. Unfortunately calls 
 manually utilizing web2py_ajax_page( ... ) are not being seen as ajax 
 because jQuery does not send the X-Requested-With header. 

 For instance in the I have this this: 

 var data = article= + checks; 
 url = {{=URL('hosts', 'delete.json', user_signature=True)}} 
 $.web2py.ajax_page( 'POST', url, data ); 

 If I look at the request headers being send, X-Requested-With is not 
 set. Ajax calls that are set up by web2py functions such as LOAD(.., 
 ajax=True) seem to be ok. 

 This is acting like jQuery believes I'm sending a cross-domain ajax, 
 which would should not send the header. 

 A work-around can be done by setting both the response.flash/response.js 
 entries as well as the corresponding header entries but that seems 
 counterintuitive since main.py/wsgibase should be setting these 
 accordingly. 

 -- 
 - grutz; 


-- 
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: Where do console messages go when in nginx?

2013-09-19 Thread Niphlod
ok. please define error messages then ^_^

Il giorno giovedì 19 settembre 2013 05:03:06 UTC+2, viniciusban ha scritto:

 I don't have print in my code. 

 How error messages could be redirected to uwsgi log? 
 Or to web2py/applications/myapp/logs? 

 On Wed, Sep 18, 2013 at 7:30 PM, Niphlod nip...@gmail.com javascript: 
 wrote: 
  it depends. the might be redirected to the uwsgi log but really, remove 
 ANY 
  print statement from your code and start using the logging module. it's 
  fairly easy and you can track exactly where things get saved playing 
 with 
  logging.conf 
  
  
  On Wednesday, September 18, 2013 7:26:20 PM UTC+2, viniciusban wrote: 
  
  Hi guys, I'm with a problem again using web2py with nginx. 
  
  When I run the dev server (with rocket), I see error messages in 
 console. 
  
  But when I'm running nginx, where do these messages go to? 
  
  -- 
  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 javascript:. 
  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: Editing menu.py giving errors

2013-09-19 Thread Niphlod
missing a parenthesis 
(SPAN('Services', _class='highlighted'), False, URL('services'*)*, [



Il giorno giovedì 19 settembre 2013 01:19:34 UTC+2, HittingSmoke ha scritto:

 I'm trying to set up my basic layout before development of my first real 
 app after tinkering around with web2py for quite a while. I'm basing the 
 first version on the welcome scaffolding but I'm getting an error when 
 trying to edit the menu.

 Here is my menu code:

 response.menu = [
 (T('Home'), False, URL('default', 'index'), []),
 (T('About'), False, URL('default', 'about'), []),
 (SPAN('Services', _class='highlighted'), False, URL('services', [
 (T('Forum'), False, URL('services', 'forum')),
 (T('Blog'), False, URL('services', 'blog')),
 (T('News'), False, URL('services', 'cms')),
 (T('Wiki'), False, URL('services', 'wiki')),
 (T('Other'), False, URL('services', 'other')),
 ]
 ))
 ]

 I'm getting the the error: 
 type 'exceptions.SyntaxError' when calling URL, function or function 
 name required

 Traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.

 Traceback (most recent call last):
   File /home/hittingsmoke/web2py/gluon/restricted.py, line 217, in 
 restricted
 exec ccode in environment
   File 
 /home/hittingsmoke/web2py/applications/Community_Deployment/models/menu.py 
 https://communitydeployment.com/admin/edit/Community_Deployment/models/menu.py,
  line 34, in module
 (T('Other'), False, URL('services', 'other')),
   File /home/hittingsmoke/web2py/gluon/html.py, line 280, in URL
 'when calling URL, function or function name required')
 Syntax



 Line 34 is the wiki menu entry.


-- 
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] References and Virtual Fields do not play nice together.

2013-09-19 Thread hiro
I have trouble in my application as well in some cases. I solved it for now 
by switching to the old style of virtual fileds

On Wednesday, September 18, 2013 1:44:56 PM UTC+2, Marin Pranjić wrote:

 I get this error ONLY with appadmin.
 It's not because of references.

 For now you can use:
 lambda row: row.entity.get('slogan', '')+' is the best slogan ever'

 Marin


 On Wed, Sep 18, 2013 at 1:08 PM, hiro hir...@gmail.com javascript:wrote:

 Is this a bug, a limitation or by design?

 I create a new welcome application and add the following tables and 
 fields:

 db.define_table('entity',
 Field('entity_name', 'string'),
 Field('slogan', 'string'),
 )

 db.entity.slogan2 =  Field.Virtual(lambda row: row.entity.slogan+' is the 
 best slogan ever')

 db.define_table('customer',
 Field('entity_id', 'reference entity'),
 Field('name','string')
 )
 db.customer.entity_id.requires=IS_IN_DB(db, 'entity.id', 
 '%(entity_name)s',zero=T('choose one'))

 I am now unable to add customers using appadmin. Trying at create the 
 crud form for inserting a customer generates the following error:

 type 'exceptions.AttributeError'('Row' object has no attribute 'slogan')

 Using web2py 2.6.3-stable

 Is someone else able to reproduce this error?

 Same thing happens when I try to remove enteties.


  -- 
 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 javascript:.
 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: pluralization system problem

2013-09-19 Thread mcamel
Any guide to open a ticket?.

Thanks.


El jueves, 19 de septiembre de 2013 01:00:16 UTC+2, Massimo Di Pierro 
escribió:

 Can you please open a ticket about this and we will review it asap?


-- 
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: $.web2py.ajax_page and response.flash / response.js

2013-09-19 Thread Kurt Grutzmacher
Yes, that's what's happening: X-Requested-Header is not being sent when
I manually use $.web2py.ajax_page(...) in my HTML.


Niphlod wrote:
 I'm missing a point . the only reliable way to detect a request
 cming from ajax is indeed the presence of the x-requested-with header
 . are you saying that you can replicate consistently a behaviour
 where jquery doesn't add the x-requested-with header ?

 Il giorno giovedě 19 settembre 2013 08:05:46 UTC+2, Kurt Grutzmacher
 ha scritto:

 Changeset a51d0877979c0846b420bee31102d162030f79ca in
 gluon/main.py now
 checks for response.ajax being true before adding response headers
 for
 web2py-component-flash and web2py-component-command. Unfortunately
 calls
 manually utilizing web2py_ajax_page( ... ) are not being seen as
 ajax
 because jQuery does not send the X-Requested-With header.

 For instance in the I have this this:

 var data = article= + checks;
 url = {{=URL('hosts', 'delete.json', user_signature=True)}}
 $.web2py.ajax_page( 'POST', url, data );

 If I look at the request headers being send, X-Requested-With is not
 set. Ajax calls that are set up by web2py functions such as LOAD(..,
 ajax=True) seem to be ok.

 This is acting like jQuery believes I'm sending a cross-domain ajax,
 which would should not send the header.

 A work-around can be done by setting both the
 response.flash/response.js
 entries as well as the corresponding header entries but that seems
 counterintuitive since main.py/wsgibase http://main.py/wsgibase
 should be setting these accordingly.

 -- 
 - grutz;

 -- 
 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.

-- 
- grutz;

-- 
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: $.web2py.ajax_page and response.flash / response.js

2013-09-19 Thread Niphlod
can you pack an app that shows the problem ? I really can't replicate the 
issue ... AFAIK jquery adds it unless an upload field is submitted or when 
fetching a script or a json.

Il giorno giovedì 19 settembre 2013 09:34:36 UTC+2, Kurt Grutzmacher ha 
scritto:

 Yes, that's what's happening: X-Requested-Header is not being sent when 
 I manually use $.web2py.ajax_page(...) in my HTML. 


 Niphlod wrote: 
  I'm missing a point . the only reliable way to detect a request 
  cming from ajax is indeed the presence of the x-requested-with header 
  . are you saying that you can replicate consistently a behaviour 
  where jquery doesn't add the x-requested-with header ? 
  
  Il giorno gioved� 19 settembre 2013 08:05:46 UTC+2, Kurt Grutzmacher 
  ha scritto: 
  
  Changeset a51d0877979c0846b420bee31102d162030f79ca in 
  gluon/main.py now 
  checks for response.ajax being true before adding response headers 
  for 
  web2py-component-flash and web2py-component-command. Unfortunately 
  calls 
  manually utilizing web2py_ajax_page( ... ) are not being seen as 
  ajax 
  because jQuery does not send the X-Requested-With header. 
  
  For instance in the I have this this: 
  
  var data = article= + checks; 
  url = {{=URL('hosts', 'delete.json', user_signature=True)}} 
  $.web2py.ajax_page( 'POST', url, data ); 
  
  If I look at the request headers being send, X-Requested-With is not 
  set. Ajax calls that are set up by web2py functions such as LOAD(.., 
  ajax=True) seem to be ok. 
  
  This is acting like jQuery believes I'm sending a cross-domain ajax, 
  which would should not send the header. 
  
  A work-around can be done by setting both the 
  response.flash/response.js 
  entries as well as the corresponding header entries but that seems 
  counterintuitive since main.py/wsgibase http://main.py/wsgibase 
  should be setting these accordingly. 
  
  -- 
  - grutz; 
  
  -- 
  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 javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 

 -- 
 - grutz; 


-- 
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] Virtual Fields and Smartgrid not working as expected

2013-09-19 Thread hiro
In the book I read:

*Showing virtual fields in SQLFORM.grid and smartgrid*
In recent versions of web2py, virtual fields are shown in grids like normal 
fields: either shown alongside all other fields by default, or by including 
them in the fields argument. However, virtual fields are not sortable.

However, if i use the welcome app and define:

db.define_table('entity',
Field('entity_name', 'string'),
Field('slogan', 'string'),
Field.Virtual('slogan2', lambda row: row.entity.slogan+', it is really 
the best.')
)

and then create a grid:

def index():
my_grid = SQLFORM.grid(db.entity)
return locals()

Reading the book I expect this to work. However I get the error 'Query Not 
Supported: no such column: entity.slogan2' in the smartgrid.

Massimo, is this related to to the same bug I asked about yesterday? (I 
have not yet updated my web2py to trunk, but did not find anything about 
this issue in the tracker.)

One solution might be to change the Virtual Fiels to computed fields.

A big hug to all web2py contributors!

-- 
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: Changelog for 2.6.3?

2013-09-19 Thread Mike Pixael
Thanks a lot for the info and fast updates guys. When I figure out what
happened with my virtual field I will let you know.


On Wed, Sep 18, 2013 at 8:02 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 Yes. I will update the changelog.

 in 2.6.2 we added applications/admin/settings.cfg which is required for
 the new admin editor to work.
 in 2.6.3 we added additional checks to fix a possible security issue. We
 do not know for sure we were vulnerable to the security issue but we added
 those checks anyway.

 Massimo


 On Wednesday, 18 September 2013 12:37:50 UTC-5, Dave S wrote:

 On Wednesday, September 18, 2013 3:52:38 AM UTC-7, Niphlod wrote:

 http://web2py.com/init/**default/changeloghttp://web2py.com/init/default/changelog


 Mike might be wondering what changed between 2.6.1 and 2.6.3, which isn't
 yet visible at that URL.  If I heard right, both .2 and .3 were small
 changes not related to sqlform; one of them was related to the django
 security issue, wasn't 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/svkcM5k6s88/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: web2py built-in debugger doesn't work

2013-09-19 Thread LightDot
There was already a bug open about this and it seems to be fixed, check:

http://code.google.com/p/web2py/issues/detail?id=1681

Regards

On Wednesday, September 18, 2013 7:31:43 PM UTC+2, kun...@umich.edu wrote:

 Has anyone used the built-in debugger in web2py.  

 Whenever I try to set a breakpoint,  it throws an error saying that 

 the file xxx.py:yyy does not exist. 




-- 
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: pluralization system problem

2013-09-19 Thread Vladyslav Kozlovskyy
4. Create languages/plural-es.py, with: {'object': ['objectos'],} 
Please try to replace 'object' with 'objecto'. In plural-*.py must be
native language only.

Vladyslav Kozlovskyy

У ср, 2013-09-18 у 16:00 -0700, Massimo Di Pierro пише:
 Can you please open a ticket about this and we will review it asap?
 
 On Wednesday, 18 September 2013 14:54:48 UTC-5, mcamel wrote:
 
 Hello,
 
 I've found two problems with Spanish pluralization. I think
 the first is a bug and the second is an unexpected behavior.
 Both happens with 2.51 and 2.6.3.
 
 How to repeat:
  1. Create a sample app
  2. Replace index() at default.py with: return T('%s %
 %{object}', 2, language=es)
  3. Add this to languages/es.py, just before '}':
 'object': 'objecto',
  4. Create languages/plural-es.py, with: {'object':
 ['objectos'],}
 
 You'll have this testing the index:
 
 2 objectos
 
 Right. But now if you change '2' by '1' at index(), you'll
 have:
 
 1 object
 
 instead of:
 
 1 objecto
 
 If you change languages/plural-es.py, with: {'objecto':
 ['objectos'],}
 
 it works even worse (never in Spanish).
 
 
 The second problem happens if you remove %s from index():
 return T('%%{object}', 2, language=es)
 
 Then you have an error:
 
 type 'exceptions.TypeError'(not all arguments converted
 during string formatting)
 
 Is there any workaround for this?.
 
 
 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.

-- 
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: pluralization system problem

2013-09-19 Thread LightDot
Issues/tickets/bug reports are found here:

http://code.google.com/p/web2py/issues/list

Just search if something like this already exist and if not, create a new 
issue.

On Thursday, September 19, 2013 9:31:03 AM UTC+2, mcamel wrote:

 Any guide to open a ticket?.

 Thanks.


 El jueves, 19 de septiembre de 2013 01:00:16 UTC+2, Massimo Di Pierro 
 escribió:

 Can you please open a ticket about this and we will review it asap?



-- 
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] Two authentication techniques in one form

2013-09-19 Thread Koen Vanhees
All,

I have two different authentication techniques in my app (local and AD). 
 All works well, but that means I have two login forms, and that's pretty 
inconvenient.
Is it possible to create a completely custom form, with only a username and 
password, and when pressing Login, having it check against the two 
defined authentication methods in the background?
I have been looking for a way to do that, but it doesn't seem to be easy. 
 Auth comes with predefined forms and I'm kind of lost here.
Any suggestions are welcome!

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] MVC, where do reusable funcions go

2013-09-19 Thread jjg0
Say I have a set of math functions I want to use that aren't in python, 
like calculating a mortgage or something.  I'm going to have a pretty large 
set of these, and it would be nice to keep them im a separate file that I 
can add to any projects in the future that might need them.  Where would I 
put this file?  Or would this be considered bad practice?

-- 
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] Two authentication techniques in one form

2013-09-19 Thread Vinicius Assef
Maybe manual authentication [1] helps you.

[1] 
http://web2py.com/books/default/chapter/29/09/access-control#Manual-Authentication

On Thu, Sep 19, 2013 at 9:06 AM, Koen Vanhees vanheesk...@gmail.com wrote:
 All,

 I have two different authentication techniques in my app (local and AD).
 All works well, but that means I have two login forms, and that's pretty
 inconvenient.
 Is it possible to create a completely custom form, with only a username and
 password, and when pressing Login, having it check against the two defined
 authentication methods in the background?
 I have been looking for a way to do that, but it doesn't seem to be easy.
 Auth comes with predefined forms and I'm kind of lost here.
 Any suggestions are welcome!

 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.

-- 
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: formstyle in login form

2013-09-19 Thread Anthony
auth.settings.formstyle

On Wednesday, September 18, 2013 12:14:07 PM UTC-4, Ramos wrote:

 Hello, can i change the formstyle of the login/register/profile form using
 form.formstyle=divs for example?




-- 
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] one to many using list:reference

2013-09-19 Thread Manuele Pesenti
Hi,
I thought to use fields of type list:reference to manage one to many
relation from different tables to the same table (containing all file
attachment of my application) but in case of removing records from the
referenced table with attachment do I have manage record updates on the
other table right? I guess using table events?

thank you in advance

Manuele

-- 
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] Permission check for a user in multiple groups

2013-09-19 Thread Vinicius Assef
Speaking in RBAC terms, you should check for permissions.

In your controller, something like:
@auth.has_permission(can_do_it)
def my_action():
   # code goes from here...



On Thu, Sep 19, 2013 at 2:13 AM, Jayakumar Bellie jkumar.o...@gmail.com wrote:
 Hi,
 I have groups with multiple permission.
 I have a user assigned to multiple groups.
 How to give access to user only for the groups they are assigned to.

 --
 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: formstyle in login form

2013-09-19 Thread António Ramos
Yep , its on the book.

Thank you again Anthony


2013/9/19 Anthony abasta...@gmail.com

 auth.settings.formstyle


 On Wednesday, September 18, 2013 12:14:07 PM UTC-4, Ramos wrote:

 Hello, can i change the formstyle of the login/register/profile form using
 form.formstyle=divs for example?


  --
 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] how to set a pycharm project with web2py as interpreter

2013-09-19 Thread Richard
Hello,

I was having unresolved reference in pycharm and make a bug report about 
that. It turns that I had wrongly setup the pycharm project. I setted up my 
project at app level app/.idea, so in this case I have to set web2py as 
interpreter. I can't figure it out yet. If someone know to to do, please 
help.

I have been able to get rid of unresolve reference by setting up a pycharm 
project that include web2py, where web2py is defined as source. The tree 
looks like that

pycharm_project/
web2py/applications/app
.idea/

I think that having pycharm project defined at app level is more reflecting 
the way web2py users develop considering that web2py evolve rapidly and 
that you have to move your app from one web2py version to another regularly.

Thanks.

Richard

PS.: IDE as tags in google group could be interresting!

-- 
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] one to many using list:reference

2013-09-19 Thread Richard Vézina
Hmm, good question!

Did you try it?

Richard


On Thu, Sep 19, 2013 at 9:08 AM, Manuele Pesenti
manuele.pese...@gmail.comwrote:

 Hi,
 I thought to use fields of type list:reference to manage one to many
 relation from different tables to the same table (containing all file
 attachment of my application) but in case of removing records from the
 referenced table with attachment do I have manage record updates on the
 other table right? I guess using table events?

 thank you in advance

 Manuele

 --
 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] web2py 2.6.3 editor is not working in firefox

2013-09-19 Thread frasse
Hi all
web2py 2.6.3 code editor is not working in firefox . I am running latest 
firefox. 
any Idea?

Regards
Frasse

-- 
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: pluralization system problem

2013-09-19 Thread mcamel
Nothing about pluralization, so i've opened Issue 
1684http://code.google.com/p/web2py/issues/detail?id=1684
.

El jueves, 19 de septiembre de 2013 12:03:00 UTC+2, LightDot escribió:

 Issues/tickets/bug reports are found here:

 http://code.google.com/p/web2py/issues/list

 Just search if something like this already exist and if not, create a new 
 issue.



-- 
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] pluralization system problem

2013-09-19 Thread mcamel
Hi Vladyslav,

i really thank you, but this is too much information for my level.

I understand %s is a must in this case, but cannot imagine a workaround to 
just pluralizates a word without printing the number that produces the 
pluralization.

Anyway, thank you very much.

Best regards,
Manuel Cameselle.


El jueves, 19 de septiembre de 2013 12:10:08 UTC+2, dbdeveloper escribió:

  this problem happens because  pluralisation templates  %%{word} works 
 with real python placeholders %s only

 see explanation in attachment, please. Hope this can help you.

 With the best regareds,
 Vladyslav Kozlovskyy


 У ср, 2013-09-18 у 12:54 -0700, mcamel пише:

 The second problem happens if you remove %s from index(): return 
 T('%%{object}', 2, language=es)

 Then you have an error:

 type 'exceptions.TypeError'(not all arguments converted during string 
 formatting)

 Is there any workaround for this?. 

 

-- 
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: pluralization system problem

2013-09-19 Thread mcamel
Hi,

I thought so when i saw plural-ru.py, but it doesn't work and besides, the 
case '2 objectos' becomes '2 object'.
So, even worse.


El jueves, 19 de septiembre de 2013 12:01:46 UTC+2, dbdeveloper escribió

  4. Create languages/plural-es.py, with: {'object': ['objectos'],} 
 Please try to replace 'object' with 'objecto'. In plural-*.py must be 
 native language only.

 Vladyslav Kozlovskyy

 У ср, 2013-09-18 у 16:00 -0700, Massimo Di Pierro пише: 

 Can you please open a ticket about this and we will review it asap?

 On Wednesday, 18 September 2013 14:54:48 UTC-5, mcamel wrote: 

  Hello,

 I've found two problems with Spanish pluralization. I think the first is a 
 bug and the second is an unexpected behavior.
 Both happens with 2.51 and 2.6.3.

 How to repeat: 

1. Create a sample app 
2. Replace index() at default.py with: return T('%s %%{object}', 2, 
language=es) 
3. Add this to languages/es.py, just before '}': 'object': 'objecto', 
4. Create languages/plural-es.py, with: {'object': ['objectos'],} 


 You'll have this testing the index:

 2 objectos

 Right. But now if you change '2' by '1' at index(), you'll have:

 1 object

 instead of:

 1 objecto

 If you change languages/plural-es.py, with: {'objecto': ['objectos'],}

 it works even worse (never in Spanish).


 The second problem happens if you remove %s from index(): return 
 T('%%{object}', 2, language=es)

 Then you have an error:

 type 'exceptions.TypeError'(not all arguments converted during string 
 formatting)

 Is there any workaround for this?.


 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+un...@googlegroups.com javascript:.
 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: web2py 2.6.3 editor is not working in firefox

2013-09-19 Thread Niphlod
it works. it's the same old story of hitting ctrl+r after any update to the 
admin app.

PS: we REALLY should start using response.static_version in admin.

Il giorno giovedì 19 settembre 2013 17:09:38 UTC+2, Massimo Di Pierro ha 
scritto:

 What do you see exactly? Can you try the trunk version?

 On Thursday, 19 September 2013 09:23:19 UTC-5, frasse wrote:

 Hi all
 web2py 2.6.3 code editor is not working in firefox . I am running latest 
 firefox. 
 any Idea?

 Regards
 Frasse



-- 
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] response cookie handling in 2.6

2013-09-19 Thread Joel Rathgaber
Hey all, 

I've noticed that in the 2.5 and prior releases that the session id cookie 
was sent back to the client in every response, and it seems like in 2.6 it 
doesn't do this anymore.  Is this by design? If so, what's the reasoning?

Thanks!
--Joel.

-- 
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] PUT and DELETE not working in web2py?

2013-09-19 Thread Thirugnanam Kaneshalingam
We are having some issue with Cross Origin Resource Sharing (CORS) 
implementation in a restfull web service on web2py.
We try to implement CORS on the server side in web2py as suggested here: ( 
https://groups.google.com/forum/#!msg/web2py/kSUtyNcUQGI/qfiIqfUiWLwJ )
we added following to models/0.py, (to have the response header updated 
before actual restfull api handler in the controler)

===
if request.env.http_origin:
#response 
https://www.facebook.com/hashtag/response.headers['Access-Control-Allow-Origin']
 
= request.env.http_origin
response.headers['Access-Control-Allow-Origin'] = *
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400

if request.env.request_method == 'OPTIONS':
if request.env.http_access_control_request_method:
print request.env.http_access_control_request_method
response.headers['Access-Control-Allow-Methods'] = 
request.env.http_access_control_request_method
if request.env.http_access_control_request_headers:
response.headers['Access-Control-Allow-Headers'] = 
request.env.http_access_control_request_headers
==

RESTful POST  GET are now working
but PUT and DELETE aren't because preflight http OPTIONS request is 
rejected as 400 BAD REQUEST by web2py

So for example when calling the restful webservice using ajax call from a 
local web page,
we get the following error msg in NetBeans log.

Failed to load resource: the server responded with a status of 400 (BAD 
REQUEST) (10:46:36:182 | error, network)
at 
http://127.0.0.1:8000/test/default/api/entries/2.jsonhttps://www.facebook.com/l.php?u=http%3A%2F%2F127.0.0.1%3A8000%2Ftest%2Fdefault%2Fapi%2Fentries%2F2.jsonh=6AQEXO762AQEdGBr1FA5hs7g-rkoOuV3j_Ls67igLa1ysWws=1
Failed to load resource: Origin http://localhost:8383 is not allowed by 
Access-Control-Allow-Origin. (10:46:36:183 | error, network)
at 
http://127.0.0.1:8000/test/defaulthttps://www.facebook.com/l.php?u=http%3A%2F%2F127.0.0.1%3A8000%2Ftest%2Fdefaulth=SAQHZ1uIiAQF-DetwOo02m0brzq8JFqvX0khT8_XL5fZhqgs=1
/api/entries/2.json
XMLHttpRequest cannot load http://127.0.0.1:8000/test/default
/api/entries/2.json. Origin http://localhost:8383 is not allowed by 
Access-Control-Allow-Origin. (10:46:36:183 | error, javascript)
at www/page/test.html

-- 
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] issue with redirect to login page, the .load propagate in case of component NOT AUTHORIZED

2013-09-19 Thread Richard Vézina
Hello,

It seems that auth.settings.*login_url* = URL('default', 'user',
args='login', extension=False) works at least in context where the user
access site and get redirect to login page...

But for some reason, it seems that self.settings.login_url in the code
below :

messages.update(ajax_failed_authentication=DIV(H4('NOT AUTHORIZED'),
'Please ',
A('login',
  _href=*self.settings.login_url* +
  ('?_next=' +
urllib.quote(current.request.env.http_web2py_component_location))
  if current.request.env.http_web2py_component_location else
''),
' to view this content.',
_class='not-authorized alert alert-block'))

Get override or the auth init get call again in context of component and
auth.settings.login_url = URL(...) from db.py is ignored??

Richard


On Wed, Sep 18, 2013 at 4:32 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 Ok, I miss understand the utility of default_settings, it is not
 initialize the Auth settings list...

 I guess we need something like login_next...

 Will see what I can do tomorrow...

 Richard


 On Wed, Sep 18, 2013 at 4:01 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Adding this, after line 928 :
  url_login = URL(c='default', f='user', args='login')

 And changing line 1163-1164 for this :
 url_login = self.default_settings['url_login']

 Solve it, thought, I don't know why I don't need auth.settings.url_login
 = URL(default','user',args='login', extension=False) to make it works
 properly...

 So, I guess it not works the way you want it to do... Futher tests are
 required...

 Richard


 On Wed, Sep 18, 2013 at 3:27 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 I think we need to add url_login in Auth init, I get  type
 'exceptions.SyntaxError' setting key 'url_login' does not exist
 I try login_url, it don't return ticket but it not working...

 web2py 2.4.7

 Richard


 On Wed, Sep 18, 2013 at 3:21 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Right!

 That what I thougth to do at first I should had just did that instead
 of fixing something :)

 Thanks.

 Richard


 On Wed, Sep 18, 2013 at 2:54 PM, Massimo Di Pierro 
 massimo.dipie...@gmail.com wrote:

 This cannot be fixed at the level of gluon/tools.py because some users
 may want an ajax login form. Those users should be free to create a
 default/user.load view.
 In your case you simply need to do (in model):

 auth.settings.url_login = URL('default','user',args='login',
 extension=False)



 On Wednesday, 18 September 2013 08:51:08 UTC-5, Richard wrote:

 Adding extention='html' at line 1163 in tools.py seems to solve the
 issue :

 url_login = URL(controller, function, args='login', extension='html')

 Or extension=False

 url_login = URL(controller, function, args='login', extension=False)

 The latter probably better

 Richard



 On Wed, Sep 18, 2013 at 9:37 AM, Richard ml.richa...@gmail.comwrote:


 Hello,

 In case a component trigger a NOT AUTHORIZED popup, the login
 redirect link propagate the .load of the component :

 NOT AUTHORIZEDPlease 
 loginhttp://127.0.0.1:8000/sgddms/default/user.load/login?_next=http%3A//127.0.0.1%3A8000/sgddms/default/index%23
  to
 view this content.


 The link look like that : 
 http://127.0.0.1:8000/app/**default/userhttp://127.0.0.1:8000/app/default/user
 *.load*/login?_next=**url...

 This occure in web2py 2.4.7

 Richard

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - 
 http://github.com/web2py/**web2pyhttp://github.com/web2py/web2py(Source
  code)
 - 
 https://code.google.com/p/**web2py/issues/listhttps://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_outhttps://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.







-- 
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 

Re: [web2py] issue with redirect to login page, the .load propagate in case of component NOT AUTHORIZED

2013-09-19 Thread Richard Vézina
Or db.py auth.settings.login_url = URL(...) is just not executed in case
the user is not logged?

Richard


On Thu, Sep 19, 2013 at 12:27 PM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 Hello,

 It seems that auth.settings.*login_url* = URL('default', 'user',
 args='login', extension=False) works at least in context where the user
 access site and get redirect to login page...

 But for some reason, it seems that self.settings.login_url in the code
 below :

 messages.update(ajax_failed_authentication=DIV(H4('NOT AUTHORIZED'),
 'Please ',
 A('login',
   _href=*self.settings.login_url* +
   ('?_next=' +
 urllib.quote(current.request.env.http_web2py_component_location))
   if current.request.env.http_web2py_component_location else
 ''),
 ' to view this content.',
 _class='not-authorized alert alert-block'))

 Get override or the auth init get call again in context of component and
 auth.settings.login_url = URL(...) from db.py is ignored??

 Richard


 On Wed, Sep 18, 2013 at 4:32 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Ok, I miss understand the utility of default_settings, it is not
 initialize the Auth settings list...

 I guess we need something like login_next...

 Will see what I can do tomorrow...

 Richard


 On Wed, Sep 18, 2013 at 4:01 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Adding this, after line 928 :
  url_login = URL(c='default', f='user', args='login')

 And changing line 1163-1164 for this :
 url_login = self.default_settings['url_login']

 Solve it, thought, I don't know why I don't need auth.settings.url_login
 = URL(default','user',args='login', extension=False) to make it works
 properly...

 So, I guess it not works the way you want it to do... Futher tests are
 required...

 Richard


 On Wed, Sep 18, 2013 at 3:27 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 I think we need to add url_login in Auth init, I get  type
 'exceptions.SyntaxError' setting key 'url_login' does not exist
 I try login_url, it don't return ticket but it not working...

 web2py 2.4.7

 Richard


 On Wed, Sep 18, 2013 at 3:21 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Right!

 That what I thougth to do at first I should had just did that instead
 of fixing something :)

 Thanks.

 Richard


 On Wed, Sep 18, 2013 at 2:54 PM, Massimo Di Pierro 
 massimo.dipie...@gmail.com wrote:

 This cannot be fixed at the level of gluon/tools.py because some
 users may want an ajax login form. Those users should be free to create a
 default/user.load view.
 In your case you simply need to do (in model):

 auth.settings.url_login = URL('default','user',args='login',
 extension=False)



 On Wednesday, 18 September 2013 08:51:08 UTC-5, Richard wrote:

 Adding extention='html' at line 1163 in tools.py seems to solve the
 issue :

 url_login = URL(controller, function, args='login', extension='html')

 Or extension=False

 url_login = URL(controller, function, args='login', extension=False)

 The latter probably better

 Richard



 On Wed, Sep 18, 2013 at 9:37 AM, Richard ml.richa...@gmail.comwrote:


 Hello,

 In case a component trigger a NOT AUTHORIZED popup, the login
 redirect link propagate the .load of the component :

 NOT AUTHORIZEDPlease 
 loginhttp://127.0.0.1:8000/sgddms/default/user.load/login?_next=http%3A//127.0.0.1%3A8000/sgddms/default/index%23
  to
 view this content.


 The link look like that : 
 http://127.0.0.1:8000/app/**default/userhttp://127.0.0.1:8000/app/default/user
 *.load*/login?_next=**url...

 This occure in web2py 2.4.7

 Richard

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - 
 http://github.com/web2py/**web2pyhttp://github.com/web2py/web2py(Source
  code)
 - 
 https://code.google.com/p/**web2py/issues/listhttps://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_outhttps://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.








-- 
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 

[web2py] Re: one to many using list:reference

2013-09-19 Thread Massimo Di Pierro
No because that would be inefficient. Yet in forms the elements of a 
list:reference that correspond to deleted records are filtered out. So when 
you edit the record they are deleted.


On Thursday, 19 September 2013 08:08:35 UTC-5, Manuele wrote:

 Hi, 
 I thought to use fields of type list:reference to manage one to many 
 relation from different tables to the same table (containing all file 
 attachment of my application) but in case of removing records from the 
 referenced table with attachment do I have manage record updates on the 
 other table right? I guess using table events? 

 thank you in advance 

 Manuele 


-- 
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: response cookie handling in 2.6

2013-09-19 Thread Massimo Di Pierro
If the session is empty it is not saved. If it is not saved there is no 
point in assigning a cookie.

On Thursday, 19 September 2013 11:13:42 UTC-5, Joel Rathgaber wrote:

 Hey all, 

 I've noticed that in the 2.5 and prior releases that the session id cookie 
 was sent back to the client in every response, and it seems like in 2.6 it 
 doesn't do this anymore.  Is this by design? If so, what's the reasoning?

 Thanks!
 --Joel.



-- 
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] issue with redirect to login page, the .load propagate in case of component NOT AUTHORIZED

2013-09-19 Thread Richard Vézina
Nop... auth.settings.login_url work even if user is disconnect.

Richard


On Thu, Sep 19, 2013 at 12:31 PM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 Or db.py auth.settings.login_url = URL(...) is just not executed in case
 the user is not logged?

 Richard


 On Thu, Sep 19, 2013 at 12:27 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Hello,

 It seems that auth.settings.*login_url* = URL('default', 'user',
 args='login', extension=False) works at least in context where the user
 access site and get redirect to login page...

 But for some reason, it seems that self.settings.login_url in the code
 below :

 messages.update(ajax_failed_authentication=DIV(H4('NOT AUTHORIZED'),
 'Please ',
 A('login',
   _href=*self.settings.login_url* +
   ('?_next=' +
 urllib.quote(current.request.env.http_web2py_component_location))
   if current.request.env.http_web2py_component_location else
 ''),
 ' to view this content.',
 _class='not-authorized alert alert-block'))

 Get override or the auth init get call again in context of component and
 auth.settings.login_url = URL(...) from db.py is ignored??

 Richard


 On Wed, Sep 18, 2013 at 4:32 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Ok, I miss understand the utility of default_settings, it is not
 initialize the Auth settings list...

 I guess we need something like login_next...

 Will see what I can do tomorrow...

 Richard


 On Wed, Sep 18, 2013 at 4:01 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Adding this, after line 928 :
  url_login = URL(c='default', f='user', args='login')

 And changing line 1163-1164 for this :
 url_login = self.default_settings['url_login']

 Solve it, thought, I don't know why I don't need
 auth.settings.url_login = URL(default','user',args='login',
 extension=False) to make it works properly...

 So, I guess it not works the way you want it to do... Futher tests are
 required...

 Richard


 On Wed, Sep 18, 2013 at 3:27 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 I think we need to add url_login in Auth init, I get  type
 'exceptions.SyntaxError' setting key 'url_login' does not exist
 I try login_url, it don't return ticket but it not working...

 web2py 2.4.7

 Richard


 On Wed, Sep 18, 2013 at 3:21 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Right!

 That what I thougth to do at first I should had just did that instead
 of fixing something :)

 Thanks.

 Richard


 On Wed, Sep 18, 2013 at 2:54 PM, Massimo Di Pierro 
 massimo.dipie...@gmail.com wrote:

 This cannot be fixed at the level of gluon/tools.py because some
 users may want an ajax login form. Those users should be free to create 
 a
 default/user.load view.
 In your case you simply need to do (in model):

 auth.settings.url_login = URL('default','user',args='login',
 extension=False)



 On Wednesday, 18 September 2013 08:51:08 UTC-5, Richard wrote:

 Adding extention='html' at line 1163 in tools.py seems to solve the
 issue :

 url_login = URL(controller, function, args='login',
 extension='html')

 Or extension=False

 url_login = URL(controller, function, args='login', extension=False)

 The latter probably better

 Richard



 On Wed, Sep 18, 2013 at 9:37 AM, Richard ml.richa...@gmail.comwrote:


 Hello,

 In case a component trigger a NOT AUTHORIZED popup, the login
 redirect link propagate the .load of the component :

 NOT AUTHORIZEDPlease 
 loginhttp://127.0.0.1:8000/sgddms/default/user.load/login?_next=http%3A//127.0.0.1%3A8000/sgddms/default/index%23
  to
 view this content.


 The link look like that : 
 http://127.0.0.1:8000/app/**default/userhttp://127.0.0.1:8000/app/default/user
 *.load*/login?_next=**url...

 This occure in web2py 2.4.7

 Richard

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - 
 http://github.com/web2py/**web2pyhttp://github.com/web2py/web2py(Source
  code)
 - 
 https://code.google.com/p/**web2py/issues/listhttps://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_outhttps://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.









-- 
Resources:
- http://web2py.com
- 

[web2py] Re: web2py 2.6.3 editor is not working in firefox

2013-09-19 Thread Massimo Di Pierro
What do you see exactly? Can you try the trunk version?

On Thursday, 19 September 2013 09:23:19 UTC-5, frasse wrote:

 Hi all
 web2py 2.6.3 code editor is not working in firefox . I am running latest 
 firefox. 
 any Idea?

 Regards
 Frasse


-- 
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: web2py 2.6.3 editor is not working in firefox

2013-09-19 Thread Paolo Valleri
Yes we can! I will work on it asap in the next days :P

On Thursday, September 19, 2013 5:30:55 PM UTC+2, Ramos wrote:

 Just a minor improvement. 
 Could you add a create link in the left collapsible menu when we are 
 editing code in the browser?.
 Avoids having to go back to admin and click the create button.




 2013/9/19 Niphlod nip...@gmail.com javascript:

 it works. it's the same old story of hitting ctrl+r after any update to 
 the admin app.

 PS: we REALLY should start using response.static_version in admin.

 Il giorno giovedì 19 settembre 2013 17:09:38 UTC+2, Massimo Di Pierro ha 
 scritto:

 What do you see exactly? Can you try the trunk version?

 On Thursday, 19 September 2013 09:23:19 UTC-5, frasse wrote:

 Hi all
 web2py 2.6.3 code editor is not working in firefox . I am running 
 latest firefox. 
 any Idea?

 Regards
 Frasse

  -- 
 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 javascript:.
 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: Changing field type.

2013-09-19 Thread Avi A
Reminding :)

On Wednesday, September 18, 2013 7:42:11 PM UTC+3, Massimo Di Pierro wrote:

 got it. will look asap. remind me if no answer in 24hrs. ;-)

 On Wednesday, 18 September 2013 11:10:20 UTC-5, Avi A wrote:

 Just to make sure you got the email, I sent it yesterday.

 On Tuesday, September 17, 2013 11:24:00 PM UTC+3, Avi A wrote:

 Sure, thanks.

 On Tuesday, September 17, 2013 10:57:25 PM UTC+3, Massimo Di Pierro 
 wrote:

 Can you email me your app (confindentially)?

 On Tuesday, 17 September 2013 14:49:07 UTC-5, Avi A wrote:

 i changed some fileds type to :type='upload', notnull=True, and I do 
 see the changes, but not with the dropdwon .

 On Tuesday, September 17, 2013 10:27:27 PM UTC+3, Massimo Di Pierro 
 wrote:

 I do not believe the lack of dropdown has anything to do with the 
 migration. Something is changing the validator.

 On Tuesday, 17 September 2013 13:39:51 UTC-5, Avi A wrote:

 The first issue, yes I don't get a dropdown list. I only changed the 
 field type and the migration line. I used the wizard to create a new 
 app 
 and there are quite many fixes I have to make, mostly changing the type 
 to 
 reference and replacing strings with uploads.
 thanks.

 On Tuesday, September 17, 2013 4:13:46 PM UTC+3, Massimo Di Pierro 
 wrote:

 There are two different issues. One is the question in your first 
 email about migration. Is the problem that you do not get a dropdown? 
 Is it 
 possible you manually set a validator for the field?

 Your second question. How to drop a table.
 1) enable migrations
 2) python web2py.py -S yourapp -M -M
 3) type

 db.yourtable.drop()
 db.commit()

 4) edit the model and remove the table before using the app, else 
 it will be created again.

 On Tuesday, 17 September 2013 07:46:42 UTC-5, Avi A wrote:

 Changing it to True, didn't make a change either.

 On Tuesday, September 17, 2013 3:34:29 PM UTC+3, Avi A wrote:

 What's the procedure to drop the table?

 On Tuesday, September 17, 2013 3:22:35 PM UTC+3, Niphlod wrote:

 if you set migrate=False, what kind of migration you expect ?

 PS: changing something from integer to string suualy doesn't 
 involve any problem: doing the opposite brings many my totally 
 personal 
 advice is drop those table and recreate them from scratch

 On Tuesday, September 17, 2013 1:33:54 PM UTC+2, Avi A wrote:

 Hi,
 I changed in some table (t_items) a field type from:
 type='string'
 to:
 type='reference t_categories'
 and replaced:
 migrate=settings.migrate
 with:
 migrate=False,fake_migrate=True
 I stopped and started the server,  but I don't see that the 
 change took place, on the relevant form. (create item.).
 What should I do?
 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: web2py 2.6.3 is OUT (security update)

2013-09-19 Thread Michael Jackson
I am experiencing an issue with one of the experimental features. In db.py 
I have auth.settings.manager_group_role = 'SuperUser' . This was working 
for me in 2.5.1 but now I am getting a ticket saying that 
manager_group_role doesn't exist. Was this removed or changed?

Thanks,
Michael

-- 
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 2.6.3 is OUT (security update)

2013-09-19 Thread Massimo Di Pierro
We called it: auth.settings.auth_manager_role

On Thursday, 19 September 2013 12:00:10 UTC-5, Michael Jackson wrote:

 I am experiencing an issue with one of the experimental features. In db.py 
 I have auth.settings.manager_group_role = 'SuperUser' . This was working 
 for me in 2.5.1 but now I am getting a ticket saying that 
 manager_group_role doesn't exist. Was this removed or changed?

 Thanks,
 Michael


-- 
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: response cookie handling in 2.6

2013-09-19 Thread Massimo Di Pierro
Please open a ticket about this.


On Thursday, 19 September 2013 13:07:38 UTC-5, Joel Rathgaber wrote:

 We are putting things in the session, so it shouldn't be empty.  The line 
 in our code that is failing is something like this

 current.response.cookies[current.response.session_id_name][httponly] = 
 True
 We are doing this in a module.  

 In our models/db.py we have
 session.connect(request, response, db=MEMDB(cache.memcache)) 
 (we set up memcache before this obviously).

 the error I'm getting is a KeyError in regards to the 
 current.response.cookies.  Upon debugging, the current.response.cookies is 
 an empty SimpleCookie instance.

 I looked through the connect() method in the globals.py and could not see 
 any place that the cookies were assigned in the response object (as there 
 was in the 2.5 version of globals.py).

 Thanks!
 --Joel.




 On Thursday, September 19, 2013 10:39:56 AM UTC-6, Massimo Di Pierro wrote:

 If the session is empty it is not saved. If it is not saved there is no 
 point in assigning a cookie.

 On Thursday, 19 September 2013 11:13:42 UTC-5, Joel Rathgaber wrote:

 Hey all, 

 I've noticed that in the 2.5 and prior releases that the session id 
 cookie was sent back to the client in every response, and it seems like in 
 2.6 it doesn't do this anymore.  Is this by design? If so, what's the 
 reasoning?

 Thanks!
 --Joel.



-- 
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: response cookie handling in 2.6

2013-09-19 Thread Joel Rathgaber
We are putting things in the session, so it shouldn't be empty.  The line 
in our code that is failing is something like this

current.response.cookies[current.response.session_id_name][httponly] = 
True
We are doing this in a module.  

In our models/db.py we have
session.connect(request, response, db=MEMDB(cache.memcache)) 
(we set up memcache before this obviously).

the error I'm getting is a KeyError in regards to the 
current.response.cookies.  Upon debugging, the current.response.cookies is 
an empty SimpleCookie instance.

I looked through the connect() method in the globals.py and could not see 
any place that the cookies were assigned in the response object (as there 
was in the 2.5 version of globals.py).

Thanks!
--Joel.




On Thursday, September 19, 2013 10:39:56 AM UTC-6, Massimo Di Pierro wrote:

 If the session is empty it is not saved. If it is not saved there is no 
 point in assigning a cookie.

 On Thursday, 19 September 2013 11:13:42 UTC-5, Joel Rathgaber wrote:

 Hey all, 

 I've noticed that in the 2.5 and prior releases that the session id 
 cookie was sent back to the client in every response, and it seems like in 
 2.6 it doesn't do this anymore.  Is this by design? If so, what's the 
 reasoning?

 Thanks!
 --Joel.



-- 
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] Site does not remember users (auth.settings.long_expiration) after 2.6.3 update?

2013-09-19 Thread Andriy
My site and forum was running fine for 5 month now. Yesterday, I updated 
from version 2.4 (or 2.5, I don`t remember for sure which it was) to 
version 2.6.3. I did what change log says and copied static/js/web2py.js, 
controllers/appadmin.py, and views/appadmin.html from the welcome app to my 
app. Everything appeared to run fine. But today users start complaining 
that site does not remember them even if they check remember me for 90 
days on login. I checked myself and indeed, if I log out, log in, close 
browser and than open it, I`m not logged in to site.
I have auth.settings.long_expiration = 3600*24*90 line in db.py, it was 
working before.
I checked received cookie in Opera and noticed, that *expires* fields are 
blank:

https://lh4.googleusercontent.com/-RVjcMzxgrZ0/UjtQm6n1Z_I/ABQ/9Gz8fpkeGSw/s1600/cookie.jpg

Can this be the reason? If yes, is this some bug in 2.6.3 release? If not I 
have no knowledge what it may be, and ask for help, where to look for 
trouble. Thank you.
Also I noticed another thread mentioning change in cookies handling 
- https://groups.google.com/forum/#!topic/web2py/Ju0LIa35de4 May be this is 
related?


https://lh4.googleusercontent.com/-RVjcMzxgrZ0/UjtQm6n1Z_I/ABQ/9Gz8fpkeGSw/s1600/cookie.jpg

-- 
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: response cookie handling in 2.6

2013-09-19 Thread Joel Rathgaber
Submitted as #1685

On Thursday, September 19, 2013 12:47:09 PM UTC-6, Massimo Di Pierro wrote:

 Please open a ticket about this.


 On Thursday, 19 September 2013 13:07:38 UTC-5, Joel Rathgaber wrote:

 We are putting things in the session, so it shouldn't be empty.  The line 
 in our code that is failing is something like this

 current.response.cookies[current.response.session_id_name][httponly] = 
 True
 We are doing this in a module.  

 In our models/db.py we have
 session.connect(request, response, db=MEMDB(cache.memcache)) 
 (we set up memcache before this obviously).

 the error I'm getting is a KeyError in regards to the 
 current.response.cookies.  Upon debugging, the current.response.cookies is 
 an empty SimpleCookie instance.

 I looked through the connect() method in the globals.py and could not see 
 any place that the cookies were assigned in the response object (as there 
 was in the 2.5 version of globals.py).

 Thanks!
 --Joel.




 On Thursday, September 19, 2013 10:39:56 AM UTC-6, Massimo Di Pierro 
 wrote:

 If the session is empty it is not saved. If it is not saved there is no 
 point in assigning a cookie.

 On Thursday, 19 September 2013 11:13:42 UTC-5, Joel Rathgaber wrote:

 Hey all, 

 I've noticed that in the 2.5 and prior releases that the session id 
 cookie was sent back to the client in every response, and it seems like in 
 2.6 it doesn't do this anymore.  Is this by design? If so, what's the 
 reasoning?

 Thanks!
 --Joel.



-- 
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: $.web2py.ajax_page and response.flash / response.js

2013-09-19 Thread Niphlod
uhm. I open default/index and I see two buttons. the first works, the 
second doesn't (a problem in trap_form()), but for both xmlhttprequest is 
there.

Are you sure of what you're reporting ?

BTW: was it documented that ajax_page supports not having a target ? I can 
patch it for '' and undefined, but I'm not sure where you found that 
reference. Anyway it's not a big deal, I'll send a PR (just dealing with 
the error, as I can't reproduce the missing xmlhttprequest)

PS: if every user learns from you on how to report bugs life for devs would 
be much sweeter: thanks for your accuracy ^_^

On Thursday, September 19, 2013 1:48:46 PM UTC+2, Kurt Grutzmacher wrote:

 Hey Niphlod, 

 Further testing shows this happens only when the $.web2py.ajax_page() 
 call has an undefined target: 

 request.ajax = False: $.web2py.ajax_page( 'POST', url, 'data=data' ); 
 request.ajax = True:$.web2py.ajax_page( 'POST', url, 'data=data', '' 
 ); 

 Packed test application attached 

 Niphlod wrote: 
  can you pack an app that shows the problem ? I really can't replicate 
  the issue ... AFAIK jquery adds it unless an upload field is submitted 
  or when fetching a script or a json. 
  
  Il giorno gioved� 19 settembre 2013 09:34:36 UTC+2, Kurt Grutzmacher 
  ha scritto: 
  
  Yes, that's what's happening: X-Requested-Header is not being sent 
  when 
  I manually use $.web2py.ajax_page(...) in my HTML. 
  
  
  Niphlod wrote: 
   I'm missing a point . the only reliable way to detect a 
  request 
   cming from ajax is indeed the presence of the x-requested-with 
  header 
   . are you saying that you can replicate consistently a 
  behaviour 
   where jquery doesn't add the x-requested-with header ? 
   
   Il giorno gioved� 19 settembre 2013 08:05:46 UTC+2, Kurt 
  Grutzmacher 
   ha scritto: 
   
   Changeset a51d0877979c0846b420bee31102d162030f79ca in 
   gluon/main.py now 
   checks for response.ajax being true before adding response 
  headers 
   for 
   web2py-component-flash and web2py-component-command. 
  Unfortunately 
   calls 
   manually utilizing web2py_ajax_page( ... ) are not being 
  seen as 
   ajax 
   because jQuery does not send the X-Requested-With header. 
   
   For instance in the I have this this: 
   
   var data = article= + checks; 
   url = {{=URL('hosts', 'delete.json', user_signature=True)}} 
   $.web2py.ajax_page( 'POST', url, data ); 
   
   If I look at the request headers being send, 
  X-Requested-With is not 
   set. Ajax calls that are set up by web2py functions such as 
  LOAD(.., 
   ajax=True) seem to be ok. 
   
   This is acting like jQuery believes I'm sending a 
  cross-domain ajax, 
   which would should not send the header. 
   
   A work-around can be done by setting both the 
   response.flash/response.js 
   entries as well as the corresponding header entries but that 
  seems 
   counterintuitive since main.py/wsgibase 
  http://main.py/wsgibase http://main.py/wsgibase 
   should be setting these accordingly. 
   
   -- 
   - grutz; 
   
   -- 
   Resources: 
   - http://web2py.com 
   - http://web2py.com/book (Documentation) 
   - http://github.com/web2py/web2py 
  http://github.com/web2py/web2py (Source code) 
   - https://code.google.com/p/web2py/issues/list 
  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 javascript:. 
   For more options, visit https://groups.google.com/groups/opt_out 
  https://groups.google.com/groups/opt_out. 
  
  -- 
  - grutz; 
  
  -- 
  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 javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 

 -- 
 - grutz; 


-- 
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 

Re: [web2py] Re: one to many using list:reference

2013-09-19 Thread Manuele Pesenti
Il 19/09/13 17:11, Massimo Di Pierro ha scritto:
 No because that would be inefficient. Yet in forms the elements of a
 list:reference that correspond to deleted records are filtered out. So
 when you edit the record they are deleted.
Great!
Thank you Massimo and Richard.

Cheers

Manuele



 On Thursday, 19 September 2013 08:08:35 UTC-5, Manuele wrote:

 Hi,
 I thought to use fields of type list:reference to manage one to
 many
 relation from different tables to the same table (containing all file
 attachment of my application) but in case of removing records from
 the
 referenced table with attachment do I have manage record updates
 on the
 other table right? I guess using table events?

 thank you in advance

 Manuele

 -- 
 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] pluralization system problem

2013-09-19 Thread mcamel
It works!

Thanks.


El jueves, 19 de septiembre de 2013 22:05:31 UTC+2, dbdeveloper escribió:

  Use%%{word(%i)} to avoid printing the number:

 T('%%{object(%i)}', 2, language=es)  or T('%%{object(%s)}', 2, 
 language=es)


-- 
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: $.web2py.ajax_page and response.flash / response.js

2013-09-19 Thread Anthony


 BTW: was it documented that ajax_page supports not having a target ? I can 
 patch it for '' and undefined, but I'm not sure where you found that 
 reference. Anyway it's not a big deal, I'll send a PR (just dealing with 
 the error, as I can't reproduce the missing xmlhttprequest)


I don't think ajax_page is documented at all (I think only ajax, component, 
and websocket are documented as part of the public API). We should think 
about which functions in web2py.js are intended to be part of the API vs. 
internal, as we don't want to get locked into supporting all the internal 
functions for the sake of backward compatibility.

Also, at the bottom of the file, there is:

web2py_websocket = $.web2py.websocket;

but it looks like the function name is still web2py_websocket rather than 
just websocket.

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.


Re: [web2py] pluralization system problem

2013-09-19 Thread Vladyslav Kozlovskyy
Use%%{word(%i)} to avoid printing the number:

T('%%{object(%i)}', 2, language=es)  or T('%%{object(%s)}', 2,
language=es)




У чт, 2013-09-19 у 07:49 -0700, mcamel пише:
 Hi Vladyslav,
 
 i really thank you, but this is too much information for my level.
 
 I understand %s is a must in this case, but cannot imagine a
 workaround to just pluralizates a word without printing the number
 that produces the pluralization.
 
 Anyway, thank you very much.
 
 Best regards,
 Manuel Cameselle.
 
 
 El jueves, 19 de septiembre de 2013 12:10:08 UTC+2, dbdeveloper
 escribió:
 
 this problem happens because  pluralisation templates  %
 %{word} works with real python placeholders %s only
 
 see explanation in attachment, please. Hope this can help you.
 
 With the best regareds,
 Vladyslav Kozlovskyy
 
 
 У ср, 2013-09-18 у 12:54 -0700, mcamel пише:
 
  The second problem happens if you remove %s from index():
  return T('%%{object}', 2, language=es)
  
  Then you have an error:
  
  type 'exceptions.TypeError'(not all arguments converted
  during string formatting)
  
  Is there any workaround for this?.
 
 -- 
 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] how to catch db OperationalError?

2013-09-19 Thread Jonathan Lundell
What's the best way to catch a driver-specific OperationalError? I'm using 
executesql to create a set of indexes (MySQL, as it happens), and I'd like to 
catch, report  ignore existing-index errors. In an earlier version I was 
getting InternalError, but now it's reported as 
_mysql_exceptions.OperationalError.

I can catch everything and use adapter.isOperationalError, I suppose (and 
re-raise if no match). Is there a better way?

-- 
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] how to catch db OperationalError?

2013-09-19 Thread Jonathan Lundell
On 19 Sep 2013, at 1:38 PM, Jonathan Lundell jlund...@pobox.com wrote:
 
 What's the best way to catch a driver-specific OperationalError? I'm using 
 executesql to create a set of indexes (MySQL, as it happens), and I'd like to 
 catch, report  ignore existing-index errors. In an earlier version I was 
 getting InternalError, but now it's reported as 
 _mysql_exceptions.OperationalError.
 
 I can catch everything and use adapter.isOperationalError, I suppose (and 
 re-raise if no match). Is there a better way?

On reflection: a) we've switched default MySQL drivers, and b) I don't really 
care what the error is; I just want to report it back to the user. So just 
catching Exception should be fine.

-- 
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: Site does not remember users (auth.settings.long_expiration) after 2.6.3 update?

2013-09-19 Thread Massimo Di Pierro
This could be related. We will look into this asap.

On Thursday, 19 September 2013 14:33:24 UTC-5, Andriy wrote:


 https://lh4.googleusercontent.com/-RVjcMzxgrZ0/UjtQm6n1Z_I/ABQ/9Gz8fpkeGSw/s1600/cookie.jpg
 My site and forum was running fine for 5 month now. Yesterday, I updated 
 from version 2.4 (or 2.5, I don`t remember for sure which it was) to 
 version 2.6.3. I did what change log says and copied static/js/web2py.js, 
 controllers/appadmin.py, and views/appadmin.html from the welcome app to my 
 app. Everything appeared to run fine. But today users start complaining 
 that site does not remember them even if they check remember me for 90 
 days on login. I checked myself and indeed, if I log out, log in, close 
 browser and than open it, I`m not logged in to site.
 I have auth.settings.long_expiration = 3600*24*90 line in db.py, it was 
 working before.
 I checked received cookie in Opera and noticed, that *expires* fields 
 are blank:



 Can this be the reason? If yes, is this some bug in 2.6.3 release? If not 
 I have no knowledge what it may be, and ask for help, where to look for 
 trouble. Thank you.
 Also I noticed another thread mentioning change in cookies handling - 
 https://groups.google.com/forum/#!topic/web2py/Ju0LIa35de4 May be this is 
 related?



 https://lh4.googleusercontent.com/-RVjcMzxgrZ0/UjtQm6n1Z_I/ABQ/9Gz8fpkeGSw/s1600/cookie.jpg


-- 
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: PUT and DELETE not working in web2py?

2013-09-19 Thread Derek
Should work, what do you have in your log for when you sent the options 
header?

On Thursday, September 19, 2013 6:59:23 AM UTC-7, Thirugnanam Kaneshalingam 
wrote:

 We are having some issue with Cross Origin Resource Sharing (CORS) 
 implementation in a restfull web service on web2py.
 We try to implement CORS on the server side in web2py as suggested here: ( 
 https://groups.google.com/forum/#!msg/web2py/kSUtyNcUQGI/qfiIqfUiWLwJ )
 we added following to models/0.py, (to have the response header updated 
 before actual restfull api handler in the controler)

 ===
 if request.env.http_origin:
 #response 
 https://www.facebook.com/hashtag/response.headers['Access-Control-Allow-Origin']
  
 = request.env.http_origin
 response.headers['Access-Control-Allow-Origin'] = *
 response.headers['Access-Control-Allow-Credentials'] = 'true'
 response.headers['Access-Control-Max-Age'] = 86400

 if request.env.request_method == 'OPTIONS':
 if request.env.http_access_control_request_method:
 print request.env.http_access_control_request_method
 response.headers['Access-Control-Allow-Methods'] = 
 request.env.http_access_control_request_method
 if request.env.http_access_control_request_headers:
 response.headers['Access-Control-Allow-Headers'] = 
 request.env.http_access_control_request_headers
 ==

 RESTful POST  GET are now working
 but PUT and DELETE aren't because preflight http OPTIONS request is 
 rejected as 400 BAD REQUEST by web2py

 So for example when calling the restful webservice using ajax call from a 
 local web page,
 we get the following error msg in NetBeans log.

 Failed to load resource: the server responded with a status of 400 (BAD 
 REQUEST) (10:46:36:182 | error, network)
 at 
 http://127.0.0.1:8000/test/default/api/entries/2.jsonhttps://www.facebook.com/l.php?u=http%3A%2F%2F127.0.0.1%3A8000%2Ftest%2Fdefault%2Fapi%2Fentries%2F2.jsonh=6AQEXO762AQEdGBr1FA5hs7g-rkoOuV3j_Ls67igLa1ysWws=1
 Failed to load resource: Origin http://localhost:8383 is not allowed by 
 Access-Control-Allow-Origin. (10:46:36:183 | error, network)
 at 
 http://127.0.0.1:8000/test/defaulthttps://www.facebook.com/l.php?u=http%3A%2F%2F127.0.0.1%3A8000%2Ftest%2Fdefaulth=SAQHZ1uIiAQF-DetwOo02m0brzq8JFqvX0khT8_XL5fZhqgs=1
 /api/entries/2.json
 XMLHttpRequest cannot load http://127.0.0.1:8000/test/default
 /api/entries/2.json. Origin http://localhost:8383 is not allowed by 
 Access-Control-Allow-Origin. (10:46:36:183 | error, javascript)
 at www/page/test.html


-- 
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: Site does not remember users (auth.settings.long_expiration) after 2.6.3 update?

2013-09-19 Thread Massimo Di Pierro
Can you try the current trunk?

On Thursday, 19 September 2013 16:41:58 UTC-5, Massimo Di Pierro wrote:

 This could be related. We will look into this asap.

 On Thursday, 19 September 2013 14:33:24 UTC-5, Andriy wrote:


 https://lh4.googleusercontent.com/-RVjcMzxgrZ0/UjtQm6n1Z_I/ABQ/9Gz8fpkeGSw/s1600/cookie.jpg
 My site and forum was running fine for 5 month now. Yesterday, I updated 
 from version 2.4 (or 2.5, I don`t remember for sure which it was) to 
 version 2.6.3. I did what change log says and copied static/js/web2py.js, 
 controllers/appadmin.py, and views/appadmin.html from the welcome app to my 
 app. Everything appeared to run fine. But today users start complaining 
 that site does not remember them even if they check remember me for 90 
 days on login. I checked myself and indeed, if I log out, log in, close 
 browser and than open it, I`m not logged in to site.
 I have auth.settings.long_expiration = 3600*24*90 line in db.py, it was 
 working before.
 I checked received cookie in Opera and noticed, that *expires* fields 
 are blank:



 Can this be the reason? If yes, is this some bug in 2.6.3 release? If not 
 I have no knowledge what it may be, and ask for help, where to look for 
 trouble. Thank you.
 Also I noticed another thread mentioning change in cookies handling - 
 https://groups.google.com/forum/#!topic/web2py/Ju0LIa35de4 May be this 
 is related?



 https://lh4.googleusercontent.com/-RVjcMzxgrZ0/UjtQm6n1Z_I/ABQ/9Gz8fpkeGSw/s1600/cookie.jpg



-- 
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] pluralization system problem

2013-09-19 Thread Massimo Di Pierro
Can I close the ticket?

On Thursday, 19 September 2013 15:19:21 UTC-5, mcamel wrote:

 It works!

 Thanks.


 El jueves, 19 de septiembre de 2013 22:05:31 UTC+2, dbdeveloper escribió:

  Use%%{word(%i)} to avoid printing the number:

 T('%%{object(%i)}', 2, language=es)  or T('%%{object(%s)}', 2, 
 language=es)



-- 
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: PUT and DELETE not working in web2py?

2013-09-19 Thread Bernard Letourmy
Workaround found.
After digging a little bit more yesterday,  we found out the restful 
Request handler in gluon/globals.py actually filtered the OPTIONS http verb.
Rejecting it with a 400 http exception. Thus the CORS preflight request 
sent by the browser never reached our code in controller.
The browser getting an error when sending OPTIONS request (with the 
Access-Control-Request-Method=PUT header for ex.) considers the Cross 
origin PUT request is not allowed and then never proceed with the actual 
PUT.

So here is what we did:
- In globals.py (v 2.5.1 but also applies to 2.6.3)

diff globals.py ~/git/web2py/gluon/globals.py
153,154c152,153

 if not method in ['GET', 'POST', 'DELETE', 'PUT', 
'OPTIONS']:
 raise HTTP(400, invalid method)
---
 if not method in ['GET', 'POST', 'DELETE', 'PUT']:
 raise HTTP(400, invalid method)



Then in our controller added handler for the OPTIONS verb also

@request.restful()
def rest():
#import pdb;pdb.set_trace()
response.view = 'generic.'+request.extension
def GET(*args,**vars):
patterns = 'auto'
parser = db.parse_as_rest(patterns,args,vars)
if parser.status == 200:
return dict(content=parser.response)
else:
raise HTTP(parser.status,parser.error)
def POST(table_name,**vars):
return db[table_name].validate_and_insert(**vars)
def PUT(table_name,record_id,**vars):
return db(db[table_name]._id==record_id).update(**vars)
def DELETE(table_name,record_id):
print DELETE called
return db(db[table_name]._id==record_id).delete()
def OPTIONS(*args,**vars):
print OPTION called
return True

return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE, OPTIONS=OPTIONS) 



Any suggestion of how to do without patching web2py, wsgi middleware maybe 
 ?

How about implementing CORS support in a more generic way in web2py ?

Thanks
Bernard (Kanesh's colleague)

-- 
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: PUT and DELETE not working in web2py?

2013-09-19 Thread Massimo Di Pierro
Ok. In trunk, I relaxed the list of possible REST methods. I am not sure 
this is the right solution.

Is there a comprehensive list of all possible REST methods somewhere?

massimo


On Thursday, 19 September 2013 21:13:08 UTC-5, Bernard Letourmy wrote:

 Workaround found.
 After digging a little bit more yesterday,  we found out the restful 
 Request handler in gluon/globals.py actually filtered the OPTIONS http verb.
 Rejecting it with a 400 http exception. Thus the CORS preflight request 
 sent by the browser never reached our code in controller.
 The browser getting an error when sending OPTIONS request (with the 
 Access-Control-Request-Method=PUT header for ex.) considers the Cross 
 origin PUT request is not allowed and then never proceed with the actual 
 PUT.

 So here is what we did:
 - In globals.py (v 2.5.1 but also applies to 2.6.3)

 diff globals.py ~/git/web2py/gluon/globals.py
 153,154c152,153

  if not method in ['GET', 'POST', 'DELETE', 'PUT'
 , 'OPTIONS']:
  raise HTTP(400, invalid method)
 ---
  if not method in ['GET', 'POST', 'DELETE', 'PUT']:
  raise HTTP(400, invalid method)



 Then in our controller added handler for the OPTIONS verb also

 @request.restful()
 def rest():
 #import pdb;pdb.set_trace()
 response.view = 'generic.'+request.extension
 def GET(*args,**vars):
 patterns = 'auto'
 parser = db.parse_as_rest(patterns,args,vars)
 if parser.status == 200:
 return dict(content=parser.response)
 else:
 raise HTTP(parser.status,parser.error)
 def POST(table_name,**vars):
 return db[table_name].validate_and_insert(**vars)
 def PUT(table_name,record_id,**vars):
 return db(db[table_name]._id==record_id).update(**vars)
 def DELETE(table_name,record_id):
 print DELETE called
 return db(db[table_name]._id==record_id).delete()
 def OPTIONS(*args,**vars):
 print OPTION called
 return True
 
 return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE, OPTIONS=
 OPTIONS) 



 Any suggestion of how to do without patching web2py, wsgi middleware maybe 
  ?

 How about implementing CORS support in a more generic way in web2py ?

 Thanks
 Bernard (Kanesh's colleague)


-- 
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: Site does not remember users (auth.settings.long_expiration) after 2.6.3 update?

2013-09-19 Thread Andriy
Yes. I 
installed http://www.web2py.com/examples/static/nightly/web2py_src.zip 
(this is latest?) and can not replicate problem now. Site remembers me 
every time so far and cookie has right expires data. Thank you very much, 
Massimo! If something goes wrong during the day (days) I`ll post here.



-- 
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.