[web2py] Re: smartgrid example problem

2016-03-08 Thread Jim S
I cut your db.py, default.py and manage_songs.html code and pasted into a 
new app and it worked fine for me.

When I click on Add Record 
from http://127.0.0.1:8000/songs/default/manage_songs/song it goes 
to http://127.0.0.1:8000/songs/default/manage_songs/song/new/song

So, I think your sample code is just fine.  My version is Version 
2.13.3-stable+timestamp.2015.12.24.08.08.22

-Jim



On Tuesday, March 8, 2016 at 11:47:58 AM UTC-6, JoeCodeswell wrote:
>
> Dear web2py Community,
>
> I BELIEVE i am faithfully following the one-to-many SmartGrid example in 
> the book (Example 34* Using a Smartgrid*). 
>
> I'll show my code below.
>
> PROBLEM
> When I click on addRecord from "
> http://127.0.0.1:8000/w2psnips/default/manage_songs;, Firefox goes to "
> http://127.0.0.1:8000/w2psnips/default/manage_songs/song; and says "The 
> page isn't redirecting properly. Firefox has detected that the server is 
> redirecting the request for this address in a way that will never complete."
>
> What am I doing wrong?
>
> Thanks for the help in advance,
>
> Love and peace,
>
> Joe
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *db.py#one song TO MANY mp3parts  ->  choirdb.define_table('song',
> Field('title',requires=IS_NOT_EMPTY()),Field('info'),# 
> auth.signature,)db.define_table('mp3part',
> Field('part_name',requires=IS_NOT_EMPTY()),
> Field('mp3',requires=IS_URL()),Field('song_id',db.song),# 
> auth.signature,)default.pydef manage_songs():grid = 
> SQLFORM.smartgrid(db.song,linked_tables=['mp3part'], user_signature=False)  
>   return dict(grid=grid)*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *manage_songs.html{{# 
> left_sidebar_enabled,right_sidebar_enabled=False,('message' in 
> globals())}}{{left_sidebar_enabled,right_sidebar_enabled=False,False}}{{extend
>  
> 'layout.html'}}{{block header}}  {{if 
> response.title:}}{{=response.title}}  
> {{=response.subtitle or ''}}{{pass}}  
> {{end}}{{=grid}}*
>

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


[web2py] Re: for those of us who do not understand ...

2016-03-08 Thread Dave S


On Tuesday, March 8, 2016 at 1:04:50 PM UTC-8, Massimo Di Pierro wrote:
>
> I would like to buy a .ham.burger 
> http://mdipierro.github.io/stupid.css/themes/hamburger.html
>

Oh, my!

/dps
 

>
>
> On Thursday, 3 March 2016 01:27:57 UTC-6, Massimo Di Pierro wrote:
>>
>> A damn simple and easy css framework ... stupid.css
>>
>> https://t.co/9vB48IjYJK
>>
>> No promise of backward compatibility is made, but comments and 
>> suggestions for improvement are welcome.
>>
>

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


[web2py] How to know if the scheduler is running?

2016-03-08 Thread Anthony
You can create a cron job that starts the scheduler on restart of the OS.

Anthony

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


[web2py] How to know if the scheduler is running?

2016-03-08 Thread Alfonso Serra
In order to run a scheduler task, the scheduler must be running using 
web2py.py -K myapp

Its all good but sometimes servers are stopped for mantainance or they kill 
processes if they are running for too long.

So if i have a controller that assigns a task, how do i detect if the 
scheduler is running or not?

Most hosting services doesnt let you run shell commands, so if the 
scheduler isnt running is there a way to run it within a controller? using 
the module subproccess maybe?

Thank you very much.


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


Re: [web2py] bug in IS_NOT_EMPTY() ?

2016-03-08 Thread Anthony
On Tuesday, March 8, 2016 at 3:01:48 PM UTC-5, Richard wrote:
>
> For instance how someone can acheive the same than NullBooleanField of 
> Django :
>
>
> https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.NullBooleanField
>  
> 
>

In web2py, a regular boolean field allows NULLs, so I don't think we need a 
special field type. In Django, the NullBooleanField is intended to be used 
with the NullBooleanSelect widget, which actually includes three options 
(with "uknown" being equivalent to a NULL). I suppose in web2py, you could 
achieve this with a standard select widget (with a None option), and then 
use an IS_IN_SET or IS_NOT_EMPTY validator.
 

> One part of the problem with IS_NOT_EMPTY() is that it seems to be intent 
> to work only with string field type, from the book : 
>

It does work with other types of values, but there isn't much point to it 
when working with boolean form fields, as they cannot be empty by 
definition (though I suppose the distinction could be made when using the 
.validate_and_insert method).
 

> Or we can just fix IS_NOT_EMPTY() so it works with boolean type field so 
> that it returns false when the checkbox is leave blank as it should...
>

There's nothing to fix with IS_NOT_EMPTY() -- it doesn't know what type of 
field produces the value it is passed, so it cannot behave differently 
depending on the type of field. We could instead change the behavior of 
SQLFORM so it automatically converts empty checkboxes to False values, 
which would then pass validation with IS_NOT_EMPTY.

Anthony

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


[web2py] Re: for those of us who do not understand ...

2016-03-08 Thread Massimo Di Pierro
I would like to buy a .ham.burger 
http://mdipierro.github.io/stupid.css/themes/hamburger.html

On Thursday, 3 March 2016 01:27:57 UTC-6, Massimo Di Pierro wrote:
>
> A damn simple and easy css framework ... stupid.css
>
> https://t.co/9vB48IjYJK
>
> No promise of backward compatibility is made, but comments and suggestions 
> for improvement are welcome.
>

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


Re: [web2py] bug in IS_NOT_EMPTY() ?

2016-03-08 Thread Richard Vézina
For instance how someone can acheive the same than NullBooleanField of
Django :

https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.NullBooleanField

http://stackoverflow.com/questions/10440937/what-is-wrong-with-the-django-forms-booleanfield-unit-test-case

One part of the problem with IS_NOT_EMPTY() is that it seems to be intent
to work only with string field type, from the book :

IS_NOT_EMPTY

This validator checks that the content of the field value is not an empty
string.

requires = IS_NOT_EMPTY(error_message='cannot be empty!')


Gluon code here :

https://github.com/web2py/web2py/blob/b6db31461266fa7539636e77f548cd6f69e8063e/gluon/validators.py#L1008

I am not sure what the best way to solve this and how to distinguish
between empty checkbox and false checkbox... As in html it could only be
checked or not checked... Maybe we can wrapp checkbox into a widget that
check if the checkbox was checked before been unchecked... But it would be
counter intuitive that someone has to check a checkbox before uncheck it to
signify that he want that the database input of a boolean field is really
false and not NULL...

Or we can just fix IS_NOT_EMPTY() so it works with boolean type field so
that it returns false when the checkbox is leave blank as it should...

Or even mention in the book that IS_NOT_EMPTY() doesn't apply and shouldn't
be use with boolean type field, which seems the simplest solution...

Richard





On Tue, Mar 8, 2016 at 2:00 PM, Richard Vézina 
wrote:

> To me, Francisco is rigth...
>
> In boolean case, I assume that IS_NOT_EMPTY() would make sure that field
> don't get a NULL value, so the database get hit with True or False value
> when you set IS_NOT_EMPTY() and default=False...
>
> Richard
>
> On Thu, Dec 4, 2014 at 6:27 AM, Kiran Subbaraman <
> subbaraman.ki...@gmail.com> wrote:
>
>> I see this as IS_NOT_EMPTY() working correctly.
>> And why would you attach this validator to a checkbox/boolean field? Did
>> you also assign a default value of False?
>> Or you would need to check request.args for this field, and assign a
>> false if it is empty, before passing it along to the validator (again, not
>> sure what purpose the validator serves for this field).
>>
>> 
>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>
>> On Thu, 04-12-2014 4:46 PM, Francisco Ribeiro wrote:
>>
>> hi there,
>> I noticed that when I use the IS_NOT_EMPTY() validator on a boolean field
>> (i.e. a form checkbox) that it will not allow me to submit the form with
>> this field as "not checked" / "unticked".  In my opinion, this is a wrong
>> interpretation of what is an empty value, since a checkbox can only
>> represent True or False and therefore it's never empty. The consequence of
>> using this behaviour for the IS_NOT_EMPTY*() validator is that we are
>> forcing users to choose True on a widget that is meant to provide a boolean
>> choice between True OR False, so the whole purpose of this user interface
>> widget, is lost. I only tested this with SQLFORM.factory() though.
>>
>> Am I missing something?
>>
>> Francisco
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


[web2py] Re: IOError: [Errno 30] Read-only file system: web2py/web2py.log

2016-03-08 Thread Niphlod
just remove logging.conf alltogether or remove the handler that writes to a 
file. GAE has not a writable FS

On Tuesday, March 8, 2016 at 7:33:29 PM UTC+1, Krishna Bavandlapally wrote:
>
> Not able to run GAE dev_server 
>
> $ python working/google_appengine/dev_appserver.py working/web2py/
> INFO 2016-03-08 04:58:36,097 api_server.py:205] Starting API server 
> at: http://localhost:46588
> INFO 2016-03-08 04:58:36,113 dispatcher.py:197] Starting module 
> "default" running at: http://localhost:8080
> INFO 2016-03-08 04:58:36,114 admin_server.py:118] Starting admin 
> server at: http://localhost:8000
> ERROR2016-03-08 04:58:41,003 wsgi.py:263]
> Traceback (most recent call last):
>   File "/google_appengine/google/appengine/runtime/wsgi.py", line 240, in 
> Handle
> handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
>   File "/google_appengine/google/appengine/runtime/wsgi.py", line 299, in 
> _LoadHandler
> handler, path, err = LoadObject(self._handler)
>   File "/google_appengine/google/appengine/runtime/wsgi.py", line 85, in 
> LoadObject
> obj = __import__(path[0])
>   File "/web2py/gaehandler.py", line 62, in 
> import gluon.main
>   File "/web2py/gluon/main.py", line 85, in 
> logging.config.fileConfig(abspath("logging.conf"))
>   File "/usr/lib/python2.7/logging/config.py", line 85, in fileConfig
> handlers = _install_handlers(cp, formatters)
>   File "/usr/lib/python2.7/logging/config.py", line 163, in 
> _install_handlers
> h = klass(*args)
>   File "/usr/lib/python2.7/logging/handlers.py", line 117, in __init__
> BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
>   File "/usr/lib/python2.7/logging/handlers.py", line 64, in __init__
> logging.FileHandler.__init__(self, filename, mode, encoding, delay)
>   File "/usr/lib/python2.7/logging/__init__.py", line 903, in __init__
> StreamHandler.__init__(self, self._open())
>   File "/usr/lib/python2.7/logging/__init__.py", line 928, in _open
> stream = open(self.baseFilename, self.mode)
>   File 
> "/google_appengine/google/appengine/tools/devappserver2/python/stubs.py", 
> line 247, in __init__
> raise IOError(errno.EROFS, 'Read-only file system', filename)
> IOError: [Errno 30] Read-only file system: '/web2py/web2py.log'
> INFO 2016-03-08 04:58:41,008 module.py:809] default: "GET / HTTP/1.1" 
> 500 -
>
>
>
>
>

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


Re: [web2py] bug in IS_NOT_EMPTY() ?

2016-03-08 Thread Richard Vézina
To me, Francisco is rigth...

In boolean case, I assume that IS_NOT_EMPTY() would make sure that field
don't get a NULL value, so the database get hit with True or False value
when you set IS_NOT_EMPTY() and default=False...

Richard

On Thu, Dec 4, 2014 at 6:27 AM, Kiran Subbaraman  wrote:

> I see this as IS_NOT_EMPTY() working correctly.
> And why would you attach this validator to a checkbox/boolean field? Did
> you also assign a default value of False?
> Or you would need to check request.args for this field, and assign a false
> if it is empty, before passing it along to the validator (again, not sure
> what purpose the validator serves for this field).
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On Thu, 04-12-2014 4:46 PM, Francisco Ribeiro wrote:
>
> hi there,
> I noticed that when I use the IS_NOT_EMPTY() validator on a boolean field
> (i.e. a form checkbox) that it will not allow me to submit the form with
> this field as "not checked" / "unticked".  In my opinion, this is a wrong
> interpretation of what is an empty value, since a checkbox can only
> represent True or False and therefore it's never empty. The consequence of
> using this behaviour for the IS_NOT_EMPTY*() validator is that we are
> forcing users to choose True on a widget that is meant to provide a boolean
> choice between True OR False, so the whole purpose of this user interface
> widget, is lost. I only tested this with SQLFORM.factory() though.
>
> Am I missing something?
>
> Francisco
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: for those of us who do not understand ...

2016-03-08 Thread Ron Chatterjee
I see. It also has a downlink and spits out a random.html. I am guessing we 
pretty much use this as a template to create a layout as explained here:

http://www.web2pyslices.com/slice/show/1516/adapt-a-css-template-to-web2py-layouthtml

Am I correct?

On Tuesday, March 8, 2016 at 12:31:31 PM UTC-5, Dave S wrote:
>
> On Tuesday, March 8, 2016 at 4:23:18 AM UTC-8, Ron Chatterjee wrote:
>>
>> Are more themes available or just the welcome theme? I guess, someone can 
>> download a bootstrap theme and use this. 
>>
>>
> The original page (not the web2py one) had a button for "Theme Generator", 
> which I have not yet tried.
>
> /dps
>
>  
>
>> On Monday, March 7, 2016 at 12:46:49 PM UTC-5, Leonel Câmara wrote:
>>>
>>> How do you handle menus and submenus in touch devices where you don't 
>>> "hover"?
>>>
>>

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


[web2py] Cascading fields from table row

2016-03-08 Thread Yoel Baez
Hi, i'm from DR (Dominican Republic)

My question:

It's possible get values from table row, if i select value in a dropdown 
list?

My table:
db.define_table('trees',
Field('name',label=T('Especie')),
Field('type','string',label=T('Type')),
Field('family','string',label=T('Family')),
Field('price','integer',label=T('Price')),
format='%(name)s')

My other table:
db.define_table('trees_select',
Field('name', db.trees,label=T('Name')),
Field('type',',label=T('Type')),
Field('family',label=T('Family')),
Field('price','integer',label=T('Price')),
format='%(name)s')

If i select the name in my dropdown lis, i need the other values from de 
row than i select and automatically get de other values in my others fields.

Example:





Regards,
Yoel Baez 

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


[web2py] IOError: [Errno 30] Read-only file system: web2py/web2py.log

2016-03-08 Thread Krishna Bavandlapally
Not able to run GAE dev_server 

$ python working/google_appengine/dev_appserver.py working/web2py/
INFO 2016-03-08 04:58:36,097 api_server.py:205] Starting API server at: 
http://localhost:46588
INFO 2016-03-08 04:58:36,113 dispatcher.py:197] Starting module 
"default" running at: http://localhost:8080
INFO 2016-03-08 04:58:36,114 admin_server.py:118] Starting admin server 
at: http://localhost:8000
ERROR2016-03-08 04:58:41,003 wsgi.py:263]
Traceback (most recent call last):
  File "/google_appengine/google/appengine/runtime/wsgi.py", line 240, in 
Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/google_appengine/google/appengine/runtime/wsgi.py", line 299, in 
_LoadHandler
handler, path, err = LoadObject(self._handler)
  File "/google_appengine/google/appengine/runtime/wsgi.py", line 85, in 
LoadObject
obj = __import__(path[0])
  File "/web2py/gaehandler.py", line 62, in 
import gluon.main
  File "/web2py/gluon/main.py", line 85, in 
logging.config.fileConfig(abspath("logging.conf"))
  File "/usr/lib/python2.7/logging/config.py", line 85, in fileConfig
handlers = _install_handlers(cp, formatters)
  File "/usr/lib/python2.7/logging/config.py", line 163, in 
_install_handlers
h = klass(*args)
  File "/usr/lib/python2.7/logging/handlers.py", line 117, in __init__
BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/handlers.py", line 64, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python2.7/logging/__init__.py", line 903, in __init__
StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 928, in _open
stream = open(self.baseFilename, self.mode)
  File 
"/google_appengine/google/appengine/tools/devappserver2/python/stubs.py", 
line 247, in __init__
raise IOError(errno.EROFS, 'Read-only file system', filename)
IOError: [Errno 30] Read-only file system: '/web2py/web2py.log'
INFO 2016-03-08 04:58:41,008 module.py:809] default: "GET / HTTP/1.1" 
500 -




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


[web2py] Re: Alternate way for ticket handling

2016-03-08 Thread Anthony


> def mycacher(f):
> client = 
> Client('*')
> try:
> d = f()
> return d
> except:
> client.captureException()
>

You probably want to re-raise the exception after calling 
client.captureException() -- otherwise, web2py will not do a database 
rollback, and nothing will be returned to the browser.

Also, you might want to check whether the value returned by f() is a 
dictionary, and if so, return response.render(d) instead of just d -- that 
will allow you to capture exceptions in views as well as controllers.
 

> With this i'm able to catch all the exceptions originated by a function in 
> the controller or by a function call inside a controller is handled with 
> this code, but the problems comes when a code inside the models (but 
> outside functions) is executed, for example, database definitions etc...
>

This is tricky because web2py runs all app code inside the restricted() 
function from gluon.restricted, and that function catches any errors and 
then raises a RestrictedError, which is then caught in gluon.main.wsgibase. 
Maybe at the top of each model file you could do:

with client.capture_exceptions(): 
[all model code]

Otherwise, I think you would have to hack the web2py framework code. The 
simplest option would be to insert a couple lines in gluon.main.wsgibase to 
call client.captureException() where the RestrictedError is caught. 
Alternatively, you could probably alter or monkey patch the RestrictedError 
class in gluon.restricted.

Also, I'm not too familiar with Sentry, but perhaps rather than using 
client.captureException, you could instead use client.captureMessage. In 
that case, you could create a special web2py error handler and send the 
appropriate message to Sentry based on the traceback, etc., which can be 
retrieved from the error ticket.

Anthony

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


[web2py] Re: list:reference, multiple=True, validation error

2016-03-08 Thread Leonel Câmara
Do you have multiple=True as a keyword argument to your IS_IN_DB validator?

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


[web2py] smartgrid example problem

2016-03-08 Thread JoeCodeswell
Dear web2py Community,

I BELIEVE i am faithfully following the one-to-many SmartGrid example in 
the book (Example 34* Using a Smartgrid*). 

I'll show my code below.

PROBLEM
When I click on addRecord from 
"http://127.0.0.1:8000/w2psnips/default/manage_songs;, Firefox goes to 
"http://127.0.0.1:8000/w2psnips/default/manage_songs/song; and says "The 
page isn't redirecting properly. Firefox has detected that the server is 
redirecting the request for this address in a way that will never complete."

What am I doing wrong?

Thanks for the help in advance,

Love and peace,

Joe
























*db.py#one song TO MANY mp3parts  ->  choirdb.define_table('song',
Field('title',requires=IS_NOT_EMPTY()),Field('info'),# 
auth.signature,)db.define_table('mp3part',
Field('part_name',requires=IS_NOT_EMPTY()),
Field('mp3',requires=IS_URL()),Field('song_id',db.song),# 
auth.signature,)default.pydef manage_songs():grid = 
SQLFORM.smartgrid(db.song,linked_tables=['mp3part'], user_signature=False)  
  return dict(grid=grid)*






















*manage_songs.html{{# 
left_sidebar_enabled,right_sidebar_enabled=False,('message' in 
globals())}}{{left_sidebar_enabled,right_sidebar_enabled=False,False}}{{extend 
'layout.html'}}{{block header}}  {{if 
response.title:}}{{=response.title}}  
{{=response.subtitle or ''}}{{pass}}  
{{end}}{{=grid}}*

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


[web2py] Re: for those of us who do not understand ...

2016-03-08 Thread Dave S
On Tuesday, March 8, 2016 at 4:23:18 AM UTC-8, Ron Chatterjee wrote:
>
> Are more themes available or just the welcome theme? I guess, someone can 
> download a bootstrap theme and use this. 
>
>
The original page (not the web2py one) had a button for "Theme Generator", 
which I have not yet tried.

/dps

 

> On Monday, March 7, 2016 at 12:46:49 PM UTC-5, Leonel Câmara wrote:
>>
>> How do you handle menus and submenus in touch devices where you don't 
>> "hover"?
>>
>

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


[web2py] Re: Fields from multiple tables in a single form

2016-03-08 Thread Anthony
Your reference field definitions are wrong -- you have defined them as 
"integer" fields and passed "reference" as the third argument, which is the 
"length" argument, not the "type" argument. Should be:

Field('project_id', 'references projects')

Anthony

On Sunday, March 6, 2016 at 10:40:00 AM UTC-5, David Orme wrote:
>
> I have a table like this:
>
> db.define_table('visit',
> Field('project_id', 'integer', 'references projects'),
> Field('arrival_date','date'),
> Field('departure_date','date'),
> Field('number_of_visitors','integer'),
> Field('purpose','text'),
> Field('proposer_id', 'integer', 'references auth_user'),
> Field('approval_status', 'string', 
>   requires=IS_IN_SET(['Yes','No','Pending']),
>   default='Pending')
>
> I'm using SQLFORM.grid to see a list of Pending visits and allow admin 
> users to click through to the SQLFORM for a given visit to set the approval 
> status. This all works fine, except that I'd like the SQLFORM for a visit 
> to substitute in the project name and proposer name from the two referenced 
> tables, rather than just giving the ID numbers.
>
> I've tried playing around with passing in a joined query and using the 
> 'left=' argument, but as far as I can tell you can only get the fields from 
> a single table (although you can switch _which_ table using 'field_id=').
>
> My controller currently looks like this - I'm using editargs to control 
> which field appear in the SQLFORM and I have tried including fields from 
> joined tables in here, but with no success.
>
> @auth.requires_membership('admin')
> def visit_admin_old():
> 
> # don't want the admin to change any of this about a visit
> db.visit.project_id.writable = False
> db.visit.proposer_id.writable = False
> db.visit.arrival_date.writable = False
> db.visit.departure_date.writable = False
> db.visit.number_of_visitors.writable = False
> db.visit.purpose.writable = False
>
> # get a query of pending requests with user_id
> form = SQLFORM.grid(query=(db.visit.visit_status == 'Pending'), csv=
> False,
> fields=[db.visit.arrival_date, 
> db.visit.departure_date,
> db.visit.number_of_visitors, 
> db.visit.purpose],
>  maxtextlength=250,
>  deletable=False,
>  editable=True,
>  create=False,
>  details=False,
>  editargs = {'fields': ['project_id','proposer_id'
> ,
> 'arrival_date',
> 'departure_date',
> 'number_of_visitors',
> 'purpose', 
> 'visit_status',
> 'visit_decision_notes'],
>  'showid': False})
> 
> return dict(form=form)
>
> Thanks in advance,
> David
>
>
>

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


[web2py] Re: list:reference, multiple=True, validation error

2016-03-08 Thread villas
As I would like to get this fixed (and cannot do so myself),  I raised this 
as an issue on Github (issue 1203 
) where I hope someone will 
be able to look at it.

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


[web2py] Re: Fields from multiple tables in a single form

2016-03-08 Thread Ron Chatterjee
Here is another tip that you may or may not fine useful.

http://www.web2pyslices.com/slice/show/1979/grid-custom-search-without-specifying-a-custom-search-widget


On Monday, March 7, 2016 at 7:31:45 PM UTC-5, villas wrote:

> Hi David
>
> Try these two...
>
> 1.  In your table defs for project and proposer,  make sure you add 
>
> format='%(yourfieldname)s',
>
> So that Web2py knows what to show instead of 'id'.
>
> 2. You can use .represent in your model or controller.
> db.visit.proposer_id.represent = .
> See the book 
> 
> .
>
> Best wishes.
>

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


[web2py] Re: for those of us who do not understand ...

2016-03-08 Thread Ron Chatterjee
Are more themes available or just the welcome theme? I guess, someone can 
download a bootstrap theme and use this. 

On Monday, March 7, 2016 at 12:46:49 PM UTC-5, Leonel Câmara wrote:
>
> How do you handle menus and submenus in touch devices where you don't 
> "hover"?
>

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


[web2py] Re: Auth User split by tables

2016-03-08 Thread Ron Chatterjee
This works fine.

def after_profile(form):
if form.vars.user_type == 'Job_Seeker':
redirect(URL('default','edit_profile'))
return locals()

def edit_profile():
db.employee.employee_profile.default = auth.user_id
record = db(db.employee.employee_profile== auth.user_id).select()
form = SQLFORM(db.employee,record[0].id,deletable=True, 
submit_button='Update Profile').process()
return dict(form = form)


But I agree with you Anthony. Its probably overkill since I already for the 
signature. I will also try the other you suggested. You are the best 
Anthony! 


On Monday, March 7, 2016 at 8:26:03 AM UTC-5, Anthony wrote:

> This doesn't quite make sense. You are processing one form, and in the 
> callback, you overwrite the "form" variable with an entirely new form 
> object, attempting to process it immediately without the user having seen 
> or submitted it. I think you need a different strategy.
>
> Two other tips:
>
>- If your callback already has the proper signature, there is no need 
>to wrap it in a lambda -- just do auth.settings.profile_onaccept = 
>after_profile.
>- If you have the Row object of a record, just pass that as the 
>"record" argument to SQLFORM -- if you pass the id, SQLFORM will then do 
> an 
>additional query to get the Row object.
>
> Anthony
>
> On Sunday, March 6, 2016 at 6:59:20 PM UTC-5, Ron Chatterjee wrote:
>>
>> I have the auth_user split up between employer and employee
>>
>> After the profile is created I want to be able to modify the employee 
>> profile. 
>>
>>
>> So, I have this in my model 
>>
>> auth.settings.profile_onaccept = lambda form: after_profile(form) 
>>
>> In my controller:
>>
>> def after_profile(form):
>> if form.vars.user_type == 'employee':
>> record = db(db.employee.employee_profile== auth.user_id).select()
>> form = SQLFORM(db.employee,record[0].id,deletable=True, 
>> submit_button='Update Profile').process()
>> if form.accepted:
>> session.flash = T(profile is modified')
>> redirect(URL('default','index'))
>> else:
>> redirect(URL('default','index'))
>> return dict(form = form)
>>
>> request.args(0) is 'profile'. 
>>
>> How to make the SQLFORM to make it editable for that profile/user_id? It 
>> doesn't work the way it is.
>>
>> On Friday, February 5, 2016 at 11:58:23 AM UTC-5, Ron Chatterjee wrote:
>>>
>>> yes got it. Thank you. sorry. lol
>>>
>>> On Friday, February 5, 2016 at 11:19:29 AM UTC-5, Anthony wrote:

 In the shell, just print it, pass it to str(), or call its .xml() 
 method.

 Or just load it in the browser and "view source".

 Anthony

 On Friday, February 5, 2016 at 10:44:58 AM UTC-5, Ron Chatterjee wrote:
>
> This may be trivial but how do I get the html code out of 
> auth.navbar()? It shows up as a gluon object.
>
> On Tuesday, February 2, 2016 at 6:29:19 PM UTC-5, Anthony wrote:
>>
>> I guess I can do this:
>>> https://groups.google.com/forum/#!topic/web2py/AYORqIEpc9E
>>> But that kills all the style. Then I got to custom style it. 
>>>
>>
>> Just look at the HTML generated by auth.navbar() and replicate that 
>> HTML, just making the changes you need in the links.
>>
>> Anthony
>>
>

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


Re: [web2py] Re: Dal Field Types

2016-03-08 Thread Mirek Zvolsky
I'm sorry, didn't know this.
My (bad) idea was that all without underscore is reserved for
db.table.fieldname.
Now I see that there are additional names which I should avoid as field
names, like "fields", "keys", "sqlsafe". Correct?


2016-03-04 12:12 GMT+01:00 Anthony :

> On Friday, March 4, 2016 at 2:47:36 AM UTC-5, Mirek Zvolský wrote:
>>
>> just detail: db.resultats._fields
>>
>
> There is no need to use db.resultats._fields, as db.resultats.fields is a
> Python property that simply returns db.resultats._fields.
>
> Also, it is a SQLCallableList, so db.resultats.fields() returns a copy of
> the original list, meaning you can mutate it without affecting the original
> list.
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/p608VqzV2GM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Mirek Zvolský,
(+420) 732457966
zvol...@seznam.cz (mirek.zvol...@gmail.com)

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


[web2py] Re: Alternate way for ticket handling

2016-03-08 Thread Dave S
On Monday, March 7, 2016 at 6:11:42 PM UTC-8, luis.va...@metamaxzone.com 
wrote:
>
> I dont want to be anoying but i still need some help and didnt find any 
> information. My "solution" cant catch models or views errors.
>
> Thanks!
>
>
I haven't had a chance to study it yet, but the ticket class is in 
gluon/restricted.py (it's part of the restricted execution environment).  I 
suspect you have to replace the class rather than just subclass it, but 
that's from a very cursory look.

/dps


 

> El lunes, 22 de febrero de 2016, 16:45:26 (UTC-4:30), 
> luis.va...@metamaxzone.com escribió:
>>
>> Hello!
>>
>> I want to manage and catch all the error of my website using sentry (
>> https://getsentry.com/welcome/), reading some post in this forum i found 
>> this: 
>> https://groups.google.com/forum/#!searchin/web2py/disable$20tickets$20error/web2py/0E73_7KbGJI/9WEfWCpty-4J
>>
>> Based in that solution i've created this inside one of my models.
>>
>> from raven import Client
>>
>>
>> def mycacher(f):
>> client = 
>> Client('*')
>> try:
>> d = f()
>> return d
>> except:
>> client.captureException()
>>
>> response._caller = mycacher
>>
>> With this i'm able to catch all the exceptions originated by a function 
>> in the controller or by a function call inside a controller is handled with 
>> this code, but the problems comes when a code inside the models (but 
>> outside functions) is executed, for example, database definitions etc...
>>
>> I know i can wrap all my code with a try... Except to catch this but 
>> there is any other solution for entirely "Bypassing" the ticket system in 
>> order to use other system?
>>
>> Thanks for your help!
>>
>

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


[web2py] Re: checkbox with label on the left side

2016-03-08 Thread Viator
Hello Paolo!

Thank you very much for your Input. Looks promising.  I will try it this 
way.

Thorsten

>
>>

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