[web2py] web2py website error with Chinese user

2014-10-23 Thread Gael Princivalle
Hello all.

I've got a Chinese user that complains he cannot login in a web2py website 
that I've done.
He send me a printscreen where all CSS and Javascript are not loaded, so he 
can't login.
If he use a VPN it's ok.

Someone know why ? Perhaps it's due to Chinese network restrictions ?

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/d/optout.


[web2py] limit on username length without defining db.auth_user ?

2014-10-23 Thread LoveWeb2py
Hello -- simple question. Is it possible to set a username length with 

db.auth_user.username.requires = length 20

Something to that effect? By default users can create as long of a username 
as they want and I'd like to make it a little more secure. The book 
mentions redefining the auth.user table but I was wondering if there is a 
built-in dal method I could use in db.py

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


[web2py] Re: Access DAL from outside script

2014-10-23 Thread Richard
Solved :)

Mistake was the missing closing \\ in the database folder.
The working version is module_path = 
os.path.abspath(os.path.dirname('C:\\web2py\\applications\\wemanops_test\\databases\\'))

Thank you

On Wednesday, October 22, 2014 4:58:59 PM UTC+2, Richard wrote:

 Hi,

 I want to access an existing database from an outside web2py app script 
 because the database must be input to Orange for data mining.

 I tried the following defining but dot not get access top the data:

 import os

 import sys

 import datetime

 import calendar

 from datetime import date, time

 import json

 import uuid

 sys.path.append(c:\python27\web2py)


 from gluon.sql import *

 from gluon.validators import *


 module_path = 
 os.path.abspath(os.path.dirname('C:\\web2py\\applications\\wemanops_test\\databases'))

 db_name='storage.sqlite'


 db = DAL('sqlite://storage.sqlite', pool_size=1, folder=module_path, 
 migrate=False, check_reserved=['all'])


 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate

 auth = Auth(db)


 db.define_table('langu',

 Field('langu', 'string'),

 format='%(langu)s'

 )


 db.define_table('community',

 Field('com_name', 'string', length=15),

 Field('address', 'string'),

 Field('responsible', 'string'),

 Field('latitude', 'string', default=None),

 Field('longitude', 'string', default=None),

 #User creation can not beadded because mutial dependence of the auth Class

 Field('created_date', 'datetime', default=datetime.datetime.now()),

 format='%(com_name)s'

 )


 auth.define_tables(username=True, signature=True, migrate=False)


 print db(db.langu.id0).select()


 The error I get is:

 Traceback (most recent call last):

 File console, line 1, in module

 File string, line 22, in module

 File c:\python27\web2py\gluon\tools.py, line 1268, in __init__

 request = current.request

 AttributeError: 'thread._local' object has no attribute 'request'


 What is missing? 



-- 
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/d/optout.


Re: [web2py] Re: We could have something like this

2014-10-23 Thread António Ramos
are you refering to web2pyslices ?
*But the main difference I see is the dated layout, design and UX.*
*It is a nice tool but already needs a refresh.*

If yes i agree with you.

2014-10-21 20:41 GMT+01:00 Carlos Costa yamandu.co...@gmail.com:

 It does not the same thing but it does.

 It was intend to keep recipes, but one can post links to anything too.
 Thinking this way it is even better than meteorhelp.

 But the main difference I see is the dated layout, design and UX.
 It is a nice tool but already needs a refresh.

 2014-10-21 11:23 GMT-02:00 António Ramos ramstei...@gmail.com:

 differs in the fact that its not only for recipes

 i can see where to find videos, faqs, books etc as listed in the left

 Also reviews from users are nice.
 Maybe web2py slices does the same thing but its not clear for occasionaly
 users/readers

 regards



 2014-10-20 23:39 GMT+01:00 Dave S snidely@gmail.com:



 On Monday, October 20, 2014 2:41:26 PM UTC-7, Ramos wrote:

 it was not a question.
 we know everything is possible.

 Its just that finding info about web2py are sometimes dificult

 A site like this could help and also rate the source of info.


 In what way do you see it as being different web2pyslices?

 /dps




 Regards

 2014-10-20 22:37 GMT+01:00 Derek sp1...@gmail.com:

 Is that a question? Are you asking if you can build a site like that?
 I don't see why not. In fact, instantpress almost meets your needs, though
 you might want to customize the theme a bit.

 On Monday, October 20, 2014 3:12:29 AM UTC-7, Ramos wrote:

 http://meteorhelp.com/

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


  --
 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/d/optout.


  --
 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/d/optout.




 --


 Carlos J. Costa
 Cientista da Computação  | BS Computer Science
 Esp. Gestão em Telecom   | PgC Telecom Mangement
 º))

 --
 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/d/optout.


-- 
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/d/optout.


[web2py] language and localization development

2014-10-23 Thread Manuele Pesenti
Hi,
maybe I'm wrong but it seams that during development I have to write
messages in english using the translator and than write the
corresponding translation in language file I intend to use. Is these a
way of using another language during development maybe identifying it
every times I use T e.g.

T('qualcosa', lang='it')
^^^ (just an example I know it's not supported
that way)

and then provide the english (or what else) translation?

I hoper I've been clear enough :)
thank you very mutch

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/d/optout.


Re: [web2py] Re: db.commit() taking too long to update records

2014-10-23 Thread Luciano Laporta Podazza
Hi Anthony!,

Indeed, the ajax call was the issue, after reading this:
http://web2py.com/books/default/chapter/29/04#session
I realised that storing sessions in database solved my problem(there's no
more blocking calls issue).

Thanks a lot for your help

Cheers.

On Thu, Oct 23, 2014 at 1:01 AM, Anthony abasta...@gmail.com wrote:

 Instead of checking the timings in the console, check the timings during
 the actual Ajax request (maybe return the timings in some HTML and display
 it in the browser instead of just returning OK; or print the timings to
 the console).

 Are there any other Ajax requests that get fired before this one that
 could be causing a delay? If you are using file based sessions, a prior
 Ajax request would block a new request while waiting for the session file
 to be unlocked (unless you call session.forget(response)).

 Anthony


 On Wednesday, October 22, 2014 9:30:50 PM UTC-4, Luciano Laporta Podazza
 wrote:

 Hi Niphlod,

 I did what you say and if I try doing the query through console it works
 perfectly and fast:

  db._timings

 [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET
 sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328)]

  db((db.alerts.alerts_id==1)(db.alerts.archived != True)).update(
 archived=True, crime=Robo, operator_id=1)

 23

  db._timings

 [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET
 sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328), (UPDATE
 alerts SET archived='T',operator_id=1,crime='Robo' WHERE
 ((alerts.alerts_id = 1) AND (alerts.archived  'T'));,
 0.010937213897705078)]

  db.commit()

  db._timings

 [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET
 sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328), (UPDATE
 alerts SET archived='T',operator_id=1,crime='Robo' WHERE
 ((alerts.alerts_id = 1) AND (alerts.archived  'T'));,
 0.010937213897705078)]

 But again, if I try sending the ajax request(a simple one, really), it
 gets stucked as I mentioned before, then after 20-30seconds the record gets
 updated.

 I'm using MySQL 5.5 with less than 50 records on the affected table.

 Any help will be appreciated. Thanks

 On Wednesday, September 10, 2014 6:20:47 AM UTC-3, Niphlod wrote:

 BTW, log somewhere db._timings before returning and try to replay the
 query in mysql to see what's going on.

 On Wednesday, September 10, 2014 12:54:03 AM UTC+2, Leonel Câmara wrote:

 Well that's true, but web2py automatically calls db.commit for you
 after running the controller. That would not cause the slowdown anyway.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/6z13PTcZ5io/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/d/optout.




-- 
Atte
Luciano Laporta Podazza

-- 
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/d/optout.


[web2py] Re: language and localization development

2014-10-23 Thread Paolo Valleri
Hi,
try

T.set_current_languages('it')

see 
http://web2py.com/books/default/chapter/29/04/the-core#Determining-the-language

Paolo

On Thursday, October 23, 2014 1:47:11 PM UTC+2, Manuele wrote:

 Hi, 
 maybe I'm wrong but it seams that during development I have to write 
 messages in english using the translator and than write the 
 corresponding translation in language file I intend to use. Is these a 
 way of using another language during development maybe identifying it 
 every times I use T e.g. 

 T('qualcosa', lang='it') 
 ^^^ (just an example I know it's not supported 
 that way) 

 and then provide the english (or what else) translation? 

 I hoper I've been clear enough :) 
 thank you very mutch 

 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/d/optout.


[web2py] Re: language and localization development

2014-10-23 Thread Leonel Câmara
You can do what Paolo suggested, it will work.  
  
I'd like to make a suggestion though - Don't do this.

For me, everything that's in the code should be in English, variable names, 
strings like this one, comments, every single thing. For many reasons, it 
looks better, you don't tire your brain by switching languages while 
reading the code, if you ask questions on the internet or if one day it 
gets open sourced it's easier for people from other nationalities to 
understand your code. It's also cool that your clients always get their 
applications localized for English for free if they want it.

-- 
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/d/optout.


Re: [web2py] Re: db.commit() taking too long to update records

2014-10-23 Thread Anthony
Keep in mind that the benefit of locking the session is that you avoid race 
conditions, so you now have to make sure there is no possibility of a race 
condition with the session if you have multiple calls happening 
asynchronously. The other option is to continue using file base sessions, 
but call session.forget(response) in any request that doesn't need the 
session.

Anthony

On Thursday, October 23, 2014 8:16:06 AM UTC-4, Luciano Laporta Podazza 
wrote:

 Hi Anthony!,

 Indeed, the ajax call was the issue, after reading this: 
 http://web2py.com/books/default/chapter/29/04#session
 I realised that storing sessions in database solved my problem(there's no 
 more blocking calls issue).

 Thanks a lot for your help

 Cheers.

 On Thu, Oct 23, 2014 at 1:01 AM, Anthony abasta...@gmail.com wrote:

 Instead of checking the timings in the console, check the timings during 
 the actual Ajax request (maybe return the timings in some HTML and display 
 it in the browser instead of just returning OK; or print the timings to 
 the console).

 Are there any other Ajax requests that get fired before this one that 
 could be causing a delay? If you are using file based sessions, a prior 
 Ajax request would block a new request while waiting for the session file 
 to be unlocked (unless you call session.forget(response)).

 Anthony


 On Wednesday, October 22, 2014 9:30:50 PM UTC-4, Luciano Laporta Podazza 
 wrote:

 Hi Niphlod,

 I did what you say and if I try doing the query through console it works 
 perfectly and fast:

  db._timings 

 [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET 
 sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328)] 

  db((db.alerts.alerts_id==1)(db.alerts.archived != True)).update(
 archived=True, crime=Robo, operator_id=1) 

 23 

  db._timings 

 [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET 
 sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328), (UPDATE 
 alerts SET archived='T',operator_id=1,crime='Robo' WHERE 
 ((alerts.alerts_id = 1) AND (alerts.archived  'T'));, 
 0.010937213897705078)] 

  db.commit() 

  db._timings 

 [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET 
 sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328), (UPDATE 
 alerts SET archived='T',operator_id=1,crime='Robo' WHERE 
 ((alerts.alerts_id = 1) AND (alerts.archived  'T'));, 
 0.010937213897705078)]

 But again, if I try sending the ajax request(a simple one, really), it 
 gets stucked as I mentioned before, then after 20-30seconds the record gets 
 updated.

 I'm using MySQL 5.5 with less than 50 records on the affected table.

 Any help will be appreciated. Thanks

 On Wednesday, September 10, 2014 6:20:47 AM UTC-3, Niphlod wrote:

 BTW, log somewhere db._timings before returning and try to replay the 
 query in mysql to see what's going on.

 On Wednesday, September 10, 2014 12:54:03 AM UTC+2, Leonel Câmara wrote:

 Well that's true, but web2py automatically calls db.commit for you 
 after running the controller. That would not cause the slowdown anyway.

  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/6z13PTcZ5io/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/d/optout.




 -- 
 Atte
 Luciano Laporta Podazza
  

-- 
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/d/optout.


[web2py] SQLFORM. Insert field to DB from calculation (not from form)

2014-10-23 Thread Dmitry Vlasov
Hi folks,

I'm trying to insert additional field to DB, but it cannot be obtain from 
SQLFORM.
I use SOLIDGRID 
plugin 
http://dev.s-cubism.com/plugin_solidgrid?_signature=868375a5ca48f87805d4366b05a2df678637611e

For my purposes I define a table

db.define_table('r_users',
db.Field('username', 'string', requires=IS_NOT_EMPTY(), 
length=128, required=True),
db.Field('registered', 'boolean', required=True,
 default=False),
db.Field('email', 'string', requires = 
IS_EMAIL(error_message='invalid email!'),
 length=64, required=True),
db.Field('password', 'string', requires=IS_NOT_EMPTY(), 
length=255, required=True),
db.Field('ip', 'string', requires = IS_IPV4(), 
required=False, default='127.0.0.1'),
db.Field('modified_on', 'datetime', required=True),
db.Field('captcha_url', 'string', length=255, 
required=True),
migrate='r_users.table', fake_migrate=fake_migrate)


and add to plugin code invalidation method to calculate field that I cannot 
obtain from form (add to line 298):

def __onvalidation(form):
rs = self.callback(request.post_vars)
print request.post_vars
if rs.startswith('http'):
request.post_vars['captcha_url'] = rs

and assign this in the line 429

create_form = SOLIDFORM(virtualtable or table,
fields=create if type(create) in (list, tuple) else 
None,
showid=showid,
_class='web2py_form',
submit_button=T('Create'),
).process(  # next=referrer, for web2py-bug
  *onvalidation=__onvalidation,*
  onsuccess=oncreate,
  formname=formname)

This method added captcha_url field to request.post_vars successfully. But 
in DB there is no value.


This is the common problem, not only using this plug-in. I cannot do this 
trick while using SQLFORM only, without plug-in.
What I'm doing wrong? 

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/d/optout.


[web2py] reference auth_user from a table in one database to the auth_user table in another database

2014-10-23 Thread Carl Petersen
Hello,

I'm trying to reference the auth_user table in one database from a field 
definition for a table in a different database.  Hopefully the code below 
will clarify:

db1 = 
DAL('postgres://user:password@host1/database1',pool_size=1,check_reserved=None,migrate=False)
db = 
DAL('postgres://user:password@host/database',pool_size=1,check_reserved=['all'],migrate=False)

db1.executesql(set search_path to 'devxref','public';)
db.executesql(set search_path to 'po','xref','dw','public';)

*db*.define_table('x_vendor',
Field('source_vendor_dwid',db.d_supplier_source),
Field('source_vendor_id'),
Field('source_system_dwid',db.d_source),
Field('source_system_id'),
Field('gp_vendor_dwid',db.d_supplier_source),
Field('gp_vendor_id'),
Field('changed_date_time','datetime',
  default=request.now, update=request.now, writable=False),
Field('changed_user_id','reference *db1*.auth_user',
  default=auth.user_id, update=auth.user_id, writable=False),
format='%(x_vendor)s')

I get the following errors in the dump:

Traceback (most recent call last):
  File /opt/web-apps/web2py/gluon/restricted.py, line 224, in restricted
exec ccode in environment
  File /opt/web-apps/web2py/applications/wspg/controllers/x_vendor.py 
https://dc1ux544/admin/default/edit/wspg/controllers/x_vendor.py, line 127, 
in module
  File /opt/web-apps/web2py/gluon/globals.py, line 392, in lambda
self._caller = lambda f: f()
  File /opt/web-apps/web2py/applications/wspg/controllers/x_vendor.py 
https://dc1ux544/admin/default/edit/wspg/controllers/x_vendor.py, line 85, in 
add
if form.process().accepted:
  File /opt/web-apps/web2py/gluon/html.py, line 2303, in process
self.validate(**kwargs)
  File /opt/web-apps/web2py/gluon/html.py, line 2240, in validate
if self.accepts(**kwargs):
  File /opt/web-apps/web2py/gluon/sqlhtml.py, line 1671, in accepts
self.vars.id = self.table.insert(**fields)
  File /opt/web-apps/web2py/gluon/dal.py, line 9320, in insert
ret =  self._db._adapter.insert(self, self._listify(fields))
  File /opt/web-apps/web2py/gluon/dal.py, line 1354, in insert
query = self._insert(table, fields)
  File /opt/web-apps/web2py/gluon/dal.py, line 2903, in _insert
values = ','.join(self.expand(v, f.type) for f, v in fields)
  File /opt/web-apps/web2py/gluon/dal.py, line 2903, in genexpr
values = ','.join(self.expand(v, f.type) for f, v in fields)
  File /opt/web-apps/web2py/gluon/dal.py, line 1555, in expand
return str(self.represent(expression, field_type))
  File /opt/web-apps/web2py/gluon/dal.py, line 3079, in represent
return BaseAdapter.represent(self, obj, fieldtype)
  File /opt/web-apps/web2py/gluon/dal.py, line 2016, in represent
ftype = self.db[p[0]][p[2]].type
  File /opt/web-apps/web2py/gluon/dal.py, line 8512, in __getitem__
return self.__getattr__(str(key))
  File /opt/web-apps/web2py/gluon/dal.py, line 8522, in __getattr__
return ogetattr(self, key)
AttributeError: 'DAL' object has no attribute 'db1'



Any assistance would be greatly appreciated.

Thanks!

Carl

-- 
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/d/optout.


[web2py] Re: How can I prevent a user from pressing the browser's back button?

2014-10-23 Thread Fotis Gioulekas
Thank you very much for the feedback. I will check and let you know about 
the results.
best regards,
F

On Friday, October 17, 2014 9:49:31 PM UTC+3, Dave S wrote:



 On Thursday, October 16, 2014 12:15:26 AM UTC-7, Fotis Gioulekas wrote:

 Hello, do you how is this possible to be performed? The user is not 
 logged in. 


 A session should exist whether the user is logged in or not.

 One way to implement this, in the controller that presents the page for 
 the quiz question,  would be to add the question to a list stored in the 
 session variable.  But the controller would also be checking if that page 
 was already in the list.  Something like:

 questioncontroller:
thispage = request.vars.page
if thispage in session.pagelist:
  redirect(somewhereelse)
session.pagelist.add(thispage)
question=SQLFORM(etc)
return(question)



 Sorry, that's very sketchy because I haven't yet actually used all of what 
 I have read in the book.

 /dps


 On Saturday, August 30, 2014 5:28:20 PM UTC+3, Anthony wrote:

 The details will depend on exactly how you want to control access to 
 quiz questions, but the general solution would be to store the user state 
 in the session, and when a particular page/question is requested, check the 
 session, and redirect elsewhere if the session check fails.

 Anthony

 On Tuesday, August 26, 2014 5:36:45 PM UTC-4, Fotis Gioulekas wrote:

 Hello to everybody,

 I have built a quiz that randomlycreates questions.
 Each time a user submits it's answer, the app redirects to another 
 question.
 When the user does not want to continue to another question it presses 
 a button exit quiz and the app redirects to another url.
 When the user presses the browser's back button, it can return back to 
 the quiz. 
 How can I prevent this?
 Is there a solution that either closes the browser's tab or redirects 
 to a default html page when the user presses the back broswer's button or 

 My app does not requires user registratrion and login.

 Thank you in advance,
 Fotios



-- 
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/d/optout.


[web2py] Re: SAML2 Service Provider app in web2py?

2014-10-23 Thread Massimo Di Pierro
Yes it works for me. Can you help debug? Can you print d['response'] and 
try figure out where the response attributes are?

On Friday, 17 October 2014 00:42:29 UTC-5, Prasad Muley wrote:

 Hi Wel,
Did you test SAML2 app? there is an experimental saml2 app in 
 web2py_2.9.6
  
I need to use saml2(web2py app) as service provider with onelogin 
 (which is idp) 

 I am getting an error (Screen shot is attached PFA).


 here is my config settings
 1) *private/sp_conf.py*

 # Make sure the same port number appear in service_conf.py
 BASE = http://localhost:8000;
 APPNAME = saml2
 PATH = /home/prasad/Prasad/web2py_2.9.6_beta/applications/saml2/private/
 CONFIG = {
 entityid: %s/saml2/static/sp.xml % BASE,
 'entity_category': [COC],
 accepted_time_diff: 5, # very important
 description: Example SP,
 service: {
 sp: {
 endpoints: {
 assertion_consumer_service: [
 (%s/%s/default/user/login % (BASE, APPNAME), 
 BINDING_HTTP_REDIRECT),
 ],
 }
 },
 },
 key_file: %s/pki/mykey.pem % PATH,
 cert_file: %s/pki/mycert.pem % PATH,
 xmlsec_binary: xmlsec_path,
 metadata: {local: [PATH+idp.xml]},
 name_form: NAME_FORMAT_URI,
 }
  
 Here I've copied *assertion_consumer_service url *(
 http://localhost:8000/saml2/default/login ) in onelogin's app's SAML 
 consumer url

 2) I've downloaded a meta data file from onelogin app.
   copy  it to 

 *saml/private/*3) Created a *static/sp.xml file *as 
 make_metadata.py sp_conf  ../static/sp.xml

 4) Ran web2py server

 * (python webpy.py)*5) Selected SAML2 app through administrator interface,

 6) Clicked on login tab and
It is redirecting to onelogin app's login window.

 7) Entered username and password in onelogin app
 It it redirecting me to http://localhost:8000/saml2/default/login (which 
 is a assertion consumer url)

 and I am getting an internal error .

 type 'exceptions.AttributeError' 'dict' object has no attribute 
 'assertion'
 Let me know If there are wrong settings in my app.

 Could you share your app settings (including web2py app and idp settings)


 On Thursday, August 21, 2014 7:35:29 PM UTC+5:30, Wei Wang wrote:

 I have the need to use a SAML2 identity provider (specifically, a NetIQ 
 product) for authentication and authorization in some web2py apps.

 I searched in this group, also googled web2py and SAML, but did not 
 find anything that seems readily available.

 My thoughts on building a Service Provider (in SAML2 terminology) app 
 in web2py alongside other apps:

- The SAML2 service provider would be /saml2sp:
   - The saml2sp app communicates to the SAML2 Id provider for 
   authentication and authorization;
   - A web2py app is configured to use cas_auth, with 
localhost/saml2sp as the CAS server base URL;

 Does something like this exist? Does that sound reasonable?

 Thanks for any pointers, comments, thoughts.

 Wei



-- 
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/d/optout.


[web2py] Re: plugin_jstree - ImportError: No module named globals

2014-10-23 Thread Massimo Di Pierro
can you try replace

from globals import Response, Storage

with

from gluon.globals import Response, Storage

On Tuesday, 21 October 2014 08:20:11 UTC-5, Alen Cerovic wrote:

 I am getting error with plugin_jstree on windows:

 Traceback (most recent call last):
   File gluon/restricted.py, line 224, in restricted
   File 
 C:/mediacom/mediacom/Development/web2py/web2py_win/web2py/applications/staff/controllers/plugin_jstree.py,
  
 line 49, in module
   File gluon/globals.py, line 392, in lambda
   File 
 C:/mediacom/mediacom/Development/web2py/web2py_win/web2py/applications/staff/controllers/plugin_jstree.py,
  
 line 47, in index
 return dict(tree_block=DIV(jstree(), _style='width:500px;'))
   File applications\staff\modules\plugin_jstree.py, line 174, in __call__
 from globals import Response, Storage
   File gluon/custom_import.py, line 92, in custom_importer
 ImportError: No module named globals

  
 please help


-- 
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/d/optout.


[web2py] Re: reference auth_user from a table in one database to the auth_user table in another database

2014-10-23 Thread Niphlod
you can't reference fields from different databases. 

On Thursday, October 23, 2014 3:07:50 PM UTC+2, Carl Petersen wrote:

 Hello,

 I'm trying to reference the auth_user table in one database from a field 
 definition for a table in a different database.  Hopefully the code below 
 will clarify:

 db1 = 
 DAL('postgres://user:password@host1/database1',pool_size=1,check_reserved=None,migrate=False)
 db = 
 DAL('postgres://user:password@host/database',pool_size=1,check_reserved=['all'],migrate=False)

 db1.executesql(set search_path to 'devxref','public';)
 db.executesql(set search_path to 'po','xref','dw','public';)

 *db*.define_table('x_vendor',
 Field('source_vendor_dwid',db.d_supplier_source),
 Field('source_vendor_id'),
 Field('source_system_dwid',db.d_source),
 Field('source_system_id'),
 Field('gp_vendor_dwid',db.d_supplier_source),
 Field('gp_vendor_id'),
 Field('changed_date_time','datetime',
   default=request.now, update=request.now, writable=False),
 Field('changed_user_id','reference *db1*.auth_user',
   default=auth.user_id, update=auth.user_id, writable=False),
 format='%(x_vendor)s')

 I get the following errors in the dump:

 Traceback (most recent call last):
   File /opt/web-apps/web2py/gluon/restricted.py, line 224, in restricted
 exec ccode in environment
   File /opt/web-apps/web2py/applications/wspg/controllers/x_vendor.py 
 https://dc1ux544/admin/default/edit/wspg/controllers/x_vendor.py, line 127, 
 in module
   File /opt/web-apps/web2py/gluon/globals.py, line 392, in lambda
 self._caller = lambda f: f()
   File /opt/web-apps/web2py/applications/wspg/controllers/x_vendor.py 
 https://dc1ux544/admin/default/edit/wspg/controllers/x_vendor.py, line 85, 
 in add
 if form.process().accepted:
   File /opt/web-apps/web2py/gluon/html.py, line 2303, in process
 self.validate(**kwargs)
   File /opt/web-apps/web2py/gluon/html.py, line 2240, in validate
 if self.accepts(**kwargs):
   File /opt/web-apps/web2py/gluon/sqlhtml.py, line 1671, in accepts
 self.vars.id = self.table.insert(**fields)
   File /opt/web-apps/web2py/gluon/dal.py, line 9320, in insert
 ret =  self._db._adapter.insert(self, self._listify(fields))
   File /opt/web-apps/web2py/gluon/dal.py, line 1354, in insert
 query = self._insert(table, fields)
   File /opt/web-apps/web2py/gluon/dal.py, line 2903, in _insert
 values = ','.join(self.expand(v, f.type) for f, v in fields)
   File /opt/web-apps/web2py/gluon/dal.py, line 2903, in genexpr
 values = ','.join(self.expand(v, f.type) for f, v in fields)
   File /opt/web-apps/web2py/gluon/dal.py, line 1555, in expand
 return str(self.represent(expression, field_type))
   File /opt/web-apps/web2py/gluon/dal.py, line 3079, in represent
 return BaseAdapter.represent(self, obj, fieldtype)
   File /opt/web-apps/web2py/gluon/dal.py, line 2016, in represent
 ftype = self.db[p[0]][p[2]].type
   File /opt/web-apps/web2py/gluon/dal.py, line 8512, in __getitem__
 return self.__getattr__(str(key))
   File /opt/web-apps/web2py/gluon/dal.py, line 8522, in __getattr__
 return ogetattr(self, key)
 AttributeError: 'DAL' object has no attribute 'db1'



 Any assistance would be greatly appreciated.

 Thanks!

 Carl


-- 
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/d/optout.


[web2py] Re: web2py website error with Chinese user

2014-10-23 Thread Niphlod
who knows. Are you serving all assets from the same location as the site or 
not ?

On Thursday, October 23, 2014 8:15:22 AM UTC+2, Gael Princivalle wrote:

 Hello all.

 I've got a Chinese user that complains he cannot login in a web2py website 
 that I've done.
 He send me a printscreen where all CSS and Javascript are not loaded, so 
 he can't login.
 If he use a VPN it's ok.

 Someone know why ? Perhaps it's due to Chinese network restrictions ?

 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/d/optout.


[web2py] Re: RESTful request args/vars with JSON array

2014-10-23 Thread Niphlod
if the content-type of the POST request is application/json, mylist would 
actually be yet parsed into request.post_vars (i.e. you can skip 
body.read())

On Thursday, October 23, 2014 1:24:09 AM UTC+2, Henry Nguyen wrote:

 For posterity's sake, I was able to retrieve the array in the request body 
 by using:

 import json
 my_list = json.loads(request.body.read())

 and then iterating through the list items just like any other list. This 
 was taken from http://web2py.com/books/default/chapter/29/04#request 
 under request.body.

 Thanks for letting me know that request.restful() wouldn't parse it 
 automatically, Niphlod.

 Henry

 On Monday, October 13, 2014 12:25:54 PM UTC-7, Niphlod wrote:

 you have to code your own methods.

 On Sunday, October 12, 2014 11:32:23 PM UTC+2, Henry Nguyen wrote:

 I have a function in my controller decorated with the @request.restful() 
 decorator. I would like to be able to accept a JSON array of objects, 

 [{id: 1, new_value: 1},{id: 2, new_value: 2}]

 , on a POST, PUT, or DELETE. For example, I'd like the client to be able 
 to update a series of values on one request, as opposed to having to submit 
 multiple requests for each individual update. However, the args and vars 
 parameters being passed to the methods are empty when a request is sent 
 with the JSON payload above. Specifically, args only gets populated from 
 URL args and vars only get populated if the array is accompanied by a key, 
 such as in:

 {update: [{id: 1, new_value: 1},{id: 2, new_value: 2}]}

 While it certainly isn't too much trouble to include that initial key, I 
 was wondering if there's any way to retrieve the JSON objects from the 
 request without having to specify the key so that I could pass a simple 
 array instead?  

 Thank you ahead of time for any help.



-- 
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/d/optout.


[web2py] Re: EMAIL | IMAP + SMTP | Compose Email = Save as Draft + Send via SMTP

2014-10-23 Thread Massimo Di Pierro
This should help:

def index():
form = FORM(INPUT(_type='file', _id=files, _name=files, 
_multiple=True, _value='File test'),
INPUT(_type=submit)).process()
if form.accepted:
for item in form.vars.files:
print item.filename, item.file.read()
return dict(form=form)

On Wednesday, 22 October 2014 00:01:06 UTC-5, PRACHI VAKHARIA wrote:




  

 Dear Alan and Massimo,

 First, please look at this site:

 *http://www.html5rocks.com/en/tutorials/file/dndfiles/ 
 http://www.html5rocks.com/en/tutorials/file/dndfiles/*


 It shows how to upload and read multiple files directly using HTML5 *(and 
 JavaScript)*.
 It uses the *File API specification* from W3:

 http://www.w3.org/TR/file-upload/



 How to implement that in Web2Py for Email Composing with File Attachments?


 *Controller*


 def Composer():
 form = FORM http://localhost:8000/examples/global/vars/FORM(TABLE 
 http://localhost:8000/examples/global/vars/TABLE(
 TR http://localhost:8000/examples/global/vars/TR('Subject:', INPUT 
 http://localhost:8000/examples/global/vars/INPUT(_type='text', 
 _name='subject',
requires=IS_NOT_EMPTY 
 http://localhost:8000/examples/global/vars/IS_NOT_EMPTY())),
 TR http://localhost:8000/examples/global/vars/TR('Email To:', INPUT 
 http://localhost:8000/examples/global/vars/INPUT(_type='text', 
 _name='emailto', _multiple=,
requires=IS_EMAIL 
 http://localhost:8000/examples/global/vars/IS_EMAIL())),
 TR http://localhost:8000/examples/global/vars/TR('Save Draft?', 
 SELECT http://localhost:8000/examples/global/vars/SELECT('yes', 'no', 
 _name='savedraft',
requires=IS_IN_SET 
 http://localhost:8000/examples/global/vars/IS_IN_SET(['yes', 'no']))),
 TR http://localhost:8000/examples/global/vars/TR('Body', TEXTAREA 
 http://localhost:8000/examples/global/vars/TEXTAREA(_name='body',
value='Body of email')),
 *TR http://localhost:8000/examples/global/vars/TR( 'File', INPUT 
 http://localhost:8000/examples/global/vars/INPUT(_type='file', _id=files, 
 _name=files[], _multiple=, _value='File test')*
 * ),*TR http://localhost:8000/examples/global/vars/TR('', INPUT 
 http://localhost:8000/examples/global/vars/INPUT(_type='submit', 
 _value='EMAIL'))
 ))
 
 if form.process().accepted:
 response http://localhost:8000/examples/global/vars/response.flash 
 = 'Form accepted'
 
 if form.vars.savedraft:
 *## SAVE DRAFT on IMAP ##*
 draft_id = imapdb.Gmail_Drafts.insert(
 to=form.vars.emailto, subject=form.vars.subject, 
 content=form.vars.body, draft=True,
 *attachments = [ mail.Attachment( 
 form.vars.FILE.file.read(), filename=form.vars.FILE.filename ) ]*
 )
 response.flash = 'Email Saved'
 else:
 *## SEND Email by SMTP ##*
 mail.send(
   to = form.vars.emailto,
   subject = form.vars.subject,
   message = (form.vars.body, 'html' + form.vars.body + 
 '/html'),
   *attachments = [ mail.Attachment( 
 form.vars.FILE.file.read(), filename=form.vars.FILE.filename ) ]*
   )
 response.flash = 'Email Sent'

 elif form.errors:
 response http://localhost:8000/examples/global/vars/response.flash 
 = 'Errors in form'
 else:
 response http://localhost:8000/examples/global/vars/response.flash 
 = 'Compose Email'

 return dict(form=form) 





 *Questions*

- How to use   *input type='file', name=files[], multiple=*   to 
input files for Attachment to email?
- How to extract the required file attributes and append them directly 
into the mail message and attachment?
- If the HTML5 provides a means to input, read and upload files, why 
cannot we use that directly in web2py Email to read and attach multiple 
files?

  

 Please look into this and help implementing this.


 Thank you, very much.

 Gratefully, 

 *PRACHI V*






 _




-- 
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/d/optout.


[web2py] Removing password_two comment

2014-10-23 Thread Ruud Schroen
Hi guys,

I'm using a auth_register() form. Right now, the password_two field (the 
one that requires you to re-enter your password) shows a comment next to it 
saying  you need to re-enter your password  or something.
Now I want to remove that comment using the following:

*db.auth_user.password_two.comment = None*

or

*db.auth_user.password_two.comment = ''*

However, I get the following error:

AttributeError: 'Table' object has no attribute 'password_two'


What should I do?

-- 
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/d/optout.


[web2py] Re: SSL configuration with built-in server

2014-10-23 Thread Massimo Di Pierro
1)

web2py.py -L options.py

will read the configuration from a options.py file. An example is in 
examples/options_std.py 

2) 

Yes. All pages will require https.



On Wednesday, 22 October 2014 11:18:12 UTC-5, John Lofgren wrote:

 Hi, all,

 I would like to configure web2py to use SSL with the built-in web server. 
 The examples I have found (e.g. 
 http://www.web2py.com/AlterEgo/default/show/140) show to pass the cert 
 and key on the command line with the -c and -k options. So, two questions:

 1) Is there a way to set the cert and key in a configuration file instead? 
 2) When I set the cert and key, does that turn on SSL for every page 
 automatically?

 Thanks,
 John


-- 
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/d/optout.


[web2py] Re: Removing password_two comment

2014-10-23 Thread Ruud Schroen
Found the solution. 

*form.custom.comment.password_two = None*


-- 
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/d/optout.


[web2py] Re: Correction for setup-web2py-heroku.sh script

2014-10-23 Thread Massimo Di Pierro
It is a matter of preference but I think you are right. Your approach is 
best.


On Wednesday, 22 October 2014 14:31:09 UTC-5, Jay Martin wrote:

 Currently the setup-web2py-heroku.sh script includes these commands:


 sudo pip install virtualenv
 sudo pip install psycopg2
 virtualenv venv --distribute
 source venv/bin/activate
 pip freeze  requirements.txt


 Shouldn't we want to install psycopg2 into the virtualenv named venv by 
 moving the psycopg2 install command after venv is created? Like so:


 sudo pip install virtualenv
 virtualenv venv --distribute
 source venv/bin/activate
 sudo pip install psycopg2
 pip freeze  requirements.txt


 My best,

 Jay


-- 
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/d/optout.


[web2py] Re: working directory and runtime directory when running web2py

2014-10-23 Thread Massimo Di Pierro
Thank you David and Niphlod.

On Wednesday, 22 October 2014 15:52:55 UTC-5, Niphlod wrote:

 nice catch. https://github.com/web2py/web2py/pull/535

 On Wednesday, October 22, 2014 10:48:40 PM UTC+2, David Ripplinger wrote:

 Yep, it works. Good job.

 On Wednesday, October 22, 2014 4:41:31 PM UTC-4, Niphlod wrote:

 got the issue, reproduced it, fixed it. I forgot about web2py.exe not 
 being actually web2py.py recompiled but a loader that decompresses 
 library.zip and loads the modules. This is a complete rebuild on 2.9.11 
 with the fix. 
 https://www.dropbox.com/s/jmdy2qtt71i0snb/web2py_win.zip?dl=0

 On Wednesday, October 22, 2014 10:27:33 PM UTC+2, David Ripplinger wrote:

 Here's some more information. You may have already figured this out, 
 but just in case it helps:

 When I run web2py.exe from a different directory, that directory also 
 gets populated with new, empty folders such as 'applications' and 
 'site-packages'. This, along with the error message about not finding the 
 version (which I assume is in the file 'VERSION'), makes me believe that 
 web2py.exe has a runtime directory matching the working directory from 
 which it gets called. What it needs in order to not be broken is to have 
 the runtime directory be 'web2py', where web2py.exe is located.

 On Wednesday, October 22, 2014 4:26:01 PM UTC-4, Niphlod wrote:

 whoopsy. it needs also the corresponding library.zip. stay tuned, I'll 
 try to make something against 2.9.11.

 On Wednesday, October 22, 2014 10:12:34 PM UTC+2, David Ripplinger 
 wrote:

 Tried it. It does the same thing. Sorry.

 On Wednesday, October 22, 2014 4:01:32 PM UTC-4, Niphlod wrote:

 try this instead 
 https://www.dropbox.com/s/jd4oxlilmel8ghz/web2py.exe?dl=0

 On Wednesday, October 22, 2014 9:03:34 PM UTC+2, Niphlod wrote:

 uhm. they should behave in the same way. investigating...

 On Wednesday, October 22, 2014 6:11:56 PM UTC+2, David Ripplinger 
 wrote:

 I recently discovered there are a couple things about the working 
 directory and the runtime directory when running web2py.

- If you launch python web2py.py in Linux from a working 
directory other than web2py, the runtime directory is web2py 
 and not 
your working directory. This works fine, but it means we have to 
 keep that 
in mind when adding other arguments to the command which point to 
 files.
- If you launch web2py.exe in Windows from a working directory 
other than web2py, it doesn't work. It gives the error 
 RuntimeError: 
Cannot determine web2py version.

 I'm not sure if the 2nd point should be considered a bug in web2py 
 or a desired restriction on how it is executed, but in either case, I 
 suggest these particular points be mentioned in the book in this 
 section 
 http://www.web2py.com/books/default/chapter/29/03/overview#Startup
 .

 What do you all think?



-- 
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/d/optout.


[web2py] Re: limit on username length without defining db.auth_user ?

2014-10-23 Thread Massimo Di Pierro
db.auth_user.username.requires = IS_LENGTH(20)

you can specify a min length and max length.

On Thursday, 23 October 2014 01:43:34 UTC-5, LoveWeb2py wrote:

 Hello -- simple question. Is it possible to set a username length with 

 db.auth_user.username.requires = length 20

 Something to that effect? By default users can create as long of a 
 username as they want and I'd like to make it a little more secure. The 
 book mentions redefining the auth.user table but I was wondering if there 
 is a built-in dal method I could use in db.py


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


[web2py] Re: SSL configuration with built-in server

2014-10-23 Thread Niphlod


On Thursday, October 23, 2014 4:20:02 PM UTC+2, Massimo Di Pierro wrote:

 1)

 web2py.py -L options.py

 will read the configuration from a options.py file. An example is in 
 examples/options_std.py 

 2) 

 Yes. All pages will require https.

 uhm, not really. Depends on the options passed, and surely without app 
code involved in it it won't force http to https automatically if both are 
available. 

@john: if you need https for everything, just DON'T allow http (i.e. set 
interfaces to [('0.0.0.0',443,'ssl_private_key.pem','ssl_certificate.pem')])

-- 
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/d/optout.


[web2py] Re: Slower task scheduler performance

2014-10-23 Thread Niphlod
if you have a function that launches an external process and it takes 2.55 
seconds, it will take the same when launched via the scheduler. The 
scheduler adds up the time it takes to create the web2py env (usually far 
less than half a second) in which the function is executed, but your 
external process needs to take the same amout of time in either way. 

On Wednesday, October 22, 2014 5:21:43 PM UTC+2, Carolina Nogueira wrote:

 Hey guys, 

 I have a performance question about the scheduler. My script is in python3 
 and when I run directly on a terminal, I have a response time about 2.55s. 
 If I run exactly the same script inside a scheduler task with 
 subprocess.check_output, my response time is increased by 100 times slower 
 than the direct one.
 I'm measuring the response time using the difference from two calls of 
 time.clock(), one at the beginning of the script and a second one whenever 
 it finishes to execute.
 Does it make sense?

 I'm not quite sure whether I am doing something wrong or not... As far as 
 I understand, the overhead from the web service should be completely 
 located outside the script and not reflect during its execution. What am I 
 missing here? Any direction from where should I look for?
 Thanks in advance!


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


[web2py] Re: web2py scheduler error when I start the worker...

2014-10-23 Thread Niphlod
did you recently upgrade to 2.9.11 without letting scheduler recreating the 
tables ? tables definitions have changed, and you need to let web2py adjust 
(i.e. look for migrate_enabled=False in your DAL call)

On Tuesday, October 21, 2014 10:03:39 PM UTC+2, José Leite wrote:

 Hello,

 I just started trying to use web2py scheduler to lauch tasks like DB 
 updates or sending emails.

 I am using windows7 and web2py 2.9.11.
 I just added the following  code to my project for a simple test:

 MODELS
 from gluon.scheduler import Scheduler
 from test_scheduler import Addition

 scheduler = Scheduler(db, tasks=dict(add=Addition))

 IN A CONTROLLER
 # Queue scheduled task
 result = scheduler.queue_task('add',pvars=dict(a=1,b=2))

 when I start the worker with the command:

 C:\web2pypython web2py.py -K Project

 I get the following error:

 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2014
 Version 2.9.11-stable+timestamp.2014.09.15.23.35.11
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(pg8000),
  MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), 
 IMAP(imaplib)
 starting single-scheduler for Project...
 2014-10-21 20:42:12,234 - web2py.scheduler.Hugo-TOSH#22108 - ERROR - Error 
 retrieving status
 2014-10-21 20:42:15,239 - web2py.scheduler.Hugo-TOSH#22108 - ERROR - Error 
 retrieving status
 2014-10-21 20:42:18,242 - web2py.scheduler.Hugo-TOSH#22108 - ERROR - Error 
 retrieving status

 I am not using anything like:

 db._common_fields.append(standard_fields)

 so, anyone knows what may be the problem?

 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/d/optout.


Re: [web2py] Re: web2py website error with Chinese user

2014-10-23 Thread Gael Princivalle
Yes, everything's is in the same server.
That's quite complicated to understand what's going wrong as I don't have a
Chinese computer [?] for testing.


--
Gael Princivalle

2014-10-23 16:12 GMT+02:00 Niphlod niph...@gmail.com:

 who knows. Are you serving all assets from the same location as the site
 or not ?


 On Thursday, October 23, 2014 8:15:22 AM UTC+2, Gael Princivalle wrote:

 Hello all.

 I've got a Chinese user that complains he cannot login in a web2py
 website that I've done.
 He send me a printscreen where all CSS and Javascript are not loaded, so
 he can't login.
 If he use a VPN it's ok.

 Someone know why ? Perhaps it's due to Chinese network restrictions ?

 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/FqV5p6za64E/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/d/optout.


-- 
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/d/optout.


[web2py] Re: db.commit() taking too long to update records

2014-10-23 Thread Leonel Câmara
Doesn't the database take care of that? I mean isn't db session handling 
inside a transaction anyway?

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


[web2py] Re: web2py website error with Chinese user

2014-10-23 Thread Leonel Câmara
Are the files being loaded? If the user opens up a console does he get an 
error?

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


[web2py] Re: db.commit() taking too long to update records

2014-10-23 Thread Anthony
On Thursday, October 23, 2014 12:52:33 PM UTC-4, Leonel Câmara wrote:

 Doesn't the database take care of that? I mean isn't db session handling 
 inside a transaction anyway?


Yes, but that doesn't help across requests (e.g., request A reads session  
request B reads session  request A updates session  request B overwrites 
request A's update). The session table in the db does include a locked 
field, but as far as I can tell, it is not actually used. Another option 
would be to do a select-for-update, which would result in the db locking 
the record until the transaction completes (though in the case of SQLite, I 
think the whole db gets locked).

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/d/optout.


Re: [web2py] Re: Opening PDF files in web browser

2014-10-23 Thread José Eloy Torres Monreal
Sorry for my delay in answer. I've taken back the project.

The solution of Leonel works well if I want to show an pdf from
another website, but when I try to download a file loaded in my own
web site (Web2py's upload/download method) I get the message that the
file is not found.

I show you the table definition:

db.define_table('enlacesweb_documentos',
Field('categoria', db.categorias_documentos),
Field('nombre'),
Field('documento', 'upload',
uploadfolder=os.path.join(request.folder,'uploads/docs_y_normatividad')),
Field('fecha', 'date'),
Field('descripcion_documento', 'text'),
Field('muestra_en_portada','boolean'),
Field('imagen_portada', 'upload',
uploadfolder=os.path.join(request.folder,'uploads/docs_y_normatividad')),
Field('texto_imagen_portada', label=Texto de la
imagen en portada),
format='%(categoria)s')


As you see I'm using an subfolder inside uploads folder.

The download function, serving swf, pdf and another type of files:

def download():

allows downloading of uploaded files
http:///[app]/default/download/[filename]


import os

if (request.args(0) or '').endswith('swf'):

response.headers['Content-Disposition'] = ''
filename = os.path.join(request.folder, 'uploads', request.args(0))

return response.stream(open(filename,'rb'))

elif (request.args(0) or '').endswith('pdf'):

filename=os.path.join(request.folder, 'uploads', request.args(0))
response.headers['ContentType'] =application/pdf
response.headers['Content-Disposition']=inline; filename.pdf
+ filename

return response.stream(open(filename), chunk_size=65536)

else:
return response.download(request,db)


The elif section works well with external pdf to show, but for those
uploaded with Web2py's upload method I get the error the pdf is not
found, if I omit the elif and use the else I can to download the pdf
file, but I want the web browser open it.

I hope you can understand me.

How to fix this?

Thanks in advanced.



2014-07-22 14:11 GMT-05:00 Leonel Câmara leonelcam...@gmail.com:
 You need to change your download for PDFs controller, this would work if you
 don't use uploadseparate (which I usually do) :

 def download_pdf():
   filename=request.args[0]
   path=os.path.join(request.folder,'uploads', filename)
   response.headers['ContentType'] =application/pdf
   response.headers['Content-Disposition']=inline; filename.pdf
 +filename
   return response.stream(open(filename), chunk_size=65536)

 --
 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/uu7Bd7aSVLQ/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/d/optout.

-- 
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/d/optout.


[web2py] Re: Opening PDF files in web browser

2014-10-23 Thread José Eloy
Sorry for my delay in answer. I've taken back the project.

The solution of Leonel works well if I want to show an pdf from another 
website, but when I try to download a file loaded in my own web site 
(Web2py's upload/download method) I get the message that the file is not 
found.

I show you the table definition:

db.define_table('enlacesweb_documentos',
Field('categoria', db.categorias_documentos),
Field('nombre'),
Field('documento', 'upload', 
uploadfolder=os.path.join(request.folder,'uploads/docs_y_normatividad')),
Field('fecha', 'date'),
Field('descripcion_documento', 'text'),
Field('muestra_en_portada','boolean'),
Field('imagen_portada', 'upload', 
uploadfolder=os.path.join(request.folder,'uploads/docs_y_normatividad')),
Field('texto_imagen_portada', label=Texto de la imagen en 
portada),  
format='%(categoria)s')


As you see I'm using an subfolder inside uploads folder.

The download function, serving swf, pdf and another type of files:

def download():

allows downloading of uploaded files
http:///[app]/default/download/[filename]

   
import os
   
if (request.args(0) or '').endswith('swf'):
   
response.headers['Content-Disposition'] = ''
filename = os.path.join(request.folder, 'uploads', request.args(0))
   
return response.stream(open(filename,'rb'))
   
elif (request.args(0) or '').endswith('pdf'):

filename=os.path.join(request.folder, 'uploads', request.args(0))
response.headers['ContentType'] =application/pdf
response.headers['Content-Disposition']=inline; filename.pdf + 
filename
   
return response.stream(open(filename), chunk_size=65536)   

else:
return response.download(request,db)


The elif section works well with external pdf to show, but for those 
uploaded with Web2py's upload method I get the error the pdf is not found, 
if I omit the elif and use the else I can to download the pdf file, but I 
want the web browser open it.

I hope you can understand me. 

How to fix this?

Thanks in advanced.

-- 
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/d/optout.


Re: [web2py] Re: web2py website error with Chinese user

2014-10-23 Thread Niphlod
if you're serving all assets from the same hostname, then Chinese network 
restrictions aren't the cause. Maybe a wrongly set proxy, but it's 
entirely not web2py's fault, nor your app's code.

On Thursday, October 23, 2014 5:11:57 PM UTC+2, Gael Princivalle wrote:

 Yes, everything's is in the same server.
 That's quite complicated to understand what's going wrong as I don't have 
 a Chinese computer  for testing.


 --
 Gael Princivalle

 2014-10-23 16:12 GMT+02:00 Niphlod nip...@gmail.com javascript::

 who knows. Are you serving all assets from the same location as the site 
 or not ?


 On Thursday, October 23, 2014 8:15:22 AM UTC+2, Gael Princivalle wrote:

 Hello all.

 I've got a Chinese user that complains he cannot login in a web2py 
 website that I've done.
 He send me a printscreen where all CSS and Javascript are not loaded, so 
 he can't login.
 If he use a VPN it's ok.

 Someone know why ? Perhaps it's due to Chinese network restrictions ?

 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 a topic in the 
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/FqV5p6za64E/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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/d/optout.


Re: [web2py] Re: language and localization development

2014-10-23 Thread Manuele Pesenti
Il 23/10/14 14:41, Leonel Câmara ha scritto:
 I'd like to make a suggestion though - Don't do this.
I don't think I'll do it. I don't want to globally change my approach
writing all text messages in other language than english.
I agree your suggestion. I was just looking for a local workaround for
some particular cases.

Thank you anyway

Cheers

M.

-- 
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/d/optout.


[web2py] Re: Opening PDF files in web browser

2014-10-23 Thread José Eloy
Hello.

I've discovered if I use

return response.download(request, db, attachment=False) 

in the else statement of the download function of my code, I can do the web 
browser can open the pdf file, but I miss the original filename. How I can 
to recover it?

Regards.

-- 
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/d/optout.


[web2py] Re: RESTful request args/vars with JSON array

2014-10-23 Thread Henry Nguyen
Niphlod,

That does not appear to be the case, either for request.restful() requests 
or regular controller requests. For example, consider this controller 
method:

def test():
logger.debug(request.env.content_type)
logger.debug(request.post_vars)
logger.debug(request.body.read())
return

With the request data as a JSON array of objects, such as:

[{id:1, is_read:true}]

I get the following logs:

2014-10-23 17:51:47,488 DEBUG test.py test():14 : application/json
2014-10-23 17:51:47,490 DEBUG test.py test():15 : Storage {}
2014-10-23 17:51:47,490 DEBUG test.py test():16 : [{id:1, is_read:true}]

With the data as a JSON object, such as

{id:1, is_read:true}

I get the following logs:

2014-10-23 17:54:46,468 DEBUG test.py test():14 : application/json
2014-10-23 17:54:46,469 DEBUG test.py test():15 : Storage {u'is_read': True
, u'id': 1}
2014-10-23 17:54:46,470 DEBUG test.py test():16 : {id:1, is_read:true}

Note that request data is not parsed into request.post_vars. This would 
make sense to me; since request.post_vars is a Storage object which 
inherits from a Python dictionary, there would be no dictionary key to 
store the array value, no?

Henry



On Thursday, October 23, 2014 7:16:00 AM UTC-7, Niphlod wrote:

 if the content-type of the POST request is application/json, mylist 
 would actually be yet parsed into request.post_vars (i.e. you can skip 
 body.read())

 On Thursday, October 23, 2014 1:24:09 AM UTC+2, Henry Nguyen wrote:

 For posterity's sake, I was able to retrieve the array in the request 
 body by using:

 import json
 my_list = json.loads(request.body.read())

 and then iterating through the list items just like any other list. This 
 was taken from http://web2py.com/books/default/chapter/29/04#request 
 under request.body.

 Thanks for letting me know that request.restful() wouldn't parse it 
 automatically, Niphlod.

 Henry

 On Monday, October 13, 2014 12:25:54 PM UTC-7, Niphlod wrote:

 you have to code your own methods.

 On Sunday, October 12, 2014 11:32:23 PM UTC+2, Henry Nguyen wrote:

 I have a function in my controller decorated with the 
 @request.restful() decorator. I would like to be able to accept a JSON 
 array of objects, 

 [{id: 1, new_value: 1},{id: 2, new_value: 2}]

 , on a POST, PUT, or DELETE. For example, I'd like the client to be 
 able to update a series of values on one request, as opposed to having to 
 submit multiple requests for each individual update. However, the args and 
 vars parameters being passed to the methods are empty when a request is 
 sent with the JSON payload above. Specifically, args only gets populated 
 from URL args and vars only get populated if the array is accompanied by a 
 key, such as in:

 {update: [{id: 1, new_value: 1},{id: 2, new_value: 2}]}

 While it certainly isn't too much trouble to include that initial key, I 
 was wondering if there's any way to retrieve the JSON objects from the 
 request without having to specify the key so that I could pass a simple 
 array instead?  

 Thank you ahead of time for any help.



-- 
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/d/optout.


[web2py] best way to play sound one time? session or cookies

2014-10-23 Thread LoveWeb2py
Hello,

I would like to greet or user with a sound one time upon accessing a controller 
but if they click it again i would want the sound to play again while they're 
logged in.  However if they log out and log back in I would like it to play 
again.  What type of logic should I use sessions or cookies?  What is av better 
fit. 

-- 
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/d/optout.


[web2py] best way to play sound one time? session or cookies

2014-10-23 Thread LoveWeb2py
I meant i wouldn't want it to play again while logged in

-- 
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/d/optout.


[web2py] Re: best way to play sound one time? session or cookies

2014-10-23 Thread Massimo Di Pierro
I would do this all in JS. You play the file then store in a html5 local 
storage a flag that says you played it. Next time you check the 
localstorage. No reason to bother the server with this information. 

http://www.w3schools.com/html/html5_webstorage.asp

On Thursday, 23 October 2014 20:18:38 UTC-5, LoveWeb2py wrote:

 Hello,

 I would like to greet or user with a sound one time upon accessing a 
 controller but if they click it again i would want the sound to play again 
 while they're logged in.  However if they log out and log back in I would 
 like it to play again.  What type of logic should I use sessions or 
 cookies?  What is av better fit. 


-- 
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/d/optout.