[web2py] Re: user profile fields for referenced table

2013-12-04 Thread Yebach
So based on your answers I menaged to do my form

The next question or problem I have is following. When user registers a new 
record is created in two tables (auth_user and organization). But when the 
user goes to profile page the form is empty and after filling it a new 
record is inserted in organization (only there) table. I would like to 
populate the form at the beginning and then update the table organization. 

how do I get the current user Id or users organization id or some other 
unique id to use it for update statement?

any suggestions?

thank you 

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


[web2py] Re: GAE - Not Working || Full Code Attached

2013-12-04 Thread James Burke
Nothing looks obvious at first glance...

if the ticket issued is unrecoverable then it can be that GAE hasn't 
created the indexes for your datastore table yet. It may be just a case of 
waiting a few minutes and refreshing the page.

-- 
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: Spawning a thread or a process for a long-running task [urgent!]

2013-12-04 Thread Yassen D.


On Thursday, December 5, 2013 9:33:15 AM UTC+2, Yassen D. wrote:
>
> ... I get an exception saying that table socialjack.scheduler_task does 
> not exist (traceback below). But the table IS there, I can see it in the db 
> admin interface and on the MySQL console ...
>

Not really, the table is shown in the database interface but is NOT present 
on the  SQL server, unfortunately.
What should I do to create 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/groups/opt_out.


[web2py] Re: Spawning a thread or a process for a long-running task [urgent!]

2013-12-04 Thread Yassen D.

On Thursday, December 5, 2013 8:40:28 AM UTC+2, Yassen D. wrote:
>
>
>
> On Wednesday, December 4, 2013 10:28:43 PM UTC+2, Leonel Câmara wrote:
>>
>> Instead of rerunning the task with period, schedule new tasks every time 
>> you need to go get the user's friends
>>
>
> I guess I have to create a record into the  scheduler_task table, with 
> some reasonable values, and then the first available worker will pick that 
> up, correct?
>

What I do currently: create a scheduler in a dedicated model:

from gluon.scheduler import Scheduler
from jobs import testfunc
scheduler = Scheduler(db, dict(testfunc_task=testfunc))

Then in a controller, I do:

task_kwargs = { 'immediate': True, 'task_name': 'ImportContacts-' + 
str(time.time())[:-4], }
from jobs import testfunc
scheduler.queue_task(testfunc, pargs=[request.vars.sna], 
kwargs=task_kwargs)

and I get an exception saying that table socialjack.scheduler_task does not 
exist (traceback below). But the table IS there, I can see it in the db 
admin interface and on the MySQL console ... Please help! Thanks!

Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 217, in restricted
exec ccode in environment
  File 
"/home/www-data/web2py-2.8.2/applications/socialjack/controllers/contacts.py" 
,
 line 236, in 
  File "/home/www-data/web2py/gluon/globals.py", line 372, in 
self._caller = lambda f: f()
  File "/home/www-data/web2py/gluon/tools.py", line 3239, in f
return action(*a, **b)
  File 
"/home/www-data/web2py-2.8.2/applications/socialjack/controllers/contacts.py" 
,
 line 54, in importcontacts
scheduler.queue_task(testfunc, pargs=[request.vars.sna], kwargs=task_kwargs)
  File "/home/www-data/web2py/gluon/scheduler.py", line 983, in queue_task
**kwargs)
  File "/home/www-data/web2py/gluon/dal.py", line 9114, in validate_and_insert
value,error = self[key].validate(value)
  File "/home/www-data/web2py/gluon/dal.py", line 10036, in validate
(value, error) = validator(value)
  File "/home/www-data/web2py/gluon/validators.py", line 668, in __call__
row = subset.select(table._id, field, limitby=(0, 1), 
orderby_on_limitby=False).first()
  File "/home/www-data/web2py/gluon/dal.py", line 10450, in select
return adapter.select(self.query,fields,attributes)
  File "/home/www-data/web2py/gluon/dal.py", line 1861, in select
return self._select_aux(sql,fields,attributes)
  File "/home/www-data/web2py/gluon/dal.py", line 1826, in _select_aux
self.execute(sql)
  File "/home/www-data/web2py/gluon/dal.py", line 1948, in execute
return self.log_execute(*a, **b)
  File "/home/www-data/web2py/gluon/dal.py", line 1942, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in 
execute
self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in 
defaulterrorhandler
raise errorclass, errorvalue
ProgrammingError: (1146, "Table 'socialjack.scheduler_task' doesn't 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.


[web2py] GAE - Not Working || Full Code Attached

2013-12-04 Thread PRACHI VAKHARIA



 

*GAE – Not Working*

 

The app works well locally and also on GAE-launcher, but once uploaded 
(deployed) on to GAE, the app does not work and gives an error. 

 

*Code and Error Provided Below*


 
 

*MODEL (db.py)*

if not request.env.web2py_runtime_gae:

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

else:

db = DAL('google:datastore')

session.connect(request, response, db=db)


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

auth = Auth(db)

crud, service, plugins = Crud(db), Service(), PluginManager()

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


auth.settings.registration_requires_verification = False

auth.settings.registration_requires_approval = False

auth.settings.reset_password_requires_verification = True


db.define_table('person',

Field('name'),

Field('age', 'integer'),

Field('birthday', 'date'),

Field('married', 'boolean'),

Field('zipcode', 'integer'),

Field('photo', 'upload', uploadfield='image_file'),

Field('image_file', 'blob'),

format='%(name)s'

)



 

*CONTROLLER (default.py)*

import gluon.contenttype

import gluon.fileutils


def add_person():

formP = SQLFORM(db.person)

if formP.process().accepted:

response.flash = 'Person Added'

 

return dict(formP=formP)


 


*VIEW*
The corresponding view in HTML were created that displays the Dictionarie : 
formP

Add Person

{{=formP}} 



 
 

*ERROR*
When uploaded on GAE, the app does not work. It gives the following error:

Internal error

Ticket issued: *unrecoverable 
*


 

 

If anyone can kindly help to resolve this issue, it will very helpful, and 
I shall be very grateful.




 




-- 
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: Running instantpress in GAE: Internal error Ticket issued: unrecoverable

2013-12-04 Thread PRACHI VAKHARIA

 

*Did you find a Solution?*

*If yes, what is the Solution?*

 

Thank you.





On Thursday, June 13, 2013 11:29:35 AM UTC-4, peibol wrote:
>
> Hi all:
>
> Everything is running smoothly at localhost, but when deploying a raw 
> instantpress on GAE I get Internal error Ticket issued: unrecoverable when 
> trying to register or login. I'm using python 2.7, but the same thing 
> happens with 2.5.
>
> Any hints there?
>
> 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: Spawning a thread or a process for a long-running task [urgent!]

2013-12-04 Thread Yassen D.


On Wednesday, December 4, 2013 10:28:43 PM UTC+2, Leonel Câmara wrote:
>
> Instead of rerunning the task with period, schedule new tasks every time 
> you need to go get the user's friends
>

I guess I have to create a record into the  scheduler_task table, with some 
reasonable values, and then the first available worker will pick that up, 
correct?

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


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

2013-12-04 Thread Christian Foster Howes
this is a documented GAE SDK bug.  you'll have to downgrade your GAE SDK to 
the last working version of this.  i *think* the last working version is 
1.8.1

On Wednesday, December 4, 2013 8:46:31 AM UTC-8, David Manns wrote:
>
> My application runs on GAE. Using Google's bulk loader I make occasional 
> backups of the database. It used to be that I could use the GAE SDK (appcfg 
> tool in this case) to upload all the data into the development server on my 
> development machine, thus creating the full data context for the SDK.
>
> This now fails. I'm not sure (or if) how the remote_api validates the 
> provided email/password, but the results are the same failure with all 
> sensible choices of password, e.g. the primary google account password (the 
> account owns the app on GAE), the application specific password used for 
> the bulk download for GAE (the gmail account uses 2 factor authentication), 
> or no password.
>
> I attach the script used to run the development upload (which used to work 
> until recently) and the command window output from running it. Also the 
> app.yaml file.
>
> Anyone have any idea what the problem might be?
>

-- 
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: uploading files on GAE - 404 NOT FOUND

2013-12-04 Thread Christian Foster Howes
Can you share the log/stack trace from when that happens?  does the form 
post to the same function that generated it?

i have not tried upload in grid()wonder if there is something there 
that doesn't quite work on app engine?

On Tuesday, December 3, 2013 10:49:47 AM UTC-8, James Burke wrote:
>
> Hi,
>
> Uploading files into my table on GAE, when I hit submit I'm presented with 
> a "404 NOT FOUND" error message.
>
> Works fine using Rocket, but not in GAE SDK or when uploaded to GAE.
>
> _tables.py - in models
> db.define_table('file',
> Field('name', unique=True, compute=lambda r: db.file.file.retrieve(r.
> file)[0]),
> Field('file', 'upload'),
> Field('created_on', 'datetime', default=request.now),
> Field('created_by', 'reference auth_user', default=auth.user_id),
> format='%(name)s')
>
>
> admin.py - in controllers
> @auth.requires_membership("admin")
> def file():
>  links = [dict(header='URL', body=lambda row: '/init/default/download/%s' 
> %(db.file.file.retrieve(row.file)[0]))]
>  form = SQLFORM.grid(db.file, links=links, searchable=False, 
> csv=False,user_signature
> =False)
>
>
>  return dict(form=form)
>
>
>
> Cheers
>
> -James
>

-- 
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: After upgrade to 2.8.2: foreign key constraint failed

2013-12-04 Thread Vch H
How  I can change "foreign_keys=ON" to "OFF" for some application?


-- 
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: Spawning a thread or a process for a long-running task [urgent!]

2013-12-04 Thread Yassen D.

Leonel, thanks so much for the advice!

On Wednesday, December 4, 2013 10:28:43 PM UTC+2, Leonel Câmara wrote:
>
> Instead of rerunning the task with period, schedule new tasks every time 
> you need to go get the user's friends and have many scheduler workers if 
> there's a chance you will have to do many of these in parallel.
>

Of course, this seems great for my use case!
 

> You should be able to lower the interval as much as you need, you could 
> even reduce the scheduler heartbeat from the default 3 seconds.
>

Can you elaborate here? Is this a config setting somewhere? (Forgive my 
ignorance.)
Y.

-- 
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] Online classes

2013-12-04 Thread Jake Angulo
Invaluable learning resource... thinking of downloading to my tablet.
Thanks maestro :)


On Tue, Dec 3, 2013 at 5:34 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Hello everybody,
>
> As you know I teach a certification program about web development with
> Python and I use web2py.
> I posted my most recent classes online:
>
> https://vimeo.com/75499986
> https://vimeo.com/76047107
> https://vimeo.com/76608898
> https://vimeo.com/77179700
> https://vimeo.com/77654974
>
> It is about of 13 hours of web2py lessons and coding.
> Please join me in thanking the students who enrolled in the program and
> supported these classes.
>
> Massimo
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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: Online classes

2013-12-04 Thread Ovidio Marinho
 For new and old programmers, video reference. very good!!!




 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
 Brasil



2013/12/4 Jesse Ferguson 

> I have watched the first few videos and they are so helpful for a beginner
> like myself, I would like to thank you for these! I would also like to
> request that you share the source code, I have been using the videos as
> reference and its a pain to try to find the parts that explained xyz
>  functionality... Also being a beginner it would really be helpful to see
> more on the DAL maybe just more use cases the terminal code you showed was
> nice however Im missing the bridge on how to properly display retrieved
> data in the view and how to properly set up form params
>
> --
> 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] Failure after upgrade to 2.8.2

2013-12-04 Thread Jim S
The following code is failing after update from 2.8.x to 2.8.2 (not 
positive what version I came from)


auth.settings.hmac_key = 'sha512:9d8d83af-4769-410b-9cf5-e01a163b498d'   # 
before define_tables()

auth.settings.extra_fields['auth_user']= [
Field('auth_group', 'reference auth_group', label='Group', 
  requires=IS_EMPTY_OR(IS_IN_DB(db, 'auth_group.id', '%(group)s'
))),
Field('phone', 'string', length=20),
Field('active', 'boolean', default=True),
Field('image', 'upload'),
Field('created', 'datetime', default=request.now, writable=False),
Field('supplier', 'reference supplier', requires=IS_EMPTY_OR(
IS_IN_DB(db, 'supplier.id'))),
Field('distributor', 'reference distributor', requires=IS_EMPTY_OR(
IS_IN_DB(db, 'distributor.id'))),
Field('fax', 'string', length=20)
]

## create all tables needed by auth if not custom tables
auth.define_tables(username=True, signature=False)



The following traceback is generated:

Traceback (most recent call last):
 File "C:\dev\web2py\gluon\restricted.py", line 217, in restricted
 exec ccode in environment
 File 
"C:/dev/web2py/applications/ibc/models/db.py"
, line 69, in 
 auth.define_tables(username=True, signature=False)
 File "C:\dev\web2py\gluon\tools.py", line 1707, in define_tables
 format='%(username)s'))
 File "C:\dev\web2py\gluon\dal.py", line 8226, in define_table
 table = self.lazy_define_table(tablename,*fields,**args)
 File "C:\dev\web2py\gluon\dal.py", line 8263, in lazy_define_table
 polymodel=polymodel)
 File "C:\dev\web2py\gluon\dal.py", line 908, in create_table
 raise KeyError('Cannot resolve reference %s in %s definition' % (referenced
, table._tablename))
KeyError: 'Cannot resolve reference auth_group in auth_user definition'




-- 
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: Error in using the web2py.app.dataspreadsheets.w2p

2013-12-04 Thread Massimo Di Pierro
Fixed in trunk.

On Wednesday, 4 December 2013 16:51:31 UTC-6, P T wrote:
>
> I am posting here the solution I received by e-mail. This resolved this 
> issue.
>
> I guess I missed the quotes for the _class dictionary key, so replacing 
> this line
>
>**{_class: "%s_fieldnames" %
>
> with this
>
>**{"_class": "%s_fieldnames" %
>
> in gluon/contrib/spreadsheet.py should avoid the error
>
> Thanks,
> PT
>
>
> On Tuesday, December 3, 2013 11:34:33 PM UTC-6, P T wrote:
>>
>> I am using Web2py 2.8.2 source and installed installed the app 
>>  web2py.app.dataspreadsheets.w2p from 
>> https://code.google.com/p/web2py/issues/detail?id=860#c1 and getting the 
>> following errors:
>>
>> 1) Cannot import module 'simplejson'
>>
>> Ticket ID
>>  127.0.0.1.2013-12-03.23-17-52.b5368c20-df03-4a22-b20e-35dab70c9eb0
>>   Cannot import module 'simplejson'
>>  Version
>>  web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
>>  Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)
>>
>>
>> This is resolved by changing the line 4 in default.py from "import 
>> simplejson" to "from gluon.contrib import simplejson"
>>
>> With this I am able to access all pages except for database driven pages, 
>> which generate the following error.
>>
>> 2) global name '_class' is not defined
>>
>> Ticket ID
>> 127.0.0.1.2013-12-03.23-21-14.e61d83f2-af1b-4d39-88cf-59909da11f56
>>
>>  global name '_class' is not defined
>>
>> Version
>> web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
>> Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)
>> Traceback (most recent call last):
>>   File "C:\web2py-src\gluon\restricted.py", line 217, in restricted
>> exec ccode in environment
>>   File 
>> "C:\web2py-src\applications\SpreadSheet\views\default/database_first.html", 
>> line 119, in 
>>   File "C:\web2py-src\gluon\globals.py", line 381, in write
>> self.body.write(xmlescape(data))
>>   File "C:\web2py-src\gluon\html.py", line 120, in xmlescape
>> return data.xml()
>>   File "C:\web2py-src\gluon\contrib\spreadsheet.py", line 873, in xml
>> return self.sheet().xml()
>>   File "C:\web2py-src\gluon\contrib\spreadsheet.py", line 862, in sheet
>> attributes["_class"]}))
>> NameError: global name '_class' is not defined
>>
>> Can somebody help me to fix this?
>>
>> Thanks,
>> PT
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: After upgrade to 2.8.2: foreign key constraint failed

2013-12-04 Thread Alex Glaros
Is there any indicator regarding which exact foreign key constraint it is, 
or do I have to check each table and field in the problem controller?

thanks,

Alex Glaros

-- 
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] Prevent multiple submit buttons from showing "Working..." on submit

2013-12-04 Thread Mark Li
I currently have 2 submit buttons in a form. When a user clicks on one of 
them, it changes both submit input values to "Working..."

I looked into web2py.js and tried applying the suggestion there for 
preventing "Working.." from showing up on the buttons


/*if you don't want to see "working..." on buttons, replace the following
  * two lines with this one
  * el.data('w2p_disable_with', el[method]());
  */

This would be fine with 1 submit button. However, with 2 submit buttons, 
the value of the 2nd submit button is changed to the value of the 1st.

For example, button 1 text is "Save", and button 2 text is "Post", clicking 
on either will change button 2 text to "Save" (after applying the 
suggestions from web2py.js


Is there any way to disable the changing of the value/text of the submit 
input on submission (for multiple submit buttons in 1 form)?

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


[web2py] Re: Online classes

2013-12-04 Thread Jesse Ferguson
I have watched the first few videos and they are so helpful for a beginner 
like myself, I would like to thank you for these! I would also like to 
request that you share the source code, I have been using the videos as 
reference and its a pain to try to find the parts that explained xyz 
 functionality... Also being a beginner it would really be helpful to see 
more on the DAL maybe just more use cases the terminal code you showed was 
nice however Im missing the bridge on how to properly display retrieved 
data in the view and how to properly set up form params

-- 
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] redirect on error page by routes.py

2013-12-04 Thread sonu kumar
Hi All,

I would like to redirect to error.html page upon internal error in my 
application.

here is my code I am using it but not working..Please suggest me where I am 
doing wrong.

routers = dict(

# base router
BASE=dict(
default_application='myapp',
),
)

 routes_onerror = [
 ('myapp/*', '/myapp/default/error')
 ]

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: Online classes

2013-12-04 Thread 黄祥
i think it would be better if you put the description on the video, i mean 
the scope of lesson in the video.

best regards,
stifan

-- 
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: After upgrade to 2.8.2: foreign key constraint failed

2013-12-04 Thread Scott Hunter
This was how I modified one of the "offending" Field definitions:

Field('f_club2', type='reference t_club',
  requires=IS_EMPTY_OR(IS_IN_DB(db,db.t_club.id,"%(f_desc)s")),
  label=T('ClubCode2')),


Basically, I wrapped a IS_EMPTY_OR around what the manual says is the 
default validator.

On Wednesday, December 4, 2013 3:30:56 PM UTC-5, Vch H wrote:
>
> I have  this problem too.
> Where I should specified validators?
>
> On Wednesday, December 4, 2013 6:00:43 PM UTC+2, Scott Hunter wrote:
>>
>> Aha -- I had reference fields, one of which was empty, and they used the 
>> default validator, which does not allow for that.  I specified the 
>> validators for those fields, and that did the trick.  
>>
>> Shouldn't this have been reported as an error in the form ("Field 
>> Required", or somesuch), and not have generated a ticket?
>>
>> And shouldn't the fact that this is a new requirement for reference 
>> fields (or at least a new default setting) be included in the release notes 
>> for this version?
>>
>> Thanks!
>>
>> On Wednesday, December 4, 2013 3:06:05 AM UTC-5, Paolo Valleri wrote:
>>>
>>> Web2py 2.8.2 comes with foreign_keys=ON enabled by default (see 
>>> http://www.sqlite.org/foreignkeys.html)
>>> If you get the issue you mentioned I guess you are violating a foreign 
>>> key constrain.
>>> Please post your model (or the tables definitions involved) so that we 
>>> can figure out what is wrong
>>>
>>> Paolo
>>>
>>> On Wednesday, December 4, 2013 3:26:32 AM UTC+1, Scott Hunter wrote:

 I have a site which, after upgrading to 2.8.2 (and clearing out the 
 sessions), when I try update a record via a smartgrid or via admin, I get 
 the error in the title.  I tried the same action on the copy of the site I 
 had made just before upgrading, without any problems.

 This is from OSX 10.9.

>>>

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


[web2py] Re: problem in sending mail

2013-12-04 Thread sonu kumar
Thanks Alan.
It is working now..with this script

from gluon.tools import Mail
mail = Mail()
mail.settings.server = 'localhost'
mail.settings.sender = 'x...@xxx.org'
mail.settings.login = None
mail.settings.tls = None

thanks

On Wednesday, 4 December 2013 14:55:59 UTC-8, sonu kumar wrote:
>
> Hi Alan,
> I checked as you said..it gives
> mail.result ={}
> mail.error = gaierror(-2, 'Name or service not known')
>
>
>
> On Wednesday, 4 December 2013 14:48:00 UTC-8, Alan Etkin wrote:
>>
>>
>> as my IT dept told me that this smtp does not need any login...this smtp 
>>> direct send mail and it is working fine for them. But I don't know why it 
>>> is not working for me...Is there any mistake I am doing in my code??
>>>
>>
>> After mail.send(), check the values for mail.result and mail.error
>>
>

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


[web2py] Re: problem in sending mail

2013-12-04 Thread sonu kumar
Hi Alan,
I checked as you said..it gives
mail.result ={}
mail.error = gaierror(-2, 'Name or service not known')



On Wednesday, 4 December 2013 14:48:00 UTC-8, Alan Etkin wrote:
>
>
> as my IT dept told me that this smtp does not need any login...this smtp 
>> direct send mail and it is working fine for them. But I don't know why it 
>> is not working for me...Is there any mistake I am doing in my code??
>>
>
> After mail.send(), check the values for mail.result and mail.error
>

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


Re: [web2py] Re: Suggestions for multiple files upload in form

2013-12-04 Thread Ruud Schroen
Thanks alot! I'll check it out tommorow :) i'll let you know if it worked


On Wed, Dec 4, 2013 at 9:54 PM, Paolo Caruccio
wrote:

> There are several  compatibility problems between foundation css and
> multiupload. You'll find here attached the patched files. Now it should
> work also with foundation (I tested the code with foundation 5.0.2) and
> also with jquery > 1.9
>
> Il giorno martedì 3 dicembre 2013 00:01:21 UTC+1, Ruud Schroen ha scritto:
>
>> Hi,
>>
>> I know this is an old thread, but I have a question.
>>
>> The upload and everything is working fine, but for some reason it doesn't
>> work when bootstrap.min.css (the default one by web2py) is NOT included.
>> This is kinda stupid because i'm using Foundation. Any idea what's going on?
>>
>> On Friday, October 28, 2011 2:40:12 AM UTC+2, Paolo Caruccio wrote:
>>>
>>> I wasn't able to find in the web, even in this group, a multiple files
>>> upload system with the followings requirements:
>>>
>>> - upload the files together with form submit
>>> - no frame, no flash, no ajax form submit but only jquery and python
>>> - give a title to the uploading files
>>> - simple to integrate and control in web2py
>>>
>>> so, inspired by http://the-stickman.com/web-
>>> development/javascript/upload-multiple-files-with-a-single-file-element/,
>>> I wrote one by my self.
>>> It's minimalist and the code isn't optimized (I'm not a programmer), but
>>> it works for my purposes.
>>>
>>> If you would like to test it in default welcome web2py app:
>>>  - put jquery.multiuploads.js in static/js folder
>>>  - put multiuploads.css in static/css folder
>>>  - append the functions to default.py in controllers folder
>>>  - append the table definition to db.py in models folder
>>>  - put upload_documents.html in views folder
>>>
>>> You'll find some comments in the code and also many errors.
>>>
>>> I look forward to your suggestions and opinions.
>>>
>>> Ciao.
>>>
>>> Paolo
>>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/XpnUb2_MaRc/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.


Re: [web2py] Receiving an URL as request.vars

2013-12-04 Thread Jonathan Lundell
On 4 Dec 2013, at 2:25 PM, luciano  wrote:

> Hello, I'm writing an app using web2py and I would need to accept a full URL 
> as a get parameter, so in case the following request is received: 
> "http://www.mysite.com/http://www.google.com/";
> a controller function should be called with the value 
> "http://www.google.com/"; as an argument.
> 
> Is this achievable through web2py?

In principle, you should be able to do something like 
http://www.mysite.com?url=http://www.google.com/, as long as you encode the URL 
thus:

http://www.mysite.com?url=http://www.google.com/?url=http%3A%2F%2Fwww.google.com%2F

However, at least by default you'll run afoul of web2py's URL syntax checker. 
You can avoid that by using the parameter-based router. Still, it's tricky, 
partly because proper url-encoding is absolutely mandatory; otherwise the 
result can be ambiguous.

-- 
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: Error in using the web2py.app.dataspreadsheets.w2p

2013-12-04 Thread P T
I am posting here the solution I received by e-mail. This resolved this 
issue.

I guess I missed the quotes for the _class dictionary key, so replacing 
this line

   **{_class: "%s_fieldnames" %

with this

   **{"_class": "%s_fieldnames" %

in gluon/contrib/spreadsheet.py should avoid the error

Thanks,
PT


On Tuesday, December 3, 2013 11:34:33 PM UTC-6, P T wrote:
>
> I am using Web2py 2.8.2 source and installed installed the app 
>  web2py.app.dataspreadsheets.w2p from 
> https://code.google.com/p/web2py/issues/detail?id=860#c1 and getting the 
> following errors:
>
> 1) Cannot import module 'simplejson'
>
> Ticket ID
>  127.0.0.1.2013-12-03.23-17-52.b5368c20-df03-4a22-b20e-35dab70c9eb0
>   Cannot import module 'simplejson'
>  Version
>  web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
>  Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)
>
>
> This is resolved by changing the line 4 in default.py from "import 
> simplejson" to "from gluon.contrib import simplejson"
>
> With this I am able to access all pages except for database driven pages, 
> which generate the following error.
>
> 2) global name '_class' is not defined
>
> Ticket ID
> 127.0.0.1.2013-12-03.23-21-14.e61d83f2-af1b-4d39-88cf-59909da11f56
>
>  global name '_class' is not defined
>
> Version
> web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
> Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)
> Traceback (most recent call last):
>   File "C:\web2py-src\gluon\restricted.py", line 217, in restricted
> exec ccode in environment
>   File 
> "C:\web2py-src\applications\SpreadSheet\views\default/database_first.html", 
> line 119, in 
>   File "C:\web2py-src\gluon\globals.py", line 381, in write
> self.body.write(xmlescape(data))
>   File "C:\web2py-src\gluon\html.py", line 120, in xmlescape
> return data.xml()
>   File "C:\web2py-src\gluon\contrib\spreadsheet.py", line 873, in xml
> return self.sheet().xml()
>   File "C:\web2py-src\gluon\contrib\spreadsheet.py", line 862, in sheet
> attributes["_class"]}))
> NameError: global name '_class' is not defined
>
> Can somebody help me to fix this?
>
> Thanks,
> PT
>

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


[web2py] Re: problem in sending mail

2013-12-04 Thread Alan Etkin


> as my IT dept told me that this smtp does not need any login...this smtp 
> direct send mail and it is working fine for them. But I don't know why it 
> is not working for me...Is there any mistake I am doing in my code??
>

After mail.send(), check the values for mail.result and mail.error

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


[web2py] Social Login

2013-12-04 Thread Cássio Botaro
What's the way to do login with twitter without using janrain? I've tried 
this solution but only works with facebook. 
https://github.com/r4bugento/web2social

After authorization, I've been redirected to  
http://127.0.0.1:8000/web2social/default/user/login 
and show me this message: "This webpage has a redirect loop"

-- 
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: After upgrade to 2.8.2: foreign key constraint failed

2013-12-04 Thread Vch H
I have  this problem too.
Where I should specified validators?

On Wednesday, December 4, 2013 6:00:43 PM UTC+2, Scott Hunter wrote:
>
> Aha -- I had reference fields, one of which was empty, and they used the 
> default validator, which does not allow for that.  I specified the 
> validators for those fields, and that did the trick.  
>
> Shouldn't this have been reported as an error in the form ("Field 
> Required", or somesuch), and not have generated a ticket?
>
> And shouldn't the fact that this is a new requirement for reference fields 
> (or at least a new default setting) be included in the release notes for 
> this version?
>
> Thanks!
>
> On Wednesday, December 4, 2013 3:06:05 AM UTC-5, Paolo Valleri wrote:
>>
>> Web2py 2.8.2 comes with foreign_keys=ON enabled by default (see 
>> http://www.sqlite.org/foreignkeys.html)
>> If you get the issue you mentioned I guess you are violating a foreign 
>> key constrain.
>> Please post your model (or the tables definitions involved) so that we 
>> can figure out what is wrong
>>
>> Paolo
>>
>> On Wednesday, December 4, 2013 3:26:32 AM UTC+1, Scott Hunter wrote:
>>>
>>> I have a site which, after upgrading to 2.8.2 (and clearing out the 
>>> sessions), when I try update a record via a smartgrid or via admin, I get 
>>> the error in the title.  I tried the same action on the copy of the site I 
>>> had made just before upgrading, without any problems.
>>>
>>> This is from OSX 10.9.
>>>
>>

-- 
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] Receiving an URL as request.vars

2013-12-04 Thread luciano
Hello, I'm writing an app using web2py and I would need to accept a full 
URL as a get parameter, so in case the following request is received: 
"http://www.mysite.com/http://www.google.com/";
a controller function should be called with the value 
"http://www.google.com/"; as an argument.

Is this achievable through web2py?

help really appreciated! :-)

-- 
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] problem in sending mail

2013-12-04 Thread sonu kumar
Hi All,
I am not able to send email via my application.
here is my code..I don't know where I am doing mistake, but it is working 
fine with gmail setup.

from gluon.tools import Mail
mail = Mail()
mail.settings.server = 'xx.x.x.xx:25'
mail.settings.sender = 'ad...@xyz.org'
mail.settings.login = None

as my IT dept told me that this smtp does not need any login...this smtp 
direct send mail and it is working fine for them. But I don't know why it 
is not working for me...Is there any mistake I am doing in my code??

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.


Re: [web2py] hyperlink address when page print with browser seems coming form boostrap

2013-12-04 Thread Richard Vézina
Ok, as I thought, it was from bootsrap...

Thanks a million for this.

:)

Richard


On Wed, Dec 4, 2013 at 4:27 PM, Paolo Caruccio
wrote:

> Bootstrap has:
>
> https://github.com/twbs/bootstrap/blob/master/dist/css/bootstrap.css#L228
>
> so by the suggested rules we remove the link from the content.
>
> Il giorno mercoledì 4 dicembre 2013 22:07:10 UTC+1, Richard ha scritto:
>>
>> Yes Paolo, it works great...
>>
>> Many thanks for this...
>>
>> I am curious where is it from though...
>>
>> :)
>>
>> Richard
>>
>>
>> On Wed, Dec 4, 2013 at 4:01 PM, Paolo Caruccio wrote:
>>
>>> Maybe this helps https://groups.google.com/d/msg/web2py/z_vjoBM9WlU/
>>> FLw7MCQIViMJ
>>>
>>>
>>> Il giorno mercoledì 4 dicembre 2013 21:44:04 UTC+1, Richard ha scritto:
>>>
 Hello,

 I try to print some pages today and found that there is a hyperlink
 address that appear beside each link of the page even image, etc.

 I think it coming from Bootstrap right?

 How to shut this behavoir off!! Is there an easy way...

 I found this pretty annoying because it busted all the design of the
 page and make the printed page ununderstandable.

 Thanks

 Richard

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

-- 
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] hyperlink address when page print with browser seems coming form boostrap

2013-12-04 Thread Paolo Caruccio
Bootstrap has:

https://github.com/twbs/bootstrap/blob/master/dist/css/bootstrap.css#L228

so by the suggested rules we remove the link from the content.

Il giorno mercoledì 4 dicembre 2013 22:07:10 UTC+1, Richard ha scritto:
>
> Yes Paolo, it works great...
>
> Many thanks for this...
>
> I am curious where is it from though...
>
> :)
>
> Richard
>
>
> On Wed, Dec 4, 2013 at 4:01 PM, Paolo Caruccio 
> 
> > wrote:
>
>> Maybe this helps 
>> https://groups.google.com/d/msg/web2py/z_vjoBM9WlU/FLw7MCQIViMJ
>>
>>
>> Il giorno mercoledì 4 dicembre 2013 21:44:04 UTC+1, Richard ha scritto:
>>
>>> Hello,
>>>
>>> I try to print some pages today and found that there is a hyperlink 
>>> address that appear beside each link of the page even image, etc.
>>>
>>> I think it coming from Bootstrap right?
>>>
>>> How to shut this behavoir off!! Is there an easy way...
>>>
>>> I found this pretty annoying because it busted all the design of the 
>>> page and make the printed page ununderstandable.
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

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


Re: [web2py] hyperlink address when page print with browser seems coming form boostrap

2013-12-04 Thread Richard Vézina
Yes Paolo, it works great...

Many thanks for this...

I am curious where is it from though...

:)

Richard


On Wed, Dec 4, 2013 at 4:01 PM, Paolo Caruccio
wrote:

> Maybe this helps
> https://groups.google.com/d/msg/web2py/z_vjoBM9WlU/FLw7MCQIViMJ
>
>
> Il giorno mercoledì 4 dicembre 2013 21:44:04 UTC+1, Richard ha scritto:
>
>> Hello,
>>
>> I try to print some pages today and found that there is a hyperlink
>> address that appear beside each link of the page even image, etc.
>>
>> I think it coming from Bootstrap right?
>>
>> How to shut this behavoir off!! Is there an easy way...
>>
>> I found this pretty annoying because it busted all the design of the page
>> and make the printed page ununderstandable.
>>
>> Thanks
>>
>> Richard
>>
>  --
> 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] hyperlink address when page print with browser seems coming form boostrap

2013-12-04 Thread Paolo Caruccio
Maybe this helps 
https://groups.google.com/d/msg/web2py/z_vjoBM9WlU/FLw7MCQIViMJ


Il giorno mercoledì 4 dicembre 2013 21:44:04 UTC+1, Richard ha scritto:
>
> Hello,
>
> I try to print some pages today and found that there is a hyperlink 
> address that appear beside each link of the page even image, etc.
>
> I think it coming from Bootstrap right?
>
> How to shut this behavoir off!! Is there an easy way...
>
> I found this pretty annoying because it busted all the design of the page 
> and make the printed page ununderstandable.
>
> Thanks
>
> Richard
>

-- 
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: Modifying "A" helper callback behavior

2013-12-04 Thread Anthony
I think you're supposed to be able to do:

A(..., data=dict(w2p_disable_with=...))

but looks like there might be a bug in the A() code that prevents that from 
working properly right now.

Anthony

On Wednesday, December 4, 2013 3:00:49 PM UTC-5, pjryan126 wrote:
>
> Hi, everyone. I am working on a controller that loads a view into a 
> component when an anchor element is clicked. I am building the anchor using 
> the A helper in a manner similar to the following:
>
> A(SPAN(_class='span_class'), _class='a_class', _title='a_title', callback 
> = URL(c='default', f='page.load'), target = 'load_page')
>
> When I click the anchor element, the element is replaced briefly with a 
> "Working..." message. What I'm wondering is whether there is a way to 
> customize this behavior to display a spinning icon or make no change to the 
> button at all?
>
> Any help would be greatly appreciated. 
>
> Thanks,
> Patrick
>

-- 
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] hyperlink address when page print with browser seems coming form boostrap

2013-12-04 Thread Richard
Hello,

I try to print some pages today and found that there is a hyperlink address 
that appear beside each link of the page even image, etc.

I think it coming from Bootstrap right?

How to shut this behavoir off!! Is there an easy way...

I found this pretty annoying because it busted all the design of the page 
and make the printed page ununderstandable.

Thanks

Richard

-- 
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] RFC Proposal checkbox widget

2013-12-04 Thread Richard
:)

Le mercredi 4 décembre 2013 13:21:43 UTC-5, Massimo Di Pierro a écrit :
>
> Too late. I patched trunk already. ;-)
>
> On Wednesday, 4 December 2013 11:13:28 UTC-6, Richard wrote:
>>
>>
>>
>> Le lundi 2 décembre 2013 15:46:41 UTC-5, Richard a écrit :
>>>
>>> Hello,
>>>
>>> I set a label True/False flag for checkbox widget like so :
>>>
>>> class CheckboxesWidget(OptionsWidget):
>>>
>>> @classmethod
>>> def widget(cls, field, value, **attributes):
>>> """
>>> generates a TABLE tag, including INPUT checkboxes (multiple 
>>> allowed)
>>>
>>> see also: :meth:`FormWidget.widget`
>>> """
>>> # was values = re.compile('[\w\-:]+').findall(str(value))
>>> if isinstance(value, (list, tuple)):
>>> values = [str(v) for v in value]
>>> else:
>>> values = [str(value)]
>>>
>>> attr = cls._attributes(field, {}, **attributes)
>>> attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget')
>>>
>>> label = attr.get('label')
>>> if not isinstance(label, bool):
>>> label = True
>>> elif label is True:
>>> label = True
>>> elif label is False:
>>> label = False
>>>
>>> requires = field.requires
>>> if not isinstance(requires, (list, tuple)):
>>> requires = [requires]
>>> if requires and hasattr(requires[0], 'options'):
>>> options = requires[0].options()
>>> else:
>>> raise SyntaxError('widget cannot determine options of %s'
>>>   % field)
>>>
>>> options = [(k, v) for k, v in options if k != '']
>>> opts = []
>>> cols = attributes.get('cols', 1)
>>> totals = len(options)
>>> mods = totals % cols
>>> rows = totals / cols
>>> if mods:
>>> rows += 1
>>>
>>> #widget style
>>> wrappers = dict(
>>> table=(TABLE, TR, TD),
>>> ul=(DIV, UL, LI),
>>> divs=(CAT, DIV, DIV)
>>> )
>>> parent, child, inner = wrappers[attributes.get('style', 'table')]
>>>
>>> for r_index in range(rows):
>>> tds = []
>>> for k, v in options[r_index * cols:(r_index + 1) * cols]:
>>> if k in values:
>>> r_value = k
>>> else:
>>> r_value = []
>>> tds.append(inner(INPUT(_type='checkbox',
>>>_id='%s%s' % (field.name, k),
>>>_name=field.name,
>>>requires=attr.get('requires', 
>>> None),
>>>hideerror=True, _value=k,
>>>value=r_value),
>>>  LABEL(v, _for='%s%s' % (field.name, 
>>> k)) if label is True else ''))
>>> opts.append(child(tds))
>>>
>>> if opts:
>>> opts.append(
>>> INPUT(requires=attr.get('requires', None),
>>>   _style="display:none;",
>>>   _disabled="disabled",
>>>   _name=field.name,
>>>   hideerror=False))
>>> return parent(*opts, **attr)
>>>
>>> The purpose of this change is in context where a user need single 
>>> checkbox for each row of a grid where he don't need to display a label 
>>> beside the checkbox, since he only want to know which record is checked and 
>>> need to be updated...
>>>
>>> I need that in order to create a special form that allow bunch/batch 
>>> records update, see attach image (sorry I had to hide data of some 
>>> columns)... You can see, that each row has a checkbox that is generated 
>>> like this :
>>>
>>> form_fields = [Field('checkbox_%s' % r['table'].id, 'integer',
>>> 
>>>  requires=IS_EMPTY_OR(IS_IN_SET([r['table'].id])),
>>>  widget=lambda field, value: 
>>> SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=False)) 
>>> for r in rows]
>>>
>>> The form is then create with .factory() after adding the last fields of 
>>> the models that appears in the last line of the html table on the attach 
>>> image...
>>>
>>> I can, make the change on Git and send a PR, if this change is kind of 
>>> approved!!
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>

-- 
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: Spawning a thread or a process for a long-running task [urgent!]

2013-12-04 Thread Leonel Câmara
Instead of rerunning the task with period, schedule new tasks every time 
you need to go get the user's friends and have many scheduler workers if 
there's a chance you will have to do many of these in parallel. You should 
be able to lower the interval as much as you need, you could even reduce 
the scheduler heartbeat from the default 3 seconds.

-- 
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] Modifying "A" helper callback behavior

2013-12-04 Thread pjryan126
Hi, everyone. I am working on a controller that loads a view into a 
component when an anchor element is clicked. I am building the anchor using 
the A helper in a manner similar to the following:

A(SPAN(_class='span_class'), _class='a_class', _title='a_title', callback = 
URL(c='default', f='page.load'), target = 'load_page')

When I click the anchor element, the element is replaced briefly with a 
"Working..." message. What I'm wondering is whether there is a way to 
customize this behavior to display a spinning icon or make no change to the 
button at all?

Any help would be greatly appreciated. 

Thanks,
Patrick

-- 
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: Link to another controller from a load file

2013-12-04 Thread Anthony
Is you don't specify the controller in the URL() function, it assumes the 
current controller, so just do:

URL('default', 'product_listing', extension=False)

Anthony

On Wednesday, December 4, 2013 1:23:15 PM UTC-5, Gael Princivalle wrote:
>
> Thanks Anthony, now web2py try to load the html file.
> In the url I have now "hp/products_listing" instead of 
> "hp/products_listing.load", OK.
>
> But the controller is always the wrong one:
> invalid function (hp/products_listing)
>
> How can I ask to web2py to search for "product_listing" in the "default" 
> controller instead of the "hp" controller ?
>
> Have a nice day.
>
> Il giorno mercoledì 4 dicembre 2013 18:26:24 UTC+1, Anthony ha scritto:
>>
>> The URL() function will propagate the extension of the current request 
>> (which is .load in this case). To suppress the extension, do:
>>
>> URL('products_listing', extension=False)
>>
>> Anthony
>>
>> On Wednesday, December 4, 2013 12:06:44 PM UTC-5, Gael Princivalle wrote:
>>>
>>> Hello.
>>>
>>> I load a file inside a page:
>>> {{=LOAD('hp','hp.load', ajax=True, target='div_hp')}}
>>>
>>> Now inside this page I have a link to a function/view from the default 
>>> controller.
>>> {{=P(A('My link', _href=URL('products_listing')))}
>>>
>>> Reply is "invalid function (hp/products_listing)"
>>> In fact web2py tries to load the 'product_listing' function/view from 
>>> the current controller called hp, and not an html file but a load file:
>>> hp/products_listing.load
>>>
>>> How can I resolve this problem ? Of course I want to load the 
>>> product_listing page outside the div_hp DIV.
>>>
>>> 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: Online classes

2013-12-04 Thread Massimo Di Pierro
Yes. We are testing certification platform. We will start issuing 
certificates next week. ;-)

Massimo


On Wednesday, 4 December 2013 12:36:51 UTC-6, Doug Hauenstein wrote:
>
> Massimo
> Thank you for posting these. I just started learning Web2py and MVC in 
> general. I am only on video 1 but have already learned more in a few hours 
> than I have in days of reading and tutorials.
> Any plans to offer a certification program via  MOOC's?
>
> Doug
>
> On Tuesday, December 3, 2013 1:34:18 AM UTC-5, Massimo Di Pierro wrote:
>>
>> Hello everybody,
>>
>> As you know I teach a certification program about web development with 
>> Python and I use web2py. 
>> I posted my most recent classes online:
>>
>> https://vimeo.com/75499986
>> https://vimeo.com/76047107
>> https://vimeo.com/76608898
>> https://vimeo.com/77179700
>> https://vimeo.com/77654974
>>
>> It is about of 13 hours of web2py lessons and coding.
>> Please join me in thanking the students who enrolled in the program and 
>> supported these classes.
>>
>> Massimo
>>
>

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


[web2py] Digest for web2py@googlegroups.com - 25 Messages in 13 Topics

2013-12-04 Thread Tasman . J . Cross
Return Receipt
   
   Your   [web2py] Digest for web2py@googlegroups.com - 25 Messages in 
   document:  13 Topics
   
   wastasman.j.cr...@nab.com.au
   received
   by: 
   
   at:04/12/2013 08:43:09 AM   
   





The information contained in this email and its attachments may be confidential.
If you have received this email in error, please notify the sender by return 
email,
delete this email and destroy any copy.

Any advice contained in this email has been prepared without taking into 
account your objectives, financial situation or needs. Before acting on any 
advice in this email, National Australia Bank Limited ABN 12 004 044 937 AFSL 
and Australian Credit Licence 230686 (NAB) recommends that 
you consider whether it is appropriate for your circumstances. 
If this email contains reference to any financial products, NAB recommends 
you consider the Product Disclosure Statement (PDS) or other disclosure 
document available from NAB, before making any decisions regarding any 
products.

If this email contains any promotional content that you do not wish to receive, 
please reply to the original sender and write "Don't email promotional 
material" in the subject.

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


[web2py] Re: Online classes

2013-12-04 Thread Doug Hauenstein
Massimo
Thank you for posting these. I just started learning Web2py and MVC in 
general. I am only on video 1 but have already learned more in a few hours 
than I have in days of reading and tutorials.
Any plans to offer a certification program via  MOOC's?

Doug

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

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


[web2py] how to route with mod_proxy and path prefix

2013-12-04 Thread Peter Lai
I'm on 2.8.2, using apache 2.4 mod_proxy and routes.py (mod_proxy_html 
doesn't work with urls in javascript vars). I was able to use routes.py for 
the most part but it is adding extra prefixes to the request url that I 
seem to be unable to get rid off, even though I managed to get them routed 
properly.

In httpd.conf:

...
ProxyRequests Off
RewriteEngine On
RewriteRule ^/web2py$ /web2py/ [R,L]

RewriteRule ^/web2py/(.*) http://localhost:8000/$1 [P,L]
#ProxyPass /web2py/ http://localhost:8000/
ProxyPassReverse /web2py/ http://localhost:8000/
ProxyPassReverse /web2py/ /

ProxyPassReverseCookieDomain localhost localhost
ProxyPassReverseCookiePath / /web2py/

In global routes.py:

If I only use:

routes_out=((r'^/(?P.*)',r'/web2py/\g'),)

Then internal links/redirections fail because it will prepend /web2py to a 
relative URL, and the next client request will be proxied to 
http://localhost:8000/web2py/...

So if we add:
routes_in = ((r'^/web2py/(?P.*)', r'/\g'),)

Then relative URLs will work.

However, from the point of view of apache, the client is still in 
server/web2py/ space, so the url in the browser window looks like 
https://server/web2py/web2py/app/..

Is there a way to rewrite the URL to strip the extra 'web2py' from the path 
while maintaining functionality?

-- 
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: Link to another controller from a load file

2013-12-04 Thread Gael Princivalle
Thanks Anthony, now web2py try to load the html file.
In the url I have now "hp/products_listing" instead of 
"hp/products_listing.load", OK.

But the controller is always the wrong one:
invalid function (hp/products_listing)

How can I ask to web2py to search for "product_listing" in the "default" 
controller instead of the "hp" controller ?

Have a nice day.

Il giorno mercoledì 4 dicembre 2013 18:26:24 UTC+1, Anthony ha scritto:
>
> The URL() function will propagate the extension of the current request 
> (which is .load in this case). To suppress the extension, do:
>
> URL('products_listing', extension=False)
>
> Anthony
>
> On Wednesday, December 4, 2013 12:06:44 PM UTC-5, Gael Princivalle wrote:
>>
>> Hello.
>>
>> I load a file inside a page:
>> {{=LOAD('hp','hp.load', ajax=True, target='div_hp')}}
>>
>> Now inside this page I have a link to a function/view from the default 
>> controller.
>> {{=P(A('My link', _href=URL('products_listing')))}
>>
>> Reply is "invalid function (hp/products_listing)"
>> In fact web2py tries to load the 'product_listing' function/view from the 
>> current controller called hp, and not an html file but a load file:
>> hp/products_listing.load
>>
>> How can I resolve this problem ? Of course I want to load the 
>> product_listing page outside the div_hp DIV.
>>
>> 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.


Re: [web2py] RFC Proposal checkbox widget

2013-12-04 Thread Massimo Di Pierro
Too late. I patched trunk already. ;-)

On Wednesday, 4 December 2013 11:13:28 UTC-6, Richard wrote:
>
>
>
> Le lundi 2 décembre 2013 15:46:41 UTC-5, Richard a écrit :
>>
>> Hello,
>>
>> I set a label True/False flag for checkbox widget like so :
>>
>> class CheckboxesWidget(OptionsWidget):
>>
>> @classmethod
>> def widget(cls, field, value, **attributes):
>> """
>> generates a TABLE tag, including INPUT checkboxes (multiple 
>> allowed)
>>
>> see also: :meth:`FormWidget.widget`
>> """
>> # was values = re.compile('[\w\-:]+').findall(str(value))
>> if isinstance(value, (list, tuple)):
>> values = [str(v) for v in value]
>> else:
>> values = [str(value)]
>>
>> attr = cls._attributes(field, {}, **attributes)
>> attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget')
>>
>> label = attr.get('label')
>> if not isinstance(label, bool):
>> label = True
>> elif label is True:
>> label = True
>> elif label is False:
>> label = False
>>
>> requires = field.requires
>> if not isinstance(requires, (list, tuple)):
>> requires = [requires]
>> if requires and hasattr(requires[0], 'options'):
>> options = requires[0].options()
>> else:
>> raise SyntaxError('widget cannot determine options of %s'
>>   % field)
>>
>> options = [(k, v) for k, v in options if k != '']
>> opts = []
>> cols = attributes.get('cols', 1)
>> totals = len(options)
>> mods = totals % cols
>> rows = totals / cols
>> if mods:
>> rows += 1
>>
>> #widget style
>> wrappers = dict(
>> table=(TABLE, TR, TD),
>> ul=(DIV, UL, LI),
>> divs=(CAT, DIV, DIV)
>> )
>> parent, child, inner = wrappers[attributes.get('style', 'table')]
>>
>> for r_index in range(rows):
>> tds = []
>> for k, v in options[r_index * cols:(r_index + 1) * cols]:
>> if k in values:
>> r_value = k
>> else:
>> r_value = []
>> tds.append(inner(INPUT(_type='checkbox',
>>_id='%s%s' % (field.name, k),
>>_name=field.name,
>>requires=attr.get('requires', 
>> None),
>>hideerror=True, _value=k,
>>value=r_value),
>>  LABEL(v, _for='%s%s' % (field.name, k)) 
>> if label is True else ''))
>> opts.append(child(tds))
>>
>> if opts:
>> opts.append(
>> INPUT(requires=attr.get('requires', None),
>>   _style="display:none;",
>>   _disabled="disabled",
>>   _name=field.name,
>>   hideerror=False))
>> return parent(*opts, **attr)
>>
>> The purpose of this change is in context where a user need single 
>> checkbox for each row of a grid where he don't need to display a label 
>> beside the checkbox, since he only want to know which record is checked and 
>> need to be updated...
>>
>> I need that in order to create a special form that allow bunch/batch 
>> records update, see attach image (sorry I had to hide data of some 
>> columns)... You can see, that each row has a checkbox that is generated 
>> like this :
>>
>> form_fields = [Field('checkbox_%s' % r['table'].id, 'integer',
>>  requires=IS_EMPTY_OR(IS_IN_SET([r['table'].id])),
>>  widget=lambda field, value: 
>> SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=False)) 
>> for r in rows]
>>
>> The form is then create with .factory() after adding the last fields of 
>> the models that appears in the last line of the html table on the attach 
>> image...
>>
>> I can, make the change on Git and send a PR, if this change is kind of 
>> approved!!
>>
>> Thanks
>>
>> Richard
>>
>>

-- 
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: Link to another controller from a load file

2013-12-04 Thread Anthony
The URL() function will propagate the extension of the current request 
(which is .load in this case). To suppress the extension, do:

URL('products_listing', extension=False)

Anthony

On Wednesday, December 4, 2013 12:06:44 PM UTC-5, Gael Princivalle wrote:
>
> Hello.
>
> I load a file inside a page:
> {{=LOAD('hp','hp.load', ajax=True, target='div_hp')}}
>
> Now inside this page I have a link to a function/view from the default 
> controller.
> {{=P(A('My link', _href=URL('products_listing')))}
>
> Reply is "invalid function (hp/products_listing)"
> In fact web2py tries to load the 'product_listing' function/view from the 
> current controller called hp, and not an html file but a load file:
> hp/products_listing.load
>
> How can I resolve this problem ? Of course I want to load the 
> product_listing page outside the div_hp DIV.
>
> 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.


Re: [web2py] RFC Proposal checkbox widget

2013-12-04 Thread Richard


Le lundi 2 décembre 2013 15:46:41 UTC-5, Richard a écrit :
>
> Hello,
>
> I set a label True/False flag for checkbox widget like so :
>
> class CheckboxesWidget(OptionsWidget):
>
> @classmethod
> def widget(cls, field, value, **attributes):
> """
> generates a TABLE tag, including INPUT checkboxes (multiple 
> allowed)
>
> see also: :meth:`FormWidget.widget`
> """
> # was values = re.compile('[\w\-:]+').findall(str(value))
> if isinstance(value, (list, tuple)):
> values = [str(v) for v in value]
> else:
> values = [str(value)]
>
> attr = cls._attributes(field, {}, **attributes)
> attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget')
>
> label = attr.get('label')
> if not isinstance(label, bool):
> label = True
> elif label is True:
> label = True
> elif label is False:
> label = False
>
> requires = field.requires
> if not isinstance(requires, (list, tuple)):
> requires = [requires]
> if requires and hasattr(requires[0], 'options'):
> options = requires[0].options()
> else:
> raise SyntaxError('widget cannot determine options of %s'
>   % field)
>
> options = [(k, v) for k, v in options if k != '']
> opts = []
> cols = attributes.get('cols', 1)
> totals = len(options)
> mods = totals % cols
> rows = totals / cols
> if mods:
> rows += 1
>
> #widget style
> wrappers = dict(
> table=(TABLE, TR, TD),
> ul=(DIV, UL, LI),
> divs=(CAT, DIV, DIV)
> )
> parent, child, inner = wrappers[attributes.get('style', 'table')]
>
> for r_index in range(rows):
> tds = []
> for k, v in options[r_index * cols:(r_index + 1) * cols]:
> if k in values:
> r_value = k
> else:
> r_value = []
> tds.append(inner(INPUT(_type='checkbox',
>_id='%s%s' % (field.name, k),
>_name=field.name,
>requires=attr.get('requires', None),
>hideerror=True, _value=k,
>value=r_value),
>  LABEL(v, _for='%s%s' % (field.name, k)) 
> if label is True else ''))
> opts.append(child(tds))
>
> if opts:
> opts.append(
> INPUT(requires=attr.get('requires', None),
>   _style="display:none;",
>   _disabled="disabled",
>   _name=field.name,
>   hideerror=False))
> return parent(*opts, **attr)
>
> The purpose of this change is in context where a user need single checkbox 
> for each row of a grid where he don't need to display a label beside the 
> checkbox, since he only want to know which record is checked and need to be 
> updated...
>
> I need that in order to create a special form that allow bunch/batch 
> records update, see attach image (sorry I had to hide data of some 
> columns)... You can see, that each row has a checkbox that is generated 
> like this :
>
> form_fields = [Field('checkbox_%s' % r['table'].id, 'integer',
>  requires=IS_EMPTY_OR(IS_IN_SET([r['table'].id])),
>  widget=lambda field, value: 
> SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=False)) 
> for r in rows]
>
> The form is then create with .factory() after adding the last fields of 
> the models that appears in the last line of the html table on the attach 
> image...
>
> I can, make the change on Git and send a PR, if this change is kind of 
> approved!!
>
> Thanks
>
> Richard
>
>

-- 
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] Link to another controller from a load file

2013-12-04 Thread Gael Princivalle
Hello.

I load a file inside a page:
{{=LOAD('hp','hp.load', ajax=True, target='div_hp')}}

Now inside this page I have a link to a function/view from the default 
controller.
{{=P(A('My link', _href=URL('products_listing')))}

Reply is "invalid function (hp/products_listing)"
In fact web2py tries to load the 'product_listing' function/view from the 
current controller called hp, and not an html file but a load file:
hp/products_listing.load

How can I resolve this problem ? Of course I want to load the 
product_listing page outside the div_hp DIV.

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.


Re: [web2py] RFC Proposal checkbox widget

2013-12-04 Thread Richard Vézina
Would you use this patch instead...

I would prefer using my personal email instead... Tortoise Hg didn't use
the proper email even if I update .hgrc because I had to restart before :(

Thanks


Richard


On Wed, Dec 4, 2013 at 11:57 AM, Richard Vézina  wrote:

> Hello,
>
> I get in trouble with Github and can't commit when I make change for some
> reasons... The folks at github investigate about the issue...
>
> So here a patch, see attachement.
>
> Richard
>
>
> On Tue, Dec 3, 2013 at 5:25 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> yes please.
>>
>>
>> On Tuesday, 3 December 2013 12:00:54 UTC-6, Richard wrote:
>>
>>> Would you I make a patch on Github?
>>>
>>> Richard
>>>
>>>
>>> On Tue, Dec 3, 2013 at 12:58 PM, Massimo Di Pierro <
>>> massimo@gmail.com> wrote:
>>>
 I opened a ticket and will process asap.


 On Monday, 2 December 2013 14:46:41 UTC-6, Richard wrote:
>
> Hello,
>
> I set a label True/False flag for checkbox widget like so :
>
> class CheckboxesWidget(OptionsWidget):
>
> @classmethod
> def widget(cls, field, value, **attributes):
> """
> generates a TABLE tag, including INPUT checkboxes (multiple
> allowed)
>
> see also: :meth:`FormWidget.widget`
> """
> # was values = re.compile('[\w\-:]+').findall(str(value))
> if isinstance(value, (list, tuple)):
> values = [str(v) for v in value]
> else:
> values = [str(value)]
>
> attr = cls._attributes(field, {}, **attributes)
> attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget')
>
> label = attr.get('label')
> if not isinstance(label, bool):
> label = True
> elif label is True:
> label = True
> elif label is False:
> label = False
>
> requires = field.requires
> if not isinstance(requires, (list, tuple)):
> requires = [requires]
> if requires and hasattr(requires[0], 'options'):
> options = requires[0].options()
> else:
> raise SyntaxError('widget cannot determine options of %s'
>   % field)
>
> options = [(k, v) for k, v in options if k != '']
> opts = []
> cols = attributes.get('cols', 1)
> totals = len(options)
> mods = totals % cols
> rows = totals / cols
> if mods:
> rows += 1
>
> #widget style
> wrappers = dict(
> table=(TABLE, TR, TD),
> ul=(DIV, UL, LI),
> divs=(CAT, DIV, DIV)
> )
> parent, child, inner = wrappers[attributes.get('style',
> 'table')]
>
> for r_index in range(rows):
> tds = []
> for k, v in options[r_index * cols:(r_index + 1) * cols]:
> if k in values:
> r_value = k
> else:
> r_value = []
> tds.append(inner(INPUT(_type='checkbox',
>_id='%s%s' % (field.name, k),
>_name=field.name,
>requires=attr.get('requires',
> None),
>hideerror=True, _value=k,
>value=r_value),
>  LABEL(v, _for='%s%s' % (field.name,
> k)) if label is True else ''))
> opts.append(child(tds))
>
> if opts:
> opts.append(
> INPUT(requires=attr.get('requires', None),
>   _style="display:none;",
>   _disabled="disabled",
>   _name=field.name,
>   hideerror=False))
> return parent(*opts, **attr)
>
> The purpose of this change is in context where a user need single
> checkbox for each row of a grid where he don't need to display a label
> beside the checkbox, since he only want to know which record is checked 
> and
> need to be updated...
>
> I need that in order to create a special form that allow bunch/batch
> records update, see attach image (sorry I had to hide data of some
> columns)... You can see, that each row has a checkbox that is generated
> like this :
>
> form_fields = [Field('checkbox_%s' % r['table'].id, 'integer',
>  requires=IS_EMPTY_OR(IS_IN_SE
> T([r['table'].id])),
>   widget=lambda field, value:
> SQLFORM.widgets.checkboxes.widget(field, value, style='divs',
> label

Re: [web2py] URL link to external site

2013-12-04 Thread Rod Watkins
Works great! Thanks!!

Rod

On Wednesday, December 4, 2013 8:58:38 AM UTC-8, Anthony wrote:
>
> The URL() helper just generates a string, so in place of it, just put '
> http://forum.xxx.ca/MyBB'.
>
> Anthony
>
> On Wednesday, December 4, 2013 11:48:19 AM UTC-5, Rod Watkins wrote:
>>
>> But how do I create the link then? I ask because it is a link used as 
>> part of the primary menu system and it seems to only take a URL to create 
>> the link.
>>
>> Thanks again
>> Rod
>>
>>
>> On Wednesday, December 4, 2013 8:39:33 AM UTC-8, Jonathan Lundell wrote:
>>>
>>> On 4 Dec 2013, at 8:22 AM, Rod Watkins  wrote:
>>>
>>> I have a simple question that I haven't been able to find an answer to.
>>>
>>> I need to know how to use the URL helper to link to an external site. 
>>> Here is the code I am using:  URL(scheme='http', host='
>>> forum.xxx.ca/MyBB'). 
>>>
>>> But this appends the default app, controller and function to the end of 
>>> the link:http://forum.xxx.ca/MyBB/unity_gm/default/index
>>>
>>> How do I suppress the addition so it links properly?
>>>
>>>
>>> There's no reason to use URL() for external links. 
>>>
>>>

-- 
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] URL link to external site

2013-12-04 Thread Anthony
The URL() helper just generates a string, so in place of it, just put 
'http://forum.xxx.ca/MyBB'.

Anthony

On Wednesday, December 4, 2013 11:48:19 AM UTC-5, Rod Watkins wrote:
>
> But how do I create the link then? I ask because it is a link used as part 
> of the primary menu system and it seems to only take a URL to create the 
> link.
>
> Thanks again
> Rod
>
>
> On Wednesday, December 4, 2013 8:39:33 AM UTC-8, Jonathan Lundell wrote:
>>
>> On 4 Dec 2013, at 8:22 AM, Rod Watkins  wrote:
>>
>> I have a simple question that I haven't been able to find an answer to.
>>
>> I need to know how to use the URL helper to link to an external site. 
>> Here is the code I am using:  URL(scheme='http', host='
>> forum.xxx.ca/MyBB'). 
>>
>> But this appends the default app, controller and function to the end of 
>> the link:http://forum.xxx.ca/MyBB/unity_gm/default/index
>>
>> How do I suppress the addition so it links properly?
>>
>>
>> There's no reason to use URL() for external links. 
>>
>>

-- 
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] RFC Proposal checkbox widget

2013-12-04 Thread Richard Vézina
Hello,

I get in trouble with Github and can't commit when I make change for some
reasons... The folks at github investigate about the issue...

So here a patch, see attachement.

Richard


On Tue, Dec 3, 2013 at 5:25 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> yes please.
>
>
> On Tuesday, 3 December 2013 12:00:54 UTC-6, Richard wrote:
>
>> Would you I make a patch on Github?
>>
>> Richard
>>
>>
>> On Tue, Dec 3, 2013 at 12:58 PM, Massimo Di Pierro > > wrote:
>>
>>> I opened a ticket and will process asap.
>>>
>>>
>>> On Monday, 2 December 2013 14:46:41 UTC-6, Richard wrote:

 Hello,

 I set a label True/False flag for checkbox widget like so :

 class CheckboxesWidget(OptionsWidget):

 @classmethod
 def widget(cls, field, value, **attributes):
 """
 generates a TABLE tag, including INPUT checkboxes (multiple
 allowed)

 see also: :meth:`FormWidget.widget`
 """
 # was values = re.compile('[\w\-:]+').findall(str(value))
 if isinstance(value, (list, tuple)):
 values = [str(v) for v in value]
 else:
 values = [str(value)]

 attr = cls._attributes(field, {}, **attributes)
 attr['_class'] = attr.get('_class', 'web2py_checkboxeswidget')

 label = attr.get('label')
 if not isinstance(label, bool):
 label = True
 elif label is True:
 label = True
 elif label is False:
 label = False

 requires = field.requires
 if not isinstance(requires, (list, tuple)):
 requires = [requires]
 if requires and hasattr(requires[0], 'options'):
 options = requires[0].options()
 else:
 raise SyntaxError('widget cannot determine options of %s'
   % field)

 options = [(k, v) for k, v in options if k != '']
 opts = []
 cols = attributes.get('cols', 1)
 totals = len(options)
 mods = totals % cols
 rows = totals / cols
 if mods:
 rows += 1

 #widget style
 wrappers = dict(
 table=(TABLE, TR, TD),
 ul=(DIV, UL, LI),
 divs=(CAT, DIV, DIV)
 )
 parent, child, inner = wrappers[attributes.get('style',
 'table')]

 for r_index in range(rows):
 tds = []
 for k, v in options[r_index * cols:(r_index + 1) * cols]:
 if k in values:
 r_value = k
 else:
 r_value = []
 tds.append(inner(INPUT(_type='checkbox',
_id='%s%s' % (field.name, k),
_name=field.name,
requires=attr.get('requires',
 None),
hideerror=True, _value=k,
value=r_value),
  LABEL(v, _for='%s%s' % (field.name,
 k)) if label is True else ''))
 opts.append(child(tds))

 if opts:
 opts.append(
 INPUT(requires=attr.get('requires', None),
   _style="display:none;",
   _disabled="disabled",
   _name=field.name,
   hideerror=False))
 return parent(*opts, **attr)

 The purpose of this change is in context where a user need single
 checkbox for each row of a grid where he don't need to display a label
 beside the checkbox, since he only want to know which record is checked and
 need to be updated...

 I need that in order to create a special form that allow bunch/batch
 records update, see attach image (sorry I had to hide data of some
 columns)... You can see, that each row has a checkbox that is generated
 like this :

 form_fields = [Field('checkbox_%s' % r['table'].id, 'integer',
  requires=IS_EMPTY_OR(IS_IN_SE
 T([r['table'].id])),
  widget=lambda field, value:
 SQLFORM.widgets.checkboxes.widget(field, value, style='divs',
 label=False)) for r in rows]

 The form is then create with .factory() after adding the last fields of
 the models that appears in the last line of the html table on the attach
 image...

 I can, make the change on Git and send a PR, if this change is kind of
 approved!!

 Thanks

 Richard

  --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> -

[web2py] Re: Add extra fields to db.auth_user

2013-12-04 Thread Gael Princivalle
Thanks a lot Massimo, in fact I've made testing on an existing user. Now 
with requires=IS_NOT_EMPTY() the form ask to fill the company field. 
Perfect.

For problem 2 I'm gone define my own auth_user table, have a nice day.

Il giorno mercoledì 4 dicembre 2013 16:29:14 UTC+1, Massimo Di Pierro ha 
scritto:
>
> I cannot reproduce problem 1. There is nothing wrong in your code and 
> something else is causing the problem. Are you sure the issue is that "A 
> user can register without filling this field." or is it the users who 
> registered before the contraint was introduced do not have a company field?
>
> Problem 2. To fix that you need define your own auth_user table. If you do:
>
> db.define_table('auth_user', )
>
> before auth.define_tables() it should use yours.
>
> On Tuesday, 3 December 2013 09:14:02 UTC-6, Gael Princivalle wrote:
>>
>> Hi.
>>
>> I've had extra fields to db.auth_user like that in db.py:
>>
>> auth = Auth(db)
>> auth.settings.extra_fields['auth_user']= [Field('Company', 
>> requires=IS_NOT_EMPTY()),Field('Phone')]
>>
>> Problem n°1, requires=IS_NOT_EMPTY() don't have any effect. A user can 
>> register without filling this field.
>>
>> Problem n° 2, Company and Phone fields are in the form after passwords 
>> field, I would like to change the fild order.
>>
>> How can I do it ?
>>
>> 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.


Re: [web2py] URL link to external site

2013-12-04 Thread Rod Watkins
But how do I create the link then? I ask because it is a link used as part 
of the primary menu system and it seems to only take a URL to create the 
link.

Thanks again
Rod


On Wednesday, December 4, 2013 8:39:33 AM UTC-8, Jonathan Lundell wrote:
>
> On 4 Dec 2013, at 8:22 AM, Rod Watkins > 
> wrote:
>
> I have a simple question that I haven't been able to find an answer to.
>
> I need to know how to use the URL helper to link to an external site. Here 
> is the code I am using:  URL(scheme='http', host='forum.xxx.ca/MyBB'
> ). 
>
> But this appends the default app, controller and function to the end of 
> the link:http://forum.xxx.ca/MyBB/unity_gm/default/index
>
> How do I suppress the addition so it links properly?
>
>
> There's no reason to use URL() for external links. 
>
>

-- 
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] bulk_upload to GAE development datastore no longer works?

2013-12-04 Thread David Manns
My application runs on GAE. Using Google's bulk loader I make occasional 
backups of the database. It used to be that I could use the GAE SDK (appcfg 
tool in this case) to upload all the data into the development server on my 
development machine, thus creating the full data context for the SDK.

This now fails. I'm not sure (or if) how the remote_api validates the 
provided email/password, but the results are the same failure with all 
sensible choices of password, e.g. the primary google account password (the 
account owns the app on GAE), the application specific password used for 
the bulk download for GAE (the gmail account uses 2 factor authentication), 
or no password.

I attach the script used to run the development upload (which used to work 
until recently) and the command window output from running it. Also the 
app.yaml file.

Anyone have any idea what the problem might be?

-- 
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.
Loading test data from "ocsnedb20131204.bak"
11:31 AM Uploading data records.
[INFO] Logging to bulkloader-log-20131204.113157
[INFO] Throttling transfers:
[INFO] Bandwidth: 25 bytes/second
[INFO] HTTP connections: 8/second
[INFO] Entities inserted/fetched/modified: 20/second
[INFO] Batch Size: 10
Please enter login credentials for localhost:8081
Email: dgma...@gmail.com
Password for dgma...@gmail.com:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 196, in

run_file(__file__, globals())
  File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 192, in
run_file
execfile(script_path, globals_)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4810, in 
main(sys.argv)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4801, in main
result = AppCfgApp(argv).Run()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 2611, in Run
self.action(self)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4495, in __call__
return method()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4307, in PerformUpload
run_fn(args)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4198, in RunBulkloader
sys.exit(bulkloader.Run(arg_dict))
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4408, in Run
return _PerformBulkload(arg_dict)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4194, in _PerformBulkload
throttle_class=throttle_class)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4101, in _GetRemoteAppId
rpc_server_factory=throttled_rpc_server_factory, secure=secure)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remo
te_api\remote_api_stub.py", line 659, in GetRemoteAppId
app_id = GetRemoteAppIdFromServer(server, path, rtok)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remo
te_api\remote_api_stub.py", line 568, in GetRemoteAppIdFromServer
response = server.Send(path, payload=None, **urlargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pengine_rpc.py", line 409, in Send
f = self.opener.open(req)
  File "C:\Python27\lib\urllib2.py", line 404, in open
response = self._open(req, data)
  File "C:\Python27\lib\urllib2.py", line 422, in _open
'_open', req)
  File "C:\Python27\lib\urllib2.py", line 382, in _call_chain
result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File "C:\Python27\lib\urllib2.py", line 1184, in do_open
raise URLError(err)
urllib2.URLError: 
Press any key to continue . . .

app.yaml
Description: Binary data
@ECHO OFF
FOR /F "tokens=1-4 delims=/ " %%I IN ('DATE /t') DO SET mydate=%%L%%J%%K
ECHO Backing up to "ocsnedb%mydate%.bak"
appcfg.py download_data --url=http://ocsnedb-hrd.appspot.com/_ah/remote_api 
--filename=ocsnedb%mydate%.bak
pause

Re: [web2py] URL link to external site

2013-12-04 Thread Jonathan Lundell
On 4 Dec 2013, at 8:22 AM, Rod Watkins  wrote:

> I have a simple question that I haven't been able to find an answer to.
> 
> I need to know how to use the URL helper to link to an external site. Here is 
> the code I am using:  URL(scheme='http', host='forum.xxx.ca/MyBB'). 
> 
> But this appends the default app, controller and function to the end of the 
> link:http://forum.xxx.ca/MyBB/unity_gm/default/index
> 
> How do I suppress the addition so it links properly?

There's no reason to use URL() for external links. 

-- 
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: resizing uploaded image file upload using gluon.contrib.imageutils

2013-12-04 Thread Richard Vézina
I wrote this slice sometimes ago :
http://www.web2pyslices.com/slice/show/1666/improved-smarthumb

There is an improve version at the bottom post in the comment by
faultymonk

It mays help you or not...

Richard


On Wed, Dec 4, 2013 at 6:53 AM, 黄祥  wrote:

> i can't figure it out how to use RESIZE, but i still can use THUMB.
>
> tested in windows 7, web2py both windows binary and source and python pil
> for windows installed.
>
> after all, this what i'm not looking for, at first, i think it's related
> with image size, but i realize, it's just the css that already there set up
> by twitter bootstrap value. so i just force the style width and height
> value.
>
> thanks and best regards,
> stifan
>
> --
> 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] URL link to external site

2013-12-04 Thread Rod Watkins
Hello,

I have a simple question that I haven't been able to find an answer to.

I need to know how to use the URL helper to link to an external site. Here 
is the code I am using:  URL(scheme='http', host='forum.xxx.ca/MyBB'). 

But this appends the default app, controller and function to the end of the 
link: http://forum.xxx.ca/MyBB/unity_gm/default/index

How do I suppress the addition so it links properly?

Thanks for your help.

Rod

-- 
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: After upgrade to 2.8.2: foreign key constraint failed

2013-12-04 Thread Scott Hunter
Aha -- I had reference fields, one of which was empty, and they used the 
default validator, which does not allow for that.  I specified the 
validators for those fields, and that did the trick.  

Shouldn't this have been reported as an error in the form ("Field 
Required", or somesuch), and not have generated a ticket?

And shouldn't the fact that this is a new requirement for reference fields 
(or at least a new default setting) be included in the release notes for 
this version?

Thanks!

On Wednesday, December 4, 2013 3:06:05 AM UTC-5, Paolo Valleri wrote:
>
> Web2py 2.8.2 comes with foreign_keys=ON enabled by default (see 
> http://www.sqlite.org/foreignkeys.html)
> If you get the issue you mentioned I guess you are violating a foreign key 
> constrain.
> Please post your model (or the tables definitions involved) so that we can 
> figure out what is wrong
>
> Paolo
>
> On Wednesday, December 4, 2013 3:26:32 AM UTC+1, Scott Hunter wrote:
>>
>> I have a site which, after upgrading to 2.8.2 (and clearing out the 
>> sessions), when I try update a record via a smartgrid or via admin, I get 
>> the error in the title.  I tried the same action on the copy of the site I 
>> had made just before upgrading, without any problems.
>>
>> This is from OSX 10.9.
>>
>

-- 
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: unable to default SQLFORM option widget to current field value

2013-12-04 Thread Ivo
Thank you Anthony that works perfectly!

On Wednesday, December 4, 2013 4:44:13 PM UTC+1, Anthony wrote:
>
> You have created a custom widget, but the widget code doesn't set the 
> default value of the widget based on the "value" argument to the widget. 
> Try changing:
>
> seed = SELECT(**attr)
> for branch in tree:
> seed.append(branch)
>
> to:
>
> seed = SELECT(*tree, value=value, **attr)
>
> Anthony
>
> On Wednesday, December 4, 2013 9:29:22 AM UTC-5, Ivo wrote:
>>
>> default.py:
>> def products():
>> edit_in_form = 'edit' in request.args
>> db.product.price.writable = not edit_in_form
>>
>> grid = SQLFORM.grid(db.product, 
>> columns=[
>>  db.product.name,
>>  db.product.price,
>>  ],
>> )
>>
>> return dict(
>> buttons=grid.gridbuttons,
>> grid=grid)
>>
>> db.py:
>> db.define_table('product',
>>
>>Field('name',length=512),
>>Field('user_id', db.auth_user),
>>Field('category'), #db.category
>>Field('price'),
>>)
>> db.product.category.widget = category.select_widget()
>>
>> here's the widget itself:
>>
>> def select_widget(self):
>> categories = self._db().select(
>> self._db[self._tablename].ALL, 
>> orderby=self._db[self._tablename].lft
>> )
>> def widget(field, value, **attributes):
>> rgt = []
>> 
>> tree = []
>> 
>> attr = OptionsWidget._attributes(field, {}, **attributes)
>> 
>> values = re.compile('[\w\-:]+').findall(str(value))
>> 
>> if hasattr(field.requires, 'options'):
>> opts = []
>> options = field.requires.options()
>> tree.append(OPTION(_value="", _class="branch"))
>> for cat in categories:
>> if len(rgt) > 0:
>> if rgt[-1] > cat.rgt:
>> # open UL
>> pass
>> while rgt[-1] < cat.rgt:
>> rgt.pop()
>> if len(rgt) == 0:
>> break
>>  
>> s = ""
>> for i in range(len(rgt)):
>> s += ""
>> s += cat.name
>> branch = OPTION(
>> XML(s),
>> _value=cat.id,
>> _class="branch",
>> )
>> 
>> tree.append(branch)   
>> rgt.append(cat.rgt)
>> 
>> seed = SELECT(**attr)
>>   
>> for branch in tree:
>> seed.append(branch)
>> 
>> return seed
>> return widget
>>
>>
>>
>>
>> On Wednesday, December 4, 2013 2:56:24 PM UTC+1, Anthony wrote:
>>>
>>> Doesn't sound right. Can you show your code?
>>>
>>> On Wednesday, December 4, 2013 5:11:25 AM UTC-5, Ivo wrote:

 Is there a way to default the option widget to the current field value?
 The thing is that when you edit a form, the option widget always 
 defaults to empty (you need to make a selection even if the field already 
 contains a value). I'm quite sure a lot of users will not notice that the 
 select is empty, overriding the existing value upon save. They should 
 however need to be able to change the value if they choose to. I prefer to 
 do it from the controller side if possible.



-- 
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: Using find on cached queries

2013-12-04 Thread Anthony
First, if you are using cache=..., you do not also need to set 
cacheable=True. Using the former, the DAL automatically handles caching for 
you. Setting cacheable=True is only for cases where you want to manually 
cache the Rows object, so you wouldn't be using cache=... in that case.

Second, the .find() method is a method of the Rows object and has nothing 
to do with caching. It loops through the records in the Rows object and 
extracts just the Rows that satisfy the search criteria. In this case, your 
filter function includes row.contato.site, which is a recursive select, so 
it is doing an additional db select for every Row in reports. Furthermore, 
you are not caching the testdrives object, so this happens on every 
request, even if the reports object has been cached.

Instead of using the .find() method to filter the reports objects, it would 
probably be much more efficient to simply do an additional database query 
to get the testdrives records, using either a join or a nested select.

Anthony

On Wednesday, December 4, 2013 10:13:10 AM UTC-5, Tito Garrido wrote:
>
> Hi Folks,
>
> I have report function that is caching my query, example:
> def report():
> sites=db(db.site.ativo==True).select(db.site.id
> ,db.site.nome,cache=(cache.ram,6000),cacheable=True)
> lojas=db(db.estoque.ativo==True).select(db.estoque.id
> ,db.estoque.nome,cache=(cache.ram,6000),cacheable=True)
> reports=db(db.report.id
> >0).select(groupby=db.report.carro,cache=(cache.ram,6000),cacheable=True)
> if request.vars.filtro_site: # WHEN I USE THIS VARIABLE IT GETS SLOW
> site=int(request.vars.filtro_site)
> testdrives=reports.find(lambda row: site in row.contato.site if 
> row.contato.site else None)
> if request.vars.filtro_loja: # WHEN I USE THIS VARIABLE IT GETS SLOW
> loja=int(request.vars.filtro_loja)
> testdrives=reports.find(lambda row: loja in row.contato.loja if 
> row.contato.loja else None)
> return 
> dict(section='relatorio',testdrives=testdrives,lojas=lojas,sites=sites)
>
> So, when I use "request.vars" and the find function it gets pretty slow, 
> is it using the cache to execute the find function? Most of the time I am 
> getting timeout from the webserver.
>
> Regards,
>
> Tito
>
> -- 
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___ 
>

-- 
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: unable to default SQLFORM option widget to current field value

2013-12-04 Thread Anthony
You have created a custom widget, but the widget code doesn't set the 
default value of the widget based on the "value" argument to the widget. 
Try changing:

seed = SELECT(**attr)
for branch in tree:
seed.append(branch)

to:

seed = SELECT(*tree, value=value, **attr)

Anthony

On Wednesday, December 4, 2013 9:29:22 AM UTC-5, Ivo wrote:
>
> default.py:
> def products():
> edit_in_form = 'edit' in request.args
> db.product.price.writable = not edit_in_form
>
> grid = SQLFORM.grid(db.product, 
> columns=[
>  db.product.name,
>  db.product.price,
>  ],
> )
>
> return dict(
> buttons=grid.gridbuttons,
> grid=grid)
>
> db.py:
> db.define_table('product',
>
>Field('name',length=512),
>Field('user_id', db.auth_user),
>Field('category'), #db.category
>Field('price'),
>)
> db.product.category.widget = category.select_widget()
>
> here's the widget itself:
>
> def select_widget(self):
> categories = self._db().select(
> self._db[self._tablename].ALL, 
> orderby=self._db[self._tablename].lft
> )
> def widget(field, value, **attributes):
> rgt = []
> 
> tree = []
> 
> attr = OptionsWidget._attributes(field, {}, **attributes)
> 
> values = re.compile('[\w\-:]+').findall(str(value))
> 
> if hasattr(field.requires, 'options'):
> opts = []
> options = field.requires.options()
> tree.append(OPTION(_value="", _class="branch"))
> for cat in categories:
> if len(rgt) > 0:
> if rgt[-1] > cat.rgt:
> # open UL
> pass
> while rgt[-1] < cat.rgt:
> rgt.pop()
> if len(rgt) == 0:
> break
>  
> s = ""
> for i in range(len(rgt)):
> s += ""
> s += cat.name
> branch = OPTION(
> XML(s),
> _value=cat.id,
> _class="branch",
> )
> 
> tree.append(branch)   
> rgt.append(cat.rgt)
> 
> seed = SELECT(**attr)
>   
> for branch in tree:
> seed.append(branch)
> 
> return seed
> return widget
>
>
>
>
> On Wednesday, December 4, 2013 2:56:24 PM UTC+1, Anthony wrote:
>>
>> Doesn't sound right. Can you show your code?
>>
>> On Wednesday, December 4, 2013 5:11:25 AM UTC-5, Ivo wrote:
>>>
>>> Is there a way to default the option widget to the current field value?
>>> The thing is that when you edit a form, the option widget always 
>>> defaults to empty (you need to make a selection even if the field already 
>>> contains a value). I'm quite sure a lot of users will not notice that the 
>>> select is empty, overriding the existing value upon save. They should 
>>> however need to be able to change the value if they choose to. I prefer to 
>>> do it from the controller side if possible.
>>>
>>>

-- 
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: Error in using the web2py.app.dataspreadsheets.w2p

2013-12-04 Thread P T
Thank you, I opened a ticket 
http://code.google.com/p/web2py/issues/detail?id=1800


On Wednesday, December 4, 2013 8:42:24 AM UTC-6, Massimo Di Pierro wrote:
>
> please open a ticket, this is clearly a bug.
>
> On Tuesday, 3 December 2013 23:34:33 UTC-6, P T wrote:
>>
>> I am using Web2py 2.8.2 source and installed installed the app 
>>  web2py.app.dataspreadsheets.w2p from 
>> https://code.google.com/p/web2py/issues/detail?id=860#c1 and getting the 
>> following errors:
>>
>> 1) Cannot import module 'simplejson'
>>
>> Ticket ID
>>  127.0.0.1.2013-12-03.23-17-52.b5368c20-df03-4a22-b20e-35dab70c9eb0
>>   Cannot import module 'simplejson'
>>  Version
>>  web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
>>  Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)
>>
>>
>> This is resolved by changing the line 4 in default.py from "import 
>> simplejson" to "from gluon.contrib import simplejson"
>>
>> With this I am able to access all pages except for database driven pages, 
>> which generate the following error.
>>
>> 2) global name '_class' is not defined
>>
>> Ticket ID
>> 127.0.0.1.2013-12-03.23-21-14.e61d83f2-af1b-4d39-88cf-59909da11f56
>>
>>  global name '_class' is not defined
>>
>> Version
>> web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
>> Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)
>> Traceback (most recent call last):
>>   File "C:\web2py-src\gluon\restricted.py", line 217, in restricted
>> exec ccode in environment
>>   File 
>> "C:\web2py-src\applications\SpreadSheet\views\default/database_first.html", 
>> line 119, in 
>>   File "C:\web2py-src\gluon\globals.py", line 381, in write
>> self.body.write(xmlescape(data))
>>   File "C:\web2py-src\gluon\html.py", line 120, in xmlescape
>> return data.xml()
>>   File "C:\web2py-src\gluon\contrib\spreadsheet.py", line 873, in xml
>> return self.sheet().xml()
>>   File "C:\web2py-src\gluon\contrib\spreadsheet.py", line 862, in sheet
>> attributes["_class"]}))
>> NameError: global name '_class' is not defined
>>
>> Can somebody help me to fix this?
>>
>> Thanks,
>> PT
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: Add extra fields to db.auth_user

2013-12-04 Thread Massimo Di Pierro
I cannot reproduce problem 1. There is nothing wrong in your code and 
something else is causing the problem. Are you sure the issue is that "A 
user can register without filling this field." or is it the users who 
registered before the contraint was introduced do not have a company field?

Problem 2. To fix that you need define your own auth_user table. If you do:

db.define_table('auth_user', )

before auth.define_tables() it should use yours.

On Tuesday, 3 December 2013 09:14:02 UTC-6, Gael Princivalle wrote:
>
> Hi.
>
> I've had extra fields to db.auth_user like that in db.py:
>
> auth = Auth(db)
> auth.settings.extra_fields['auth_user']= [Field('Company', 
> requires=IS_NOT_EMPTY()),Field('Phone')]
>
> Problem n°1, requires=IS_NOT_EMPTY() don't have any effect. A user can 
> register without filling this field.
>
> Problem n° 2, Company and Phone fields are in the form after passwords 
> field, I would like to change the fild order.
>
> How can I do it ?
>
> 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] Using find on cached queries

2013-12-04 Thread Tito Garrido
Hi Folks,

I have report function that is caching my query, example:
def report():
sites=db(db.site.ativo==True).select(db.site.id
,db.site.nome,cache=(cache.ram,6000),cacheable=True)
lojas=db(db.estoque.ativo==True).select(db.estoque.id
,db.estoque.nome,cache=(cache.ram,6000),cacheable=True)
reports=db(db.report.id
>0).select(groupby=db.report.carro,cache=(cache.ram,6000),cacheable=True)
if request.vars.filtro_site: # WHEN I USE THIS VARIABLE IT GETS SLOW
site=int(request.vars.filtro_site)
testdrives=reports.find(lambda row: site in row.contato.site if
row.contato.site else None)
if request.vars.filtro_loja: # WHEN I USE THIS VARIABLE IT GETS SLOW
loja=int(request.vars.filtro_loja)
testdrives=reports.find(lambda row: loja in row.contato.loja if
row.contato.loja else None)
return
dict(section='relatorio',testdrives=testdrives,lojas=lojas,sites=sites)

So, when I use "request.vars" and the find function it gets pretty slow, is
it using the cache to execute the find function? Most of the time I am
getting timeout from the webserver.

Regards,

Tito

-- 

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

-- 
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: Add extra fields to db.auth_user

2013-12-04 Thread Gael Princivalle
Thanks James but also required=True don't have any effect. Perhaps I have 
to make a custom form or register, do you know I can do it ? 

Il giorno martedì 3 dicembre 2013 19:56:39 UTC+1, James Burke ha scritto:
>
> For problem no1, you could try using required=True instead of 
> requires=IS_NOT_EMPTY()
>
> For your second problem you can define the auth_user table yourself (from 
> web2py book):
>
> Another way to do this, although not really recommended, consists of 
> defining your auth tables yourself. If a table is declared before 
> auth.define_tables() it is used instead of the default one. Here is how 
> to do it:
>
> ## after auth = Auth(db)
> db.define_table(
> auth.settings.table_user_name,
> Field('first_name', length=128, default=''),
> Field('last_name', length=128, default=''),
> Field('email', length=128, default='', unique=True), # required
> Field('password', 'password', length=512,# required
>   readable=False, label='Password'),
> Field('address'),
> Field('city'),
> Field('zip'),
> Field('phone'),
> Field('registration_key', length=512,# required
>   writable=False, readable=False, default=''),
> Field('reset_password_key', length=512,  # required
>   writable=False, readable=False, default=''),
> Field('registration_id', length=512, # required
>   writable=False, readable=False, default=''))
>
> ## do not forget validators
> custom_auth_table = db[auth.settings.table_user_name] # get the 
> custom_auth_table
> custom_auth_table.first_name.requires =   
> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> custom_auth_table.last_name.requires =   
> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> custom_auth_table.password.requires = [IS_STRONG(), CRYPT()]
> custom_auth_table.email.requires = [
>   IS_EMAIL(error_message=auth.messages.invalid_email),
>   IS_NOT_IN_DB(db, custom_auth_table.email)]
>
> auth.settings.table_user = custom_auth_table # tell auth to use 
> custom_auth_table
>
> ## before auth.define_tables()
>
>

-- 
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: Error in using the web2py.app.dataspreadsheets.w2p

2013-12-04 Thread Massimo Di Pierro
please open a ticket, this is clearly a bug.

On Tuesday, 3 December 2013 23:34:33 UTC-6, P T wrote:
>
> I am using Web2py 2.8.2 source and installed installed the app 
>  web2py.app.dataspreadsheets.w2p from 
> https://code.google.com/p/web2py/issues/detail?id=860#c1 and getting the 
> following errors:
>
> 1) Cannot import module 'simplejson'
>
> Ticket ID
>  127.0.0.1.2013-12-03.23-17-52.b5368c20-df03-4a22-b20e-35dab70c9eb0
>   Cannot import module 'simplejson'
>  Version
>  web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
>  Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)
>
>
> This is resolved by changing the line 4 in default.py from "import 
> simplejson" to "from gluon.contrib import simplejson"
>
> With this I am able to access all pages except for database driven pages, 
> which generate the following error.
>
> 2) global name '_class' is not defined
>
> Ticket ID
> 127.0.0.1.2013-12-03.23-21-14.e61d83f2-af1b-4d39-88cf-59909da11f56
>
>  global name '_class' is not defined
>
> Version
> web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
> Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)
> Traceback (most recent call last):
>   File "C:\web2py-src\gluon\restricted.py", line 217, in restricted
> exec ccode in environment
>   File 
> "C:\web2py-src\applications\SpreadSheet\views\default/database_first.html", 
> line 119, in 
>   File "C:\web2py-src\gluon\globals.py", line 381, in write
> self.body.write(xmlescape(data))
>   File "C:\web2py-src\gluon\html.py", line 120, in xmlescape
> return data.xml()
>   File "C:\web2py-src\gluon\contrib\spreadsheet.py", line 873, in xml
> return self.sheet().xml()
>   File "C:\web2py-src\gluon\contrib\spreadsheet.py", line 862, in sheet
> attributes["_class"]}))
> NameError: global name '_class' is not defined
>
> Can somebody help me to fix this?
>
> Thanks,
> PT
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: unable to default SQLFORM option widget to current field value

2013-12-04 Thread Ivo
default.py:
def products():
edit_in_form = 'edit' in request.args
db.product.price.writable = not edit_in_form

grid = SQLFORM.grid(db.product, 
columns=[
 db.product.name,
 db.product.price,
 ],
)

return dict(
buttons=grid.gridbuttons,
grid=grid)

db.py:
db.define_table('product',
   
   Field('name',length=512),
   Field('user_id', db.auth_user),
   Field('category'), #db.category
   Field('price'),
   )
db.product.category.widget = category.select_widget()

here's the widget itself:

def select_widget(self):
categories = self._db().select(
self._db[self._tablename].ALL, 
orderby=self._db[self._tablename].lft
)
def widget(field, value, **attributes):
rgt = []

tree = []

attr = OptionsWidget._attributes(field, {}, **attributes)

values = re.compile('[\w\-:]+').findall(str(value))

if hasattr(field.requires, 'options'):
opts = []
options = field.requires.options()
tree.append(OPTION(_value="", _class="branch"))
for cat in categories:
if len(rgt) > 0:
if rgt[-1] > cat.rgt:
# open UL
pass
while rgt[-1] < cat.rgt:
rgt.pop()
if len(rgt) == 0:
break
 
s = ""
for i in range(len(rgt)):
s += ""
s += cat.name
branch = OPTION(
XML(s),
_value=cat.id,
_class="branch",
)

tree.append(branch)   
rgt.append(cat.rgt)

seed = SELECT(**attr)
  
for branch in tree:
seed.append(branch)

return seed
return widget




On Wednesday, December 4, 2013 2:56:24 PM UTC+1, Anthony wrote:
>
> Doesn't sound right. Can you show your code?
>
> On Wednesday, December 4, 2013 5:11:25 AM UTC-5, Ivo wrote:
>>
>> Is there a way to default the option widget to the current field value?
>> The thing is that when you edit a form, the option widget always defaults 
>> to empty (you need to make a selection even if the field already contains a 
>> value). I'm quite sure a lot of users will not notice that the select is 
>> empty, overriding the existing value upon save. They should however need to 
>> be able to change the value if they choose to. I prefer to do it from the 
>> controller side if possible.
>>
>>

-- 
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: login crash under 2.8.2

2013-12-04 Thread lucas
any ideas on this exception and trace?  a little anxious about it because 
my site is essentially offline.  lucas

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


[web2py] Re: unable to default SQLFORM option widget to current field value

2013-12-04 Thread Anthony
Doesn't sound right. Can you show your code?

On Wednesday, December 4, 2013 5:11:25 AM UTC-5, Ivo wrote:
>
> Is there a way to default the option widget to the current field value?
> The thing is that when you edit a form, the option widget always defaults 
> to empty (you need to make a selection even if the field already contains a 
> value). I'm quite sure a lot of users will not notice that the select is 
> empty, overriding the existing value upon save. They should however need to 
> be able to change the value if they choose to. I prefer to do it from the 
> controller side if possible.
>
>

-- 
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.flash to another view

2013-12-04 Thread Anthony
session.flash = 'thank you for filling the reg form'
redirect(URL(request.application, 'default', 'index'))

Anthony

On Wednesday, December 4, 2013 8:29:19 AM UTC-5, Yebach wrote:
>
> Hello
>
> After a new user registers I have a redirect to index page 
> (redirect(URL(request.application, 'default', 'index'))). I would like the 
> response.flash windows (popup or whatever you call it) such as "thank you 
> for filing the reg form"  to be shown in the default index.html page.
>
> any suggestions
>
> thank you
>

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


[web2py] response.flash to another view

2013-12-04 Thread Yebach
Hello

After a new user registers I have a redirect to index page 
(redirect(URL(request.application, 'default', 'index'))). I would like the 
response.flash windows (popup or whatever you call it) such as "thank you 
for filing the reg form"  to be shown in the default index.html page.

any suggestions

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.


Re: [web2py] Re: SQLFORM.grid edit form restrictions

2013-12-04 Thread 黄祥
i think you can achieve it by improve the above example.
e.g. not tested

edit_in_form = 'edit' in request.args

if not edit_in_form:
db.product.price.label = T('Price Uneditable') 
else:
db.product.price.label = T('Price Editable') 

best regards,
stifan

-- 
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: resizing uploaded image file upload using gluon.contrib.imageutils

2013-12-04 Thread 黄祥
i can't figure it out how to use RESIZE, but i still can use THUMB.

tested in windows 7, web2py both windows binary and source and python pil 
for windows installed.

after all, this what i'm not looking for, at first, i think it's related 
with image size, but i realize, it's just the css that already there set up 
by twitter bootstrap value. so i just force the style width and height 
value.

thanks and best regards,
stifan

-- 
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: SQLFORM.grid edit form restrictions

2013-12-04 Thread Ivo
Thanks Stifan

do you by any chance know how I can manipulate field values for the edit 
view, for example change the form labels and field values if they are read 
only? 

On Wednesday, December 4, 2013 9:00:23 AM UTC+1, 黄祥 wrote:
>
> i think you can figure it out by yourself where the 'edit' is passed in 
> request.args. the minus part of list is tell that you must sort it backward 
> (from right), so if it : request.args[-3] == 'edit'
> the edit must be the 3rd args from the right part 
>
> for your case e.g.
> App/default/product/edit/(record id)?(hmac)
> so the request.args[-2] == 'edit'
>
> for the suggestion i gave to you above is taken from my code that is using 
> sqlform.smartgrid and in your case you are using sqlform.grid, so please 
> try request.args[-2] == 'edit'.
>
> best regards,
> stifan
>

-- 
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: resizing uploaded image file upload using gluon.contrib.imageutils

2013-12-04 Thread Ivo
Hi,
I'm having the same kind of troubles but haven't bothered yet on resolving 
them.

Do you have jpeg decoder installed?
I think that could solve your problems

On Tuesday, December 3, 2013 7:49:40 AM UTC+1, 黄祥 wrote:
>
> hi,
>
> i'm trying to resizing uploaded image file upload using 
> gluon.contrib.imageutils but nothing happens (no error occured and the 
> image didn't resized). 
>
> i'm testing it on windows 7 32 bit using web2py 2.8.2 both source and 
> binary version, python 2.7.6, Pillow-2.2.1.win32-py2.7.
>
> my code is :
> *models/db_wizard_3_product.py*
> from gluon.contrib.imageutils import RESIZE
>
> db.product.image.requires = [IS_IMAGE(), RESIZE(220, 220)]
>
> *controllers/master.py*
> auth.requires_login()(lambda: None)()
> def product():
> grid=SQLFORM.grid(db.product)
> return locals()
>
> what should i do to resizing uploaded image file upload using 
> gluon.contrib.imageutils?
>
> thanks and best regards,
> stifan
>

-- 
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] request.folder

2013-12-04 Thread Marin Pranjić
update:
It only happens when I use background task (-S appname -M -R ...)
I thought it would also print absolute path.

But this happens with older versions so I guess it's expected?

Marin


On Wed, Dec 4, 2013 at 11:39 AM, Marin Pranjić wrote:

> With trunk (and 2.8.2) I don't get absolute path.
>
> request.folder is "applications/appname"
> Shouldn't it be absolute instead of relative?
>
>
> Marin
>
> --
> 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: resizing uploaded image file upload using gluon.contrib.imageutils

2013-12-04 Thread 黄祥
hi ricardo, i've tried to upload *.jpg files and yet the results is not 
resize. what should i do to achieve that?

thanks and best regards,
stifan

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


[web2py] request.folder

2013-12-04 Thread Marin Pranjić
With trunk (and 2.8.2) I don't get absolute path.

request.folder is "applications/appname"
Shouldn't it be absolute instead of relative?


Marin

-- 
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: resizing uploaded image file upload using gluon.contrib.imageutils

2013-12-04 Thread Ricardo Pedroso
On Wed, Dec 4, 2013 at 8:20 AM, 黄祥  wrote:

> tried on ubuntu 13.10 with web2py 2.8.2 source and python-imaging
> installed it's still not worked, tried installed pil for windows from
> http://www.pythonware.com/products/pil/ is not worked too.
> i suspect the gluon.contrib.imageutils is not worked on web2py 2.8.2.
>
>
in gluon.contrib.imageutils RESIZE there is a try ... except block
just after the except add:

Probably there is an exception that is been swallowed.

And I guess that the exception that is been raise is something:

IOError: cannot write mode P as JPEG

If this is the error, you can put just before the img.save(...) in
gluon.contrib.imageutils.py:

img = img.convert('RGB')

Are you uploading a png?

What happen when you upload a jpeg?


Ricardo

-- 
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] unable to default SQLFORM option widget to current field value

2013-12-04 Thread Ivo
Is there a way to default the option widget to the current field value?
The thing is that when you edit a form, the option widget always defaults 
to empty (you need to make a selection even if the field already contains a 
value). I'm quite sure a lot of users will not notice that the select is 
empty, overriding the existing value upon save. They should however need to 
be able to change the value if they choose to. I prefer to do it from the 
controller side if possible.

-- 
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: resizing uploaded image file upload using gluon.contrib.imageutils

2013-12-04 Thread 黄祥
tried on ubuntu 13.10 with web2py 2.8.2 source and python-imaging installed 
it's still not worked, tried installed pil for windows from 
http://www.pythonware.com/products/pil/ is not worked too.
i suspect the gluon.contrib.imageutils is not worked on web2py 2.8.2.

best regards,
stifan

-- 
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: After upgrade to 2.8.2: foreign key constraint failed

2013-12-04 Thread Paolo Valleri
Web2py 2.8.2 comes with foreign_keys=ON enabled by default (see 
http://www.sqlite.org/foreignkeys.html)
If you get the issue you mentioned I guess you are violating a foreign key 
constrain.
Please post your model (or the tables definitions involved) so that we can 
figure out what is wrong

Paolo

On Wednesday, December 4, 2013 3:26:32 AM UTC+1, Scott Hunter wrote:
>
> I have a site which, after upgrading to 2.8.2 (and clearing out the 
> sessions), when I try update a record via a smartgrid or via admin, I get 
> the error in the title.  I tried the same action on the copy of the site I 
> had made just before upgrading, without any problems.
>
> This is from OSX 10.9.
>

-- 
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: SQLFORM.grid edit form restrictions

2013-12-04 Thread 黄祥
i think you can figure it out by yourself where the 'edit' is passed in 
request.args. the minus part of list is tell that you must sort it backward 
(from right), so if it : request.args[-3] == 'edit'
the edit must be the 3rd args from the right part 

for your case e.g.
App/default/product/edit/(record id)?(hmac)
so the request.args[-2] == 'edit'

for the suggestion i gave to you above is taken from my code that is using 
sqlform.smartgrid and in your case you are using sqlform.grid, so please 
try request.args[-2] == 'edit'.

best regards,
stifan

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