Re: [web2py] Re: "TypeError: sequence of byte string values expected, value of type str found" when accessing admin

2020-05-01 Thread João Matos

Hello,

Nope. What I did was use another port with HTTPS (not 443, eg. 8000) for 
the client's application.



Best regards,

João Matos

On 01/05/2020 19:15, Ian W. Scott wrote:

Did you ever solve this problem? I'm running into the same thing.

On Monday, April 8, 2019 at 12:56:49 PM UTC-4, João Matos wrote:

When using Apache 2.4 (HTTPS using port 443) with web2py the
application works fine, but the admin interface always returns and
error "Internal Server Error".

This only happens if using port 443 (if I change the HTTPS port to
eg. 8000, it all works).

I checked that I don't have any other program/process using port 443.


The Apache error.log shows this

|[Mon Apr 08 00:36:13.551971 2019] [wsgi:error] [pid 4448:tid
924] [client 192.168.1.119:61409 ]
mod_wsgi (pid=4448): Exception occurred processing WSGI script
'C:/web2py/wsgihandler.py'. [Mon Apr 08 00:36:13.551971 2019]
[wsgi:error] [pid 4448:tid 924] [client 192.168.1.119:61409
] TypeError: sequence of byte
string values expected, value of type str found\r |

I searched for this and found this article

https://stackoverflow.com/questions/34838443/typeerror-sequence-of-byte-string-values-expected-value-of-type-str-found



Apparently this has to do with Python3.
Maybe web2py is sending str instead of bytes to Apache when
accessing the admin interface?


My env

Windows 7 Pro x64 SP1+all upd
Firefox 66.0.2 x64
Python 3.7.1 x86
web2py 2.18.4
Apache 2.4 (httpd-2.4.39-win32-VC14)
mod_wsgi-4.5.24+ap24vc14-cp37-cp37m-win32.whl


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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/OXyGJcA_TU4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
web2py+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1bc6d551-020a-43b9-89fd-cfc936f5aa97%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bd9dc462-d790-e18f-4003-2a039b0e7e38%40gmail.com.


[web2py] Re: "TypeError: sequence of byte string values expected, value of type str found" when accessing admin

2020-05-01 Thread Ian W. Scott
Did you ever solve this problem? I'm running into the same thing.

On Monday, April 8, 2019 at 12:56:49 PM UTC-4, João Matos wrote:
>
> When using Apache 2.4 (HTTPS using port 443) with web2py the application 
> works fine, but the admin interface always returns and error "Internal 
> Server Error".
>
> This only happens if using port 443 (if I change the HTTPS port to eg. 
> 8000, it all works).
>
> I checked that I don't have any other program/process using port 443.
>
>
> The Apache error.log shows this
>
>> [Mon Apr 08 00:36:13.551971 2019] [wsgi:error] [pid 4448:tid 924] [client 
>> 192.168.1.119:61409] mod_wsgi (pid=4448): Exception occurred processing WSGI 
>> script 'C:/web2py/wsgihandler.py'.
>> [Mon Apr 08 00:36:13.551971 2019] [wsgi:error] [pid 4448:tid 924] [client 
>> 192.168.1.119:61409] TypeError: sequence of byte string values expected, 
>> value of type str found\r
>>
>> I searched for this and found this article
>
> https://stackoverflow.com/questions/34838443/typeerror-sequence-of-byte-string-values-expected-value-of-type-str-found
>
> Apparently this has to do with Python3.
> Maybe web2py is sending str instead of bytes to Apache when accessing the 
> admin interface?
>
>
> My env
>
> Windows 7 Pro x64 SP1+all upd
> Firefox 66.0.2 x64
> Python 3.7.1 x86
> web2py 2.18.4
> Apache 2.4 (httpd-2.4.39-win32-VC14)
> mod_wsgi-4.5.24+ap24vc14-cp37-cp37m-win32.whl
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1bc6d551-020a-43b9-89fd-cfc936f5aa97%40googlegroups.com.


[web2py] Re: TypeError: object of type 'Field' has no len()

2019-07-04 Thread 黄祥
already tried define length on field constructor and change web server, 
because error above refer to rocket.py, so try gevent an error occured too
*modules/table_test.py*
test = db.define_table('test', 
Field('test', *length **= 255*), 
on_define = on_define_test)

$ python ~/learn/python/web2py/anyserver.py -s gevent -i 0.0.0.0 -p 8000
starting gevent on 0.0.0.0:8000...
Traceback (most recent call last):
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/gevent/pywsgi.py"
, line 976, in handle_one_response
self.run_application()
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/gevent/pywsgi.py"
, line 924, in run_application
self.process_result()
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/gevent/pywsgi.py"
, line 910, in process_result
self.write(data)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/gevent/pywsgi.py"
, line 757, in write
self._write_with_headers(data)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/gevent/pywsgi.py"
, line 778, in _write_with_headers
self._write(data)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/gevent/pywsgi.py"
, line 733, in _write
header_str = b'%x\r\n' % len(data)
TypeError: object of type 'Field' has no len()
2019-07-03T10:07:08Z {'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '63729', 
'HTTP_HOST': 'localhost:8000', (hidden keys: 28)} failed with TypeError

btw, anyserver.py can't run with gunicorn on 2.18.5-stable (no error 
occured, but the server can't been access in web browser
$ python ~/learn/python/web2py/anyserver.py -s gunicorn -i 0.0.0.0 -p 8000
starting gunicorn on 0.0.0.0:8000... 
[2019-07-03 17:01:19 +0700] [71683] [INFO] Starting gunicorn 19.9.0 
[2019-07-03 17:01:19 +0700] [71683] [INFO] Listening at: http://0.0.0.0:8000 
(71683) 
[2019-07-03 17:01:19 +0700] [71683] [INFO] Using worker: sync 
[2019-07-03 17:01:19 +0700] [71687] [INFO] Booting worker with pid: 71687


any way out ?

thx n 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a87f8d07-e334-480a-a083-88769bb933e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: TypeError: getattr(): attribute name must be string

2017-12-27 Thread Luís Guilherme F
It happened on any request. Thanks for your feedback.

SOLVED:
I noticed that the app runs without errors when it's called from the admin 
page (https).
So I found the only relevant difference between Apache's http and https 
configuration:


*WSGIDaemonProcess web2py* 
WSGIProcessGroup  web2py
WSGIScriptAlias   /  /opt/web2py/wsgihandler.py
(...)


WSGIProcessGroup web2py
WSGIScriptAlias  /  /opt/web2py/wsgihandler.py
 
SOLUTION:

*WSGIDaemonProcess web2py user=www-data group=www-data*


WSGIProcessGroup  web2py
WSGIScriptAlias   /  /opt/web2py/wsgihandler.py

As far as I remember, web2py's configuration used to be just like I showed 
you here.
I just confirmed that, on the (very old) web2py 2.3.2 setup script.
Mine is a very old web-server, so was this apache conf.

QUESTION: 
After upgrading web2py to a newer version, should I always check the setup 
script for any changes to Apache conf?
At web2py.com installation instructions only tells you to unzip after 
download.

Great framework, though.
Luís


On Friday, 22 December 2017 12:53:48 UTC, Luís Guilherme F wrote:
>
> Hello,
> I'm getting this error on a server with Apache 2.2 / Ubuntu 12.04, which 
> doesn't happen on a box with Apache 2.4 / Ubuntu 16.04 (both now with 
> web2py 2.16.1):
>
> Traceback (most recent call last):
>   File "/opt/web2py/gluon/main.py", line 434, in wsgibase
> session.connect(request, response)
>   File "/opt/web2py/gluon/globals.py", line 1000, in connect
> session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
>   File "/opt/web2py/gluon/storage.py", line 52, in 
>  __getnewargs__ = lambda self: getattr(dict,self).__getnewargs__(self)
> TypeError: getattr(): attribute name must be string
>
> (...)
> File /opt/web2py/gluon/storage.py in  at line 56 code arguments 
> variables
> Function argument list
> (self=)
>
> Version
> 2.16.1-stable+timestamp.2017.11.14.05.54.25
> (Running on Apache/2.2.22 (Ubuntu), Python 2.7.3)
>
> I've updated Web2py from 2.14.6 to 2.16.1 but still get the error.
> First overwriting the previous version, and now in a new folder.
>
> I'm trying to solve this for a few days now.
> This app should be deployed for production on this Apache 2.2 server, and 
> I'm stuck with these errors.
>
> Any help would be most welcome
> Luís
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from 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: TypeError: getattr(): attribute name must be string

2017-12-22 Thread Dave S


On Friday, December 22, 2017 at 4:53:48 AM UTC-8, Luís Guilherme F wrote:
>
> Hello,
> I'm getting this error on a server with Apache 2.2 / Ubuntu 12.04, which 
> doesn't happen on a box with Apache 2.4 / Ubuntu 16.04 (both now with 
> web2py 2.16.1):
>
>

Is this happening on specific requests, or any request?  I suspect that 
Apache 2.2 may be passing uwsgi parameters differently, but I'm an nginx 
guy (a little) or Rocket.

/dps
 

> Traceback (most recent call last):
>   File "/opt/web2py/gluon/main.py", line 434, in wsgibase
> session.connect(request, response)
>   File "/opt/web2py/gluon/globals.py", line 1000, in connect
> session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
>   File "/opt/web2py/gluon/storage.py", line 52, in 
>  __getnewargs__ = lambda self: getattr(dict,self).__getnewargs__(self)
> TypeError: getattr(): attribute name must be string
>
> (...)
> File /opt/web2py/gluon/storage.py in  at line 56 code arguments 
> variables
> Function argument list
> (self=)
>
> Version
> 2.16.1-stable+timestamp.2017.11.14.05.54.25
> (Running on Apache/2.2.22 (Ubuntu), Python 2.7.3)
>
> I've updated Web2py from 2.14.6 to 2.16.1 but still get the error.
> First overwriting the previous version, and now in a new folder.
>
> I'm trying to solve this for a few days now.
> This app should be deployed for production on this Apache 2.2 server, and 
> I'm stuck with these errors.
>
> Any help would be most welcome
> Luís
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from 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: TypeError: an integer is required

2015-11-12 Thread Massimo Di Pierro
Is this the best mailing list ever for web app developers?

On Wednesday, 11 November 2015 12:59:55 UTC-6, Anthony Smith wrote:
>
> Thanks Anthony, you guys are a great assistance to all the newbies 
>
> cheers
>
> On Wednesday, 11 November 2015 23:30:54 UTC+11, Anthony wrote:
>>
>> datetime.date() is for constructing a date object and it takes integer 
>> arguments (for the year, month, and day) -- you don't pass a date to it. 
>> Instead, just do:
>>
>> SPAN(v, ...)
>>
>> Or if you don't like the default format you get when the date is 
>> converted to a string, use the .strftime method:
>>
>> SPAN(v.strftime('%m/%d/%Y'))
>>
>> Anthony
>>
>> On Wednesday, November 11, 2015 at 2:09:04 AM UTC-5, Anthony Smith wrote:
>>>
>>> Hi, 
>>> I am using the follow to highlight a date field where the date is 
>>> greater then the current date.
>>>
>>> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
>>> SPAN(datetime.date(v),_class='withhold' if v >datetime.date.today() else 
>>> None)
>>> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
>>> SPAN(datetime.date(v),_class='withhold' if v and v> datetime.date.today() 
>>> else None)
>>>
>>> Traceback (most recent call last):
>>>   File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
>>> exec ccode in environment
>>>   File "/home/tony/web2py/applications/cps5c/controllers/default.py" 
>>> , 
>>> line 562, in 
>>>   File "applications/cps5c/modules/plugin_sqleditable/editable.py", line 
>>> 415, in extract
>>> r=func()
>>>   File "/home/tony/web2py/gluon/tools.py", line 3774, in f
>>> return action(*a, **b)
>>>   File "/home/tony/web2py/applications/cps5c/controllers/default.py" 
>>> , 
>>> line 268, in stock_tasks
>>> db.stock_task.created_by,
>>>   File "/home/tony/web2py/gluon/sqlhtml.py", line 2717, in grid
>>> nvalue = field.represent(value, row)
>>>   File "/home/tony/web2py/applications/cps5c/models/db1.py" 
>>> , line 144, 
>>> in 
>>> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
>>> SPAN(datetime.date (v),_class='withhold' if v > datetime.date.today() else 
>>> None)
>>> TypeError: an integer is required
>>>
>>>
>>> if I use the following works fine.
>>> db.stock_task.withhold_until_date.represent = lambda v, row: 
>>> SPAN(prettydate(v),_class='withhold' if v and v>datetime.date.today() else 
>>> None)
>>>
>>> any help appreciated
>>>
>>> cheers
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from 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: TypeError: an integer is required

2015-11-11 Thread Anthony
datetime.date() is for constructing a date object and it takes integer 
arguments (for the year, month, and day) -- you don't pass a date to it. 
Instead, just do:

SPAN(v, ...)

Or if you don't like the default format you get when the date is converted 
to a string, use the .strftime method:

SPAN(v.strftime('%m/%d/%Y'))

Anthony

On Wednesday, November 11, 2015 at 2:09:04 AM UTC-5, Anthony Smith wrote:
>
> Hi, 
> I am using the follow to highlight a date field where the date is greater 
> then the current date.
>
> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
> SPAN(datetime.date(v),_class='withhold' if v >datetime.date.today() else None)
> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
> SPAN(datetime.date(v),_class='withhold' if v and v> datetime.date.today() 
> else None)
>
> Traceback (most recent call last):
>   File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/home/tony/web2py/applications/cps5c/controllers/default.py" 
> , line 
> 562, in 
>   File "applications/cps5c/modules/plugin_sqleditable/editable.py", line 415, 
> in extract
> r=func()
>   File "/home/tony/web2py/gluon/tools.py", line 3774, in f
> return action(*a, **b)
>   File "/home/tony/web2py/applications/cps5c/controllers/default.py" 
> , line 
> 268, in stock_tasks
> db.stock_task.created_by,
>   File "/home/tony/web2py/gluon/sqlhtml.py", line 2717, in grid
> nvalue = field.represent(value, row)
>   File "/home/tony/web2py/applications/cps5c/models/db1.py" 
> , line 144, in 
> 
> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
> SPAN(datetime.date (v),_class='withhold' if v > datetime.date.today() else 
> None)
> TypeError: an integer is required
>
>
> if I use the following works fine.
> db.stock_task.withhold_until_date.represent = lambda v, row: 
> SPAN(prettydate(v),_class='withhold' if v and v>datetime.date.today() else 
> None)
>
> any help appreciated
>
> cheers
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from 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: TypeError: an integer is required

2015-11-11 Thread Anthony Smith
Thanks Anthony, you guys are a great assistance to all the newbies 

cheers

On Wednesday, 11 November 2015 23:30:54 UTC+11, Anthony wrote:
>
> datetime.date() is for constructing a date object and it takes integer 
> arguments (for the year, month, and day) -- you don't pass a date to it. 
> Instead, just do:
>
> SPAN(v, ...)
>
> Or if you don't like the default format you get when the date is converted 
> to a string, use the .strftime method:
>
> SPAN(v.strftime('%m/%d/%Y'))
>
> Anthony
>
> On Wednesday, November 11, 2015 at 2:09:04 AM UTC-5, Anthony Smith wrote:
>>
>> Hi, 
>> I am using the follow to highlight a date field where the date is greater 
>> then the current date.
>>
>> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
>> SPAN(datetime.date(v),_class='withhold' if v >datetime.date.today() else 
>> None)
>> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
>> SPAN(datetime.date(v),_class='withhold' if v and v> datetime.date.today() 
>> else None)
>>
>> Traceback (most recent call last):
>>   File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "/home/tony/web2py/applications/cps5c/controllers/default.py" 
>> , 
>> line 562, in 
>>   File "applications/cps5c/modules/plugin_sqleditable/editable.py", line 
>> 415, in extract
>> r=func()
>>   File "/home/tony/web2py/gluon/tools.py", line 3774, in f
>> return action(*a, **b)
>>   File "/home/tony/web2py/applications/cps5c/controllers/default.py" 
>> , 
>> line 268, in stock_tasks
>> db.stock_task.created_by,
>>   File "/home/tony/web2py/gluon/sqlhtml.py", line 2717, in grid
>> nvalue = field.represent(value, row)
>>   File "/home/tony/web2py/applications/cps5c/models/db1.py" 
>> , line 144, in 
>> 
>> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
>> SPAN(datetime.date (v),_class='withhold' if v > datetime.date.today() else 
>> None)
>> TypeError: an integer is required
>>
>>
>> if I use the following works fine.
>> db.stock_task.withhold_until_date.represent = lambda v, row: 
>> SPAN(prettydate(v),_class='withhold' if v and v>datetime.date.today() else 
>> None)
>>
>> any help appreciated
>>
>> cheers
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from 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: TypeError: float argument required, not str

2013-10-26 Thread Niphlod
did you by any chance moved from 'string' to 'decimal(5,2)' AFTER creating 
the table on sqlite ?
sqlite can't alter the type of the column if data is already there. try 
recreating the table from scratch.

On Saturday, October 26, 2013 12:48:01 AM UTC+2, Carlos Zenteno wrote:

 This is my table:

 db.define_table('tenants_extra',
 Field('tenant', 'reference tenants'),
 Field('address', 'reference addresses'),
 Field('tenant_type', type = 'string', length = 32, default = 
 T('Condo'), required = True, label = T('Type'), comment = T('Type of your 
 organization'), notnull = True),
 Field('logo', type = 'upload', label = T('Logo'), comment = 'Logo file 
 (jpg or png) - 200x200', notnull = True),
 Field('legal_name', type = 'string', length = 64, label = T('Legal 
 Name'), comment = T('Legal name of your organization'), notnull = True),
 Field('tax_id', type = 'string', length = 13, default = '', label = 
 T('Tax ID'), comment = T('Tax ID of your organization'), notnull = True),
 Field('latitude', type = 'decimal(5,2)', label = T('Latitude'), 
 comment = T('Latitude for mapping location'), notnull = True),
 Field('longitude', type = 'decimal(5,2)', label = T('Longitude'), 
 comment = T('Longitude for mapping location'), notnull = True)
 )

 All works fine, can insert records OK 
 BUT when trying to view the records via appadmin it gives me the 
 following error:

   Traceback (most recent call last):
   File C:\Documents and 
 Settings\x\Desktop\y\Web2py\web2py\applications\ts\controllers/appadmin.py, 
 line 252, in select
   File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 10111, in 
 select
   File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 2304, in select
   File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1751, in select
   File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1732, in 
 _select_aux
   File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 2106, in parse
   File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1955, in 
 parse_value
   File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 2015, in 
 parse_decimal
 TypeError: float argument required, not str


 This is the query:
 db.tenants_extra.id0

 I guess that the problem has to be with using the 'decimal' type... 
 but I dont know, I am new to web2py...


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError: float argument required, not str

2013-10-26 Thread Carlos Zenteno
Yes I did... 
Will try your suggestion and report back 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: TypeError: float argument required, not str

2013-10-26 Thread Carlos Zenteno
OK, I can erase all rows...
but how do I drop the table?  Kinda stupid question?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError: float argument required, not str

2013-10-26 Thread Niphlod
either you delete the db (which means, all the tables are dropped), or you 
access the db from an external tool, or you do db.tablename.drop()
BTW, dropping the table isn't required if you delete all the records in the 
table.

On Saturday, October 26, 2013 9:02:10 PM UTC+2, Carlos Zenteno wrote:

 OK, I can erase all rows...
 but how do I drop the table?  Kinda stupid question?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError: float argument required, not str

2013-10-26 Thread Carlos Zenteno
Thanks a lot Niphlod

Actually, I erased the rows (all records) in table and the error persisted.
I then used the drop() command and the table was recreated with 'double' 
instead of 'string'.

Good to know this kind of stuff...

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError: not indexable

2013-10-16 Thread Niphlod
upgrade web2py, it's a known bug.

Il giorno mercoledì 16 ottobre 2013 01:46:08 UTC+2, __pyslan__ ha scritto:

 Hello!

 I'm trying update a field (total_treated) with ajax. I'm using a 
 SQLFORM.grid.

 In the index.html:

 {{extend 'masterpage.html'}}
 script type=text/javascript
 $(document).ready(function(){ 
 window.setInterval(function() {
 var objs = $([name^='t_']);
  for(var i = 0; i  objs.length; i++)
 {
 var l = objs[i].getAttribute(id);
  ajax('total_treated?l=' + l, ['id'], l);
 # doesn't work:
 # ajax('{{URL('total_treated')}}', ['id'], 'id');
  }
 }, 1);
 });
 /script


 In the lists.py:

 @auth.requires_login()
 def total_treated():
 print request.vars


 ERROR: 

 ...

   File /opt/web-apps/web2py/gluon/globals.py, line 218, in parse_post_vars

 if len(dpost):
   File /usr/local/lib/python2.7/cgi.py, line 599, in __len__

 return len(self.keys())

   File /usr/local/lib/python2.7/cgi.py, line 582, in keys

 raise TypeError, not indexable
 TypeError: not indexable


 I tried a lot of things... but without success...


 Help, please...


 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] Re: TypeError: not indexable

2013-10-16 Thread __pyslan__ - Ayslan Jenken
I'm using the last version, the 2.7.4...  In version 2.7.2 the same thing
happened


On Wed, Oct 16, 2013 at 3:36 AM, Niphlod niph...@gmail.com wrote:

 upgrade web2py, it's a known bug.

 Il giorno mercoledì 16 ottobre 2013 01:46:08 UTC+2, __pyslan__ ha scritto:

 Hello!

 I'm trying update a field (total_treated) with ajax. I'm using a
 SQLFORM.grid.

 In the index.html:

 {{extend 'masterpage.html'}}
 script type=text/javascript
 $(document).ready(function(){
 window.setInterval(function() {
 var objs = $([name^='t_']);
  for(var i = 0; i  objs.length; i++)
 {
 var l = objs[i].getAttribute(id);
  ajax('total_treated?l=' + l, ['id'], l);
 # doesn't work:
 # ajax('{{URL('total_treated')}}**', ['id'], 'id');
  }
 }, 1);
 });
 /script


 In the lists.py:

 @auth.requires_login()
 def total_treated():
 print request.vars


 ERROR:

 ...

   File /opt/web-apps/web2py/gluon/**globals.py, line 218, in 
 parse_post_vars

 if len(dpost):
   File /usr/local/lib/python2.7/cgi.**py, line 599, in __len__

 return len(self.keys())

   File /usr/local/lib/python2.7/cgi.**py, line 582, in keys

 raise TypeError, not indexable
 TypeError: not indexable


 I tried a lot of things... but without success...


 Help, please...


 Thanks!

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


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


Re: [web2py] Re: TypeError: not indexable

2013-10-16 Thread Niphlod
you are not using 2.7.4
Line 218 in trunk doesn't match your traceback.

https://github.com/web2py/web2py/blob/master/gluon/globals.py#L218

Il giorno mercoledì 16 ottobre 2013 13:45:53 UTC+2, __pyslan__ ha scritto:

 I'm using the last version, the 2.7.4...  In version 2.7.2 the same thing 
 happened


 On Wed, Oct 16, 2013 at 3:36 AM, Niphlod nip...@gmail.com 
 javascript:wrote:

 upgrade web2py, it's a known bug.

 Il giorno mercoledì 16 ottobre 2013 01:46:08 UTC+2, __pyslan__ ha scritto:

 Hello!

 I'm trying update a field (total_treated) with ajax. I'm using a 
 SQLFORM.grid.

 In the index.html:

 {{extend 'masterpage.html'}}
 script type=text/javascript
 $(document).ready(function(){ 
 window.setInterval(function() {
 var objs = $([name^='t_']);
  for(var i = 0; i  objs.length; i++)
 {
 var l = objs[i].getAttribute(id);
  ajax('total_treated?l=' + l, ['id'], l);
 # doesn't work:
 # ajax('{{URL('total_treated')}}**', ['id'], 'id');
  }
 }, 1);
 });
 /script


 In the lists.py:

 @auth.requires_login()
 def total_treated():
 print request.vars


 ERROR: 

 ...

   File /opt/web-apps/web2py/gluon/**globals.py, line 218, in 
 parse_post_vars


 if len(dpost):
   File /usr/local/lib/python2.7/cgi.**py, line 599, in __len__


 return len(self.keys())


   File /usr/local/lib/python2.7/cgi.**py, line 582, in keys


 raise TypeError, not indexable
 TypeError: not indexable


 I tried a lot of things... but without success...


 Help, please...


 Thanks!

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




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


Re: [web2py] Re: TypeError: not indexable

2013-10-16 Thread __pyslan__ - Ayslan Jenken
I'll check again...


On Wed, Oct 16, 2013 at 9:25 AM, Niphlod niph...@gmail.com wrote:

 you are not using 2.7.4
 Line 218 in trunk doesn't match your traceback.

 https://github.com/web2py/web2py/blob/master/gluon/globals.py#L218

 Il giorno mercoledì 16 ottobre 2013 13:45:53 UTC+2, __pyslan__ ha scritto:

 I'm using the last version, the 2.7.4...  In version 2.7.2 the same thing
 happened


 On Wed, Oct 16, 2013 at 3:36 AM, Niphlod nip...@gmail.com wrote:

 upgrade web2py, it's a known bug.

 Il giorno mercoledì 16 ottobre 2013 01:46:08 UTC+2, __pyslan__ ha
 scritto:

 Hello!

 I'm trying update a field (total_treated) with ajax. I'm using a
 SQLFORM.grid.

 In the index.html:

 {{extend 'masterpage.html'}}
 script type=text/javascript
 $(document).ready(function(){
 window.setInterval(function() {
 var objs = $([name^='t_']);
  for(var i = 0; i  objs.length; i++)
 {
 var l = objs[i].getAttribute(id);
  ajax('total_treated?l=' + l, ['id'], l);
 # doesn't work:
 # ajax('{{URL('total_treated')}}', ['id'], 'id');
  }
 }, 1);
 });
 /script


 In the lists.py:

 @auth.requires_login()
 def total_treated():
 print request.vars


 ERROR:

 ...

   File /opt/web-apps/web2py/gluon/**gl**obals.py, line 218, in 
 parse_post_vars


 if len(dpost):
   File /usr/local/lib/python2.7/cgi.py, line 599, in __len__


 return len(self.keys())


   File /usr/local/lib/python2.7/cgi.py, line 582, in keys


 raise TypeError, not indexable
 TypeError: not indexable


 I tried a lot of things... but without success...


 Help, please...


 Thanks!

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

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .


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


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


[web2py] Re: TypeError: %d format: a number is required, not dict

2013-09-11 Thread Massimo Di Pierro
The problem is that 

IS_TIME(...error_message='Formaat komt niet overeen met %d-%m-%Y')...)

should be

IS_TIME(...error_message='Formaat komt niet overeen met %%d-%%m-%%Y')...)

or

IS_TIME(...error_message='Formaat komt niet overeen met DD-MM-')...)

If you want a '%' in an error message it must be escaped '%%' else it is 
interpreted as a placeholder.

On Friday, 6 September 2013 10:19:31 UTC-5, Annet wrote:

 I downloaded web2py from: https://github.com/web2py/web2py/
 And tested my application, I still get the same error.


 Kind regards,

 Annet.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError: %d format: a number is required, not dict

2013-09-11 Thread Annet
Massimo,

Thanks for figuring out what the problem was, it didn't cross my
mind that the error messages were the problem.

Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError: %d format: a number is required, not dict

2013-09-06 Thread Annet
I downloaded web2py from: https://github.com/web2py/web2py/
And tested my application, I still get the same error.


Kind regards,

Annet.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError: %d format: a number is required, not dict

2013-09-05 Thread Massimo Di Pierro
Please try trunk or nightly build. I believe this is fixed.

On Thursday, 5 September 2013 00:42:04 UTC-5, Annet wrote:



 Version 2.5.1-stable+timestamp.2013.06.06.15.39.19


 Kind regards,

 Annet


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError: %d format: a number is required, not dict

2013-09-04 Thread Massimo Di Pierro
which version?

On Wednesday, 4 September 2013 13:49:29 UTC-5, Annet wrote:

 In a table definition I have these two fields:

 Field('startDate', label='Start datum * ', **isdate),
 Field('endDate', label='Eind datum', **isemptyorisdate),

 Since I have more of these fields I defined the following dicts

 isdate = dict(type='date', requires=IS_DATE(format='%d-%m-%Y', 
 error_message='Formaat komt niet overeen met %d-%m-%Y'), represent=lambda 
 v: v.strftime('%d/%m/%Y') if v else '')
 isemptyorisdate = dict(type='date', 
 requires=IS_EMPTY_OR(IS_DATE(format='%d-%m-%Y', error_message='Formaat komt 
 niet overeen met %d-%m-%Y')), represent=lambda v: v.strftime('%d/%m/%Y') if 
 v else '')

 I have more of these dict validators which all work fine:

 istime = dict(type='time', requires=IS_TIME(error_message='Formaat komt 
 niet overeen met HH:MM'), widget=timewidget, comment='Formaat HH:MM')
 isemptyoristime = dict(type='time', 
 requires=IS_EMPTY_OR(IS_TIME(error_message='Formaat komt niet overeen met 
 HH:MM')), widget=timewidget, comment='Formaat HH:MM')


 When I submit: http://127.0.0.1:8000/dbModel/appadmin/insert/db/eventList

 I get the following error:


 Traceback (most recent call last):
   File /Users/annet/web2py/gluon/restricted.py, line 212, in restricted
 exec ccode in environment
   File /Users/annet/web2py/applications/dbModel/controllers/appadmin.py 
 http://127.0.0.1:8000/admin/default/edit/dbModel/controllers/appadmin.py, 
 line 615, in module
   File /Users/annet/web2py/gluon/globals.py, line 194, in lambda
 self._caller = lambda f: f()
   File /Users/annet/web2py/applications/dbModel/controllers/appadmin.py 
 http://127.0.0.1:8000/admin/default/edit/dbModel/controllers/appadmin.py, 
 line 142, in insert
 if form.accepts(request.vars, session):
   File /Users/annet/web2py/gluon/sqlhtml.py, line 1370, in accepts
 **kwargs
   File /Users/annet/web2py/gluon/html.py, line 2010, in accepts
 status = self._traverse(status, hideerror)
   File /Users/annet/web2py/gluon/html.py, line 846, in _traverse
 newstatus = c._traverse(status, hideerror) and newstatus
   File /Users/annet/web2py/gluon/html.py, line 846, in _traverse
 newstatus = c._traverse(status, hideerror) and newstatus
   File /Users/annet/web2py/gluon/html.py, line 846, in _traverse
 newstatus = c._traverse(status, hideerror) and newstatus
   File /Users/annet/web2py/gluon/html.py, line 846, in _traverse
 newstatus = c._traverse(status, hideerror) and newstatus
   File /Users/annet/web2py/gluon/html.py, line 853, in _traverse
 newstatus = self._validate()
   File /Users/annet/web2py/gluon/html.py, line 1759, in _validate
 (value, errors) = validator(value)
   File /Users/annet/web2py/gluon/validators.py, line 2695, in __call__
 return self.other(value)
   File /Users/annet/web2py/gluon/validators.py, line 2269, in __call__
 return (ovalue, translate(self.error_message) % self.extremes)
 TypeError: %d format: a number is required, not dict



 Kind regards,


 Annet


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError: %d format: a number is required, not dict

2013-09-04 Thread Annet


Version 2.5.1-stable+timestamp.2013.06.06.15.39.19


Kind regards,

Annet

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError

2013-05-26 Thread Anthony
Can you show the db.table definition?

On Sunday, May 26, 2013 10:14:18 AM UTC-4, webpypy wrote:

 Hi,

 the statement

 form = SQLFORM(db.table)

 is giving the error

  unbound method formatter() must be called with IS_NOT_EMPTY instance as 
 first argument (got str instance instead)

 Please, explain.

 regards,

 Ashraf


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError

2013-05-26 Thread webpypy
Here it is

db.define_table(
'location',
Field('name' ,   requires = IS_NOT_EMPTY),
Field('category_id', 'reference category', requires = IS_NOT_EMPTY),
Field('company_id',  'reference company',  requires = 
IS_NOT_EMPTY,label = 'Owner id '),
Field('user_id', 'reference auth_user',requires = IS_NOT_EMPTY ,
   writable = False , readable = True),
Field('dept_id', 'reference dept',requires = IS_NOT_EMPTY ,
   writable = False , readable = True ))


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError

2013-05-26 Thread webpypy
when I added the fields, as in

form = SQLFORM(db.location, fields=['name'])
if form.process().accepted:

it worked, but stopped at the next statement, giving the error

 'IS_NOT_EMPTY' object is not iterable

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError

2013-05-26 Thread webpypy


On Sunday, May 26, 2013 5:14:18 PM UTC+3, webpypy wrote:

 Hi,

 the statement

 form = SQLFORM(db.table)

 is giving the error

  unbound method formatter() must be called with IS_NOT_EMPTY instance as 
 first argument (got str instance instead)

 Please, explain.

 regards,

 Ashraf


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError

2013-05-26 Thread webpypy
when I changed the table definition to

db.define_table(
'location',
Field('name' ),
Field('category_id', 'reference category'),
Field('company_id',  'reference company'  ,label = 'Owner id '),
Field('user_id', 'reference auth_user',writable = False , 
readable = True),
Field('dept_id', 'reference dept', writable = False , 
readable = True ))
db.location.name.requires =IS_NOT_EMPTY()
db.location.category_id.requires =IS_NOT_EMPTY()
db.location.company_id.requires =IS_NOT_EMPTY()
db.location.user_id.requires =IS_NOT_EMPTY()
db.location.dept_id.requires =IS_NOT_EMPTY()

It works fine.

I think that it needs to explored...

Thanks 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from 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: TypeError: __call__() takes exactly 3 arguments (4 given)

2013-01-15 Thread aabelyakov
It works! Thanks... 

понедельник, 14 января 2013 г., 21:43:26 UTC+4 пользователь Massimo Di 
Pierro написал:

 Very odd. Can you try replace

 thread.start_new_thread(start_browser,
 (get_url(ip, proto=proto, port=port),),
 dict(startup=True))

 with

 thread.start_new_thread(start_browser,
 (get_url(ip, proto=proto, port=port), 
 True))

 On Sunday, 13 January 2013 23:44:45 UTC-6, aabelyakov wrote:

 ubuntu v.11.04 (Natty), v.12.04 (Precise), windows 8
 web2py v.2.3.2 (2012-12-17 15:03:30) stable


 When you run web2py.py without parameter -a recycle

 Exception in Tkinter callback
 Traceback (most recent call last):
 File /usr/lib/python2.7/lib-tk/Tkinter.py, line 1413, in __call__
 return self.func(*args)
 File /home/aabelyakov/MyPython/web2py/gluon/widget.py, line 514, in 
 start
 dict(startup=True))
 TypeError: __call__() takes exactly 3 arguments (4 given)



-- 





[web2py] Re: TypeError: __call__() takes exactly 3 arguments (4 given)

2013-01-14 Thread Massimo Di Pierro
Very odd. Can you try replace

thread.start_new_thread(start_browser,
(get_url(ip, proto=proto, port=port),),
dict(startup=True))

with

thread.start_new_thread(start_browser,
(get_url(ip, proto=proto, port=port), 
True))

On Sunday, 13 January 2013 23:44:45 UTC-6, aabelyakov wrote:

 ubuntu v.11.04 (Natty), v.12.04 (Precise), windows 8
 web2py v.2.3.2 (2012-12-17 15:03:30) stable


 When you run web2py.py without parameter -a recycle

 Exception in Tkinter callback
 Traceback (most recent call last):
 File /usr/lib/python2.7/lib-tk/Tkinter.py, line 1413, in __call__
 return self.func(*args)
 File /home/aabelyakov/MyPython/web2py/gluon/widget.py, line 514, in start
 dict(startup=True))
 TypeError: __call__() takes exactly 3 arguments (4 given)


-- 





[web2py] Re: TypeError: list indices must be integers, not str

2012-09-27 Thread Massimo Di Pierro
I tried this from shell and cannot reproduce the problem:

 db = DAL()
 db.define_table('laptops', 
... Field('id_laptop','integer'),
... Field('serial_number','string'),
... Field('id_trademark','integer'),
... primarykey=['id_laptop'])
Table laptops (id_laptop,serial_number,id_trademark)
 db.laptops.insert(serial_number='1',id_trademark=int('1')){}
 db.commit()

On Thursday, 27 September 2012 02:00:57 UTC-5, Manu Mora wrote:

 Hello! I have a problem with DAL.

 I have this table:

 *cdb.define_table('laptops', *
 *Field('id_laptop','integer'),*
 *Field('serial_number','string'),*
 *Field('id_trademark','integer'),*
 *primarykey=['id_laptop'])*
 *
 *
 and when I try to insert:

 *
 self.DB.laptops.insert(serial_number=self.serial_number,id_trademark=int(self.id_trademark))
 *
 *self.DB.commit()*

 I get this error:

 *TypeError: list indices must be integers, not str*
 *
 *
 Thanks.


-- 





[web2py] Re: TypeError: can't pickle file objects

2012-08-28 Thread Massimo Di Pierro
The definitively goes in modules.

On Monday, 27 August 2012 23:50:27 UTC-5, aabelyakov wrote:

 gLib.py - this is a common library of functions and procedures. It uses 
 global variables attached to the session.

 понедельник, 27 августа 2012 г., 23:00:37 UTC+4 пользователь Massimo Di 
 Pierro написал:

 gLib.py is probably a module, not a model. I would put it there. Why it 
 fails I cannot say, I do not know what it does.



-- 





[web2py] Re: TypeError: can't pickle file objects

2012-08-28 Thread aabelyakov
GLib.py put in the directory modules. Import it from the model file 
scheduler.py. Run it in the background with the parameters db and session. 
it works!
Thank you! The question is closed...

вторник, 28 августа 2012 г., 20:17:40 UTC+4 пользователь Massimo Di Pierro 
написал:

 The definitively goes in modules.

 On Monday, 27 August 2012 23:50:27 UTC-5, aabelyakov wrote:

 gLib.py - this is a common library of functions and procedures. It uses 
 global variables attached to the session.

 понедельник, 27 августа 2012 г., 23:00:37 UTC+4 пользователь Massimo Di 
 Pierro написал:

 gLib.py is probably a module, not a model. I would put it there. Why it 
 fails I cannot say, I do not know what it does.



-- 





[web2py] Re: TypeError: can't pickle file objects

2012-08-27 Thread Massimo Di Pierro
gLib.py is probably a module, not a model. I would put it there. Why it 
fails I cannot say, I do not know what it does.

On Monday, 27 August 2012 11:22:31 UTC-5, aabelyakov wrote:

 After placing gLib.py module into directory models web2py (versions 2.0 
 and 1.99.7 on Windows and Ubuntu) fails:

 Traceback (most recent call last):
 File /home/aabelyakov/MyPython/web2py/gluon/main.py, line 528, in 
 wsgibase
 session._try_store_on_disk(request, response)
 File /home/aabelyakov/MyPython/web2py/gluon/globals.py, line 594, in 
 _try_store_on_disk
 cPickle.dump(dict(self), response.session_file)
 File /usr/lib/python2.7/copy_reg.py, line 70, in _reduce_ex
 raise TypeError, can't pickle %s objects % base.__name__
 TypeError: can't pickle file objects

 In what could be the reason?


-- 





[web2py] Re: TypeError: can't pickle file objects

2012-08-27 Thread aabelyakov
gLib.py - this is a common library of functions and procedures. It uses 
global variables attached to the session.

понедельник, 27 августа 2012 г., 23:00:37 UTC+4 пользователь Massimo Di 
Pierro написал:

 gLib.py is probably a module, not a model. I would put it there. Why it 
 fails I cannot say, I do not know what it does.



-- 





[web2py] Re: TypeError: int() argument must be a string or a number, not 'Table' ?

2012-05-18 Thread Massimo Di Pierro
Which web2py version? If trunk, please open a ticket.

On Friday, 18 May 2012 03:11:18 UTC-5, Johann Spies wrote:

 I get the error in the subject line and I do not have any idea why.

 I have the following model (shortened):
  db.define_table('doccenter',
 Field('doc_nr',
   type = 'string',
   length = 50),   
 
 Field('location'),Field(
 'category'),
 akb_signature_uuid,
 Field('loc_id', 'bigint'),
 Field('cat_id', 'bigint')
 )

 The following terminal session illustrates the problem

 In [3]: x = 1

 In [4]: y = 1

 In [5]: rid = 1

 In [6]: db.doccenter[rid] = dict(loc_id= x, cat_id = y)
 ---
 TypeError Traceback (most recent call last
 )
 /home/js/web2py/applications/nakb/models/menu.py in module()
  1 db.doccenter[rid] = dict(loc_id= x, cat_id = y)

 /home/js/web2py/gluon/dal.pyc in __setitem__(self, key, value)
7058 self.insert(**self._filter_fields(value))
7059 elif self._db(self._id == key)\
 - 7060 .update(**self._filter_fields(value)) is None:
7061 raise SyntaxError, 'No such record: %s' % key
7062 else:

 /home/js/web2py/gluon/dal.pyc in update(self, **update_fields)
8018 fields = table._listify(update_fields,update=True)
8019 if not fields: raise SyntaxError, No fields to update
 - 8020 ret = self.db._adapter.update(tablename,self.query,fields)
8021 ret and [f(self,update_fields) for f in table.
 _after_update]
8022 return ret

 /home/js/web2py/gluon/dal.pyc in update(self, tablename, query, fields)
1188 
1189 def update(self, tablename, query, fields):
 - 1190 sql = self._update(tablename, query, fields)
1191 self.execute(sql)
1192 try:

 /home/js/web2py/gluon/dal.pyc in _update(self, tablename, query, fields)
1184 sql_w = ''
1185 sql_v = ','.join(['%s=%s' % (field.name, self.expand(value
 , field.type)) \
 - 1186   for (field, value) in fields])
1187 return 'UPDATE %s SET %s%s;' % (tablename, sql_v, sql_w)
1188 

 /home/js/web2py/gluon/dal.pyc in expand(self, expression, field_type)
1127 return '(%s)' % expression.op
1128 elif field_type:
 - 1129 return str(self.represent(expression,field_type))
1130 elif isinstance(expression,(list,tuple)):
1131 return ','.join(self.represent(item,field_type) foritem 
 in expression)

 /home/js/web2py/gluon/dal.pyc in represent(self, obj, fieldtype)
2332 # raise SyntaxError, 'Invalid field type %s' 
 %fieldtype

2333 return value
 - 2334 return BaseAdapter.represent(self, obj, fieldtype)
2335 
2336 

 /home/js/web2py/gluon/dal.pyc in represent(self, obj, fieldtype)
1508 elif isinstance(obj, (Row, Reference)):
1509 return str(obj['id'])
 - 1510 return str(int(obj))
1511 elif fieldtype == 'double':
1512 return repr(float(obj))

 TypeError: int() argument must be a string or a number, not 'Table'

 Can somebody explain to me what is going on here?

 Regards
 Johann



Re: [web2py] Re: TypeError: int() argument must be a string or a number, not 'Table' ?

2012-05-18 Thread Johann Spies
On 18 May 2012 14:21, Massimo Di Pierro massimo.dipie...@gmail.com wrote:

 Which web2py version? If trunk, please open a ticket.


It is the trunk. Issue
804http://code.google.com/p/web2py/issues/detail?id=804


Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


[web2py] Re: TypeError: 'instancemethod' object is unsubscriptable

2012-05-08 Thread Annet
Hi Anthony,

After adding the missing ')' I still got the same error I had to remove the 
comments, # hidden field and # /form, to get rid of the error.


div class=form-header
{{=response.function}}
/div

div class=form-body
{{=form.custom.begin}}
{{#!-- Add header here --}}
{{=form.element('table')}}
/div

div class=form-footer
{{#!-- Add footer here --}}
{{=DIV(form.custom.end[1])}}
{{#!-- Add submit/cancel buttons here - you may even not use the submit 
variable --}}
{{=form.custom.end[0]}}
/div


This view displays the entire form including tr 
id=submit_record__row../tr in div class=form-body../div, whereas 
I'd like tr id=submit_record__row../tr to be in the div 
class=form-footer../div.  According to this comment that's possible: 
{{#!-- Add submit/cancel buttons here - you may even not use the submit 
variable --}} I just don't know how to do this.


Kind regards,

Annet.





[web2py] Re: TypeError: 'instancemethod' object is unsubscriptable

2012-05-07 Thread Massimo Di Pierro
Please post the entire view and form definition.

On Monday, 7 May 2012 00:37:42 UTC-5, Annet wrote:

 Massimo,

 I tried both solutions, they both result in the same error:

 Traceback (most recent call last):
   File /Library/Python/2.5/site-packages/web2py/gluon/restricted.py, line 
 204, in restricted
 ccode = compile2(code,layer)
   File /Library/Python/2.5/site-packages/web2py/gluon/restricted.py, line 
 189, in compile2
 return compile(code.rstrip().replace('\r\n','\n')+'\n', layer, 'exec')
   File 
 /Library/Python/2.5/site-packages/web2py/applications/bootstrap/views/generic.html
  http://127.0.0.1:8000/admin/default/edit/bootstrap/views/generic.html, 
 line 115
 response.write('\n\n', escape=False)
^
 SyntaxError: invalid syntax



 Kind regards,

 Annet.



[web2py] Re: TypeError: 'instancemethod' object is unsubscriptable

2012-05-07 Thread Annet
The table definition:

db.define_table('Contact',
Field('organization',length=128),
Field('title',length=8),
Field('givenName',length=32),
Field('familyName',length=64,default='',notnull=True),
Field('phone',length=16),
Field('email',length=128,default='',notnull=True),
Field('subject',length=128,default='',notnull=True),
Field('text',type='text',default='',notnull=True),
Field('createdOn',type='datetime',writable=False,readable=False),
Field('modifiedOn',type='datetime',writable=False,readable=False),
Field('repliedOn',type='datetime',writable=False,readable=False),
migrate=False)


The function:

def contact():
response.view='generic.html'
form=SQLFORM(db.Contact,separator='')
if form.process().accepted:
response.flash=response.flash_formsuccess
elif form.errors:
response.flash=response.flash_formerror
else:
response.flash=response.flash_form
return dict(form=form)


The view, is the generic.html view:

{{extend 'layout.html'}}
{{

You should not modify this file. 
It is used as default when a view is not provided for your controllers

}}
h2{{=' '.join(x.capitalize() for x in request.function.split('_'))}}/h2
{{if len(response._vars)==1:}}
{{=BEAUTIFY(response._vars.values()[0])}}
{{elif len(response._vars)1:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{if request.is_local:}}
{{=response.toolbar()}}
{{pass}}

{{=form.custom.begin}}

{{#!-- Add header here --}}
{{=form.element('table')}}

{{#!-- Add footer here --}}
{{=DIV(form.custom.end[1] # hidden field}}

{{#!-- Add submit/cancel buttons here - you may even not use the submit 
variable --}}
{{=form.custom.end[0] # /form}}


I hope I provided sufficient information to solve the problem.

Kind regards,

Annet


[web2py] Re: TypeError: 'instancemethod' object is unsubscriptable

2012-05-07 Thread Anthony


 {{=DIV(form.custom.end[1] # hidden field}}


Missing ) 


[web2py] Re: TypeError: 'instancemethod' object is unsubscriptable

2012-05-07 Thread villas
Eyes like an hawk!  :)


[web2py] Re: TypeError: 'instancemethod' object is unsubscriptable

2012-05-07 Thread Annet
Hi Anthony,

Indeed, eyes like an eagle.

After adding the missing ')', I still got the same error. I had to remove 
both comments # hidden field and # /form to get rid of the errors. 

In the generic.html view I now have:

{{=form.custom.begin}}

{{#!-- Add header here --}}
{{=form.element('table')}}

{{#!-- Add footer here --}}
{{=DIV(form.custom.end[1])}}

{{#!-- Add submit/cancel buttons here - you may even not use the submit 
variable --}}
{{=form.custom.end[0]}}

Which results in a page that displays:

divform action= enctype=multipart/form-data 
method=post.../form/divdivbutton 
onclick=document.location=#x27;/admin/default/design/bootstrap#x27;design/button.../table/div/divscript!--jQuery('.hidden').hide()//--/script/div
form  action= enctype=multipart/form-data method=posttable.../table


It displays the form twice and shows the development buttons? I am using web2py 
1.99.7.


Kind regards,

Annet



[web2py] Re: TypeError: 'instancemethod' object is unsubscriptable

2012-05-06 Thread Massimo Di Pierro
 {{=form.element('table')}}

or

 {{=form[0]}}

On Sunday, 6 May 2012 01:20:51 UTC-5, Annet wrote:

 Using this code to customize a form:

 div class=form
   div class=form-header
 h3{{=response.functionname}}/h3
   /div !-- /form-header --
   div class=form-body
 {{=form.custom.begin}}
 {{=form.element['table']}}
   /div !-- /form-body --
   div class=form-footer
 {{=DIV(form.custom.end[1])}}
 {{=form.custom.end[0]}}
   /div !-- /form-footer --
 /div !-- /form --

 I get the following error:

 Traceback (most recent call last):
   File /Library/Python/2.5/site-packages/web2py/gluon/restricted.py, line 
 205, in restricted
 exec ccode in environment
   File 
 /Library/Python/2.5/site-packages/web2py/applications/bootstrap/views/util/generic.html,
  line 166, in module
 TypeError: 'instancemethod' object is unsubscriptable


 Line 166:

 164. response.write(form.custom.begin)
 165. response.write('\n', escape=False)
 166. response.write(form.element['table'])


 I am using web2py 1.99.7


 Kind regards,

 Annet.



[web2py] Re: TypeError: 'instancemethod' object is unsubscriptable

2012-05-06 Thread Annet
Massimo,

I tried both solutions, they both result in the same error:

Traceback (most recent call last):
  File /Library/Python/2.5/site-packages/web2py/gluon/restricted.py, line 
204, in restricted
ccode = compile2(code,layer)
  File /Library/Python/2.5/site-packages/web2py/gluon/restricted.py, line 
189, in compile2
return compile(code.rstrip().replace('\r\n','\n')+'\n', layer, 'exec')
  File 
/Library/Python/2.5/site-packages/web2py/applications/bootstrap/views/generic.html
 http://127.0.0.1:8000/admin/default/edit/bootstrap/views/generic.html, line 
115
response.write('\n\n', escape=False)
   ^
SyntaxError: invalid syntax



Kind regards,

Annet.


[web2py] Re: TypeError: 'module' object is not callable on globals()

2011-05-29 Thread dlypka
Great news.
Will upgrade.
Thanks!

On May 28, 7:40 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 This is fixed in trunk.
 You cannot do

 from gluon import *

 in version before 1.95.1

 On May 28, 3:44 pm, dlypka dly...@gmail.com wrote:







  I am trying to use crud but I get

  TypeError: 'module' object is not callable
  when I reference
     globals() in

    crud = Crud(globals(), mydb)

  At the top of my source file I have

  from gluon import *
  from gluon.globals import *
  from gluon.tools import Crud

  My web2py is Version 1.93.2 (2011-03-04 23:48:59)

  Any ideas?


[web2py] Re: TypeError: 'module' object is not callable on globals()

2011-05-28 Thread Massimo Di Pierro
This is fixed in trunk.
You cannot do

from gluon import *

in version before 1.95.1


On May 28, 3:44 pm, dlypka dly...@gmail.com wrote:
 I am trying to use crud but I get

 TypeError: 'module' object is not callable
 when I reference
    globals() in

   crud = Crud(globals(), mydb)

 At the top of my source file I have

 from gluon import *
 from gluon.globals import *
 from gluon.tools import Crud

 My web2py is Version 1.93.2 (2011-03-04 23:48:59)

 Any ideas?


Re: [web2py] Re: TypeError: is not JSON serializable

2011-01-31 Thread w2padawan
ping

2011/1/28 w2padawan web2py.n...@gmail.com:
 Hi massimo, do you know something more about this?

 2011/1/26 web2py noob web2py.n...@gmail.com:
 Hi Massimo,

 I send you my code attached to this email.
 Very thank you for your time.

 On 26 ene, 16:40, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 Can you please email me your app?

 On Jan 26, 10:05 am, web2py noob web2py.n...@gmail.com wrote:

  I'm trying to list the db.table's content using
  plugin_wiki.widget('jqgrid',table='table') but despite I put in
  controller, view o in a wiki_page (with respective sintaxis for each)
  I always get TypeError:  is not JSON serializable. My db model was
  generated by the app_wizard.

  I have looked for this problem in the archive but the same solution
  about deleting the SPAN in db.define_table at model doesn't seem to
  work for me.

  It's just jqgrid who's throwing the error, even if I didn't expose to
  view (when using plugin_wiki.widget('jqgrid',table='table') from
  controller)

  what could be the problem?

  thanks in advance.






Re: [web2py] Re: TypeError: is not JSON serializable

2011-01-31 Thread Richard Vézina
No attachement...

On Mon, Jan 31, 2011 at 8:53 AM, w2padawan web2py.n...@gmail.com wrote:

 ping

 2011/1/28 w2padawan web2py.n...@gmail.com:
  Hi massimo, do you know something more about this?
 
  2011/1/26 web2py noob web2py.n...@gmail.com:
  Hi Massimo,
 
  I send you my code attached to this email.
  Very thank you for your time.
 
  On 26 ene, 16:40, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
  Can you please email me your app?
 
  On Jan 26, 10:05 am, web2py noob web2py.n...@gmail.com wrote:
 
   I'm trying to list the db.table's content using
   plugin_wiki.widget('jqgrid',table='table') but despite I put in
   controller, view o in a wiki_page (with respective sintaxis for each)
   I always get TypeError:  is not JSON serializable. My db model was
   generated by the app_wizard.
 
   I have looked for this problem in the archive but the same solution
   about deleting the SPAN in db.define_table at model doesn't seem to
   work for me.
 
   It's just jqgrid who's throwing the error, even if I didn't expose to
   view (when using plugin_wiki.widget('jqgrid',table='table') from
   controller)
 
   what could be the problem?
 
   thanks in advance.
 
 
 
 



Re: [web2py] Re: TypeError: is not JSON serializable

2011-01-31 Thread w2padawan
I sent the attachment to his email, as he said.

2011/1/31 Richard Vézina ml.richard.vez...@gmail.com:
 No attachement...

 On Mon, Jan 31, 2011 at 8:53 AM, w2padawan web2py.n...@gmail.com wrote:

 ping

 2011/1/28 w2padawan web2py.n...@gmail.com:
  Hi massimo, do you know something more about this?
 
  2011/1/26 web2py noob web2py.n...@gmail.com:
  Hi Massimo,
 
  I send you my code attached to this email.
  Very thank you for your time.
 
  On 26 ene, 16:40, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
  Can you please email me your app?
 
  On Jan 26, 10:05 am, web2py noob web2py.n...@gmail.com wrote:
 
   I'm trying to list the db.table's content using
   plugin_wiki.widget('jqgrid',table='table') but despite I put in
   controller, view o in a wiki_page (with respective sintaxis for
   each)
   I always get TypeError:  is not JSON serializable. My db model was
   generated by the app_wizard.
 
   I have looked for this problem in the archive but the same solution
   about deleting the SPAN in db.define_table at model doesn't seem
   to
   work for me.
 
   It's just jqgrid who's throwing the error, even if I didn't expose
   to
   view (when using plugin_wiki.widget('jqgrid',table='table') from
   controller)
 
   what could be the problem?
 
   thanks in advance.
 
 
 
 




Re: [web2py] Re: TypeError: is not JSON serializable

2011-01-31 Thread Richard Vézina
Sorry... ;-)

On Mon, Jan 31, 2011 at 2:25 PM, w2padawan web2py.n...@gmail.com wrote:

 I sent the attachment to his email, as he said.

 2011/1/31 Richard Vézina ml.richard.vez...@gmail.com:
  No attachement...
 
  On Mon, Jan 31, 2011 at 8:53 AM, w2padawan web2py.n...@gmail.com
 wrote:
 
  ping
 
  2011/1/28 w2padawan web2py.n...@gmail.com:
   Hi massimo, do you know something more about this?
  
   2011/1/26 web2py noob web2py.n...@gmail.com:
   Hi Massimo,
  
   I send you my code attached to this email.
   Very thank you for your time.
  
   On 26 ene, 16:40, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:
   Can you please email me your app?
  
   On Jan 26, 10:05 am, web2py noob web2py.n...@gmail.com wrote:
  
I'm trying to list the db.table's content using
plugin_wiki.widget('jqgrid',table='table') but despite I put in
controller, view o in a wiki_page (with respective sintaxis for
each)
I always get TypeError:  is not JSON serializable. My db model
 was
generated by the app_wizard.
  
I have looked for this problem in the archive but the same
 solution
about deleting the SPAN in db.define_table at model doesn't seem
to
work for me.
  
It's just jqgrid who's throwing the error, even if I didn't expose
to
view (when using plugin_wiki.widget('jqgrid',table='table') from
controller)
  
what could be the problem?
  
thanks in advance.
  
  
  
  
 
 



Re: [web2py] Re: TypeError: is not JSON serializable

2011-01-28 Thread w2padawan
Hi massimo, do you know something more about this?

2011/1/26 web2py noob web2py.n...@gmail.com:
 Hi Massimo,

 I send you my code attached to this email.
 Very thank you for your time.

 On 26 ene, 16:40, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 Can you please email me your app?

 On Jan 26, 10:05 am, web2py noob web2py.n...@gmail.com wrote:

  I'm trying to list the db.table's content using
  plugin_wiki.widget('jqgrid',table='table') but despite I put in
  controller, view o in a wiki_page (with respective sintaxis for each)
  I always get TypeError:  is not JSON serializable. My db model was
  generated by the app_wizard.

  I have looked for this problem in the archive but the same solution
  about deleting the SPAN in db.define_table at model doesn't seem to
  work for me.

  It's just jqgrid who's throwing the error, even if I didn't expose to
  view (when using plugin_wiki.widget('jqgrid',table='table') from
  controller)

  what could be the problem?

  thanks in advance.





[web2py] Re: TypeError: is not JSON serializable

2011-01-26 Thread web2py noob
ping?

On 26 ene, 13:05, web2py noob web2py.n...@gmail.com wrote:
 I'm trying to list the db.table's content using
 plugin_wiki.widget('jqgrid',table='table') but despite I put in
 controller, view o in a wiki_page (with respective sintaxis for each)
 I always get TypeError:  is not JSON serializable. My db model was
 generated by the app_wizard.

 I have looked for this problem in the archive but the same solution
 about deleting the SPAN in db.define_table at model doesn't seem to
 work for me.

 It's just jqgrid who's throwing the error, even if I didn't expose to
 view (when using plugin_wiki.widget('jqgrid',table='table') from
 controller)

 what could be the problem?

 thanks in advance.


[web2py] Re: TypeError: is not JSON serializable

2011-01-26 Thread Massimo Di Pierro
Can you please email me your app?

On Jan 26, 10:05 am, web2py noob web2py.n...@gmail.com wrote:
 I'm trying to list the db.table's content using
 plugin_wiki.widget('jqgrid',table='table') but despite I put in
 controller, view o in a wiki_page (with respective sintaxis for each)
 I always get TypeError:  is not JSON serializable. My db model was
 generated by the app_wizard.

 I have looked for this problem in the archive but the same solution
 about deleting the SPAN in db.define_table at model doesn't seem to
 work for me.

 It's just jqgrid who's throwing the error, even if I didn't expose to
 view (when using plugin_wiki.widget('jqgrid',table='table') from
 controller)

 what could be the problem?

 thanks in advance.


[web2py] Re: TypeError: is not JSON serializable

2010-11-18 Thread mdipierro
as a test... try remove the SPAN around labels


On Nov 19, 1:35 am, Johann Spies johann.sp...@gmail.com wrote:
 I have a generic controller to show the contents of a table in a grid.  For
 one of the 33 tables I get this error while the other seems to work without
 problem:

 Controller:

 @auth.requires_login()
 def show_data():
        tabel = request.vars.tabel.lower()
        data= plugin_wiki.widget('jqgrid',table=tabel,width=950)
        return dict(data=data,tabel=tabel)

 @auth.requires_login()
 def captured_data():
        form = SQLFORM.factory(Field('tabel', requires =
 IS_IN_DB(db,db.label.form_id,groupby = 'form_id'),
                                    label = Which forms?),
                              )
        if form.accepts(request.vars, session):
               redirect(URL(r=request, f='show_data',vars=request.vars))
        elif form.errors:
               response.flash = 'form has errors'
        return dict(form = form)

 Model of the problem table:

 db.define_table(gr03,
                 Field(observer_or_trainer),
                 Field(service_provider,db.service_provider,
                       requires=IS_IN_DB(db,db.service_provider.id,
 '%(name)s'),label=Service provider),
                 Field(date,date),
                 Field(school,db.school,label=School,
                       requires=IS_IN_DB(db,db.school.id, '%(name)s')),
                 Field(teacher,db.teacher,
                       requires=IS_IN_DB(db,db.teacher.id,
 '%(school)s,%(surname)s,%(name)s')),
                 Field(focus,label=Topic/focus),
                 Field(assessment_standard,label=2. Assessment Standard),
                 Field(q3,text,
                       label=SPAN(3. Content knowledge for teacher)
                       ),
                 Field(q4,text,
                       label=SPAN(4. Teaching skills of
 teacher,BR(),spasies(4),
                                  (include use of resources))
                       ),
                 Field(q5,text,
                       label=SPAN(5. Overall finding),
                       ),

                 Field(q7,text),
                 Field(q8,text),
                 Field(q9,text),
                 Field(q10,text),
                 )

 What is a bit strange to me is that the line in the controller referred to
 by the ticket is the last line of the file and not in the vicinity of the
 controller involved.

 The ticket:

 Traceback (most recent call last):

   File /Users/js/Programmeer/zenex/web2py/gluon/restricted.py, line
 188, in restricted
     exec ccode in environment
   File 
 /Users/js/Programmeer/zenex/web2py/applications/zenex2/controllers/default.py
 http://127.0.0.1:8000/admin/default/edit/zenex2/controllers/default.py,
 line 1402, in module
   File /Users/js/Programmeer/zenex/web2py/gluon/globals.py, line 96,
 in lambda
     self._caller = lambda f: f()
   File /Users/js/Programmeer/zenex/web2py/gluon/tools.py, line 2272, in f
     return action(*a, **b)
   File 
 /Users/js/Programmeer/zenex/web2py/applications/zenex2/controllers/default.py
 http://127.0.0.1:8000/admin/default/edit/zenex2/controllers/default.py,
 line 827, in show_data
     data= plugin_wiki.widget('jqgrid',table=tabel,width=950)
   File 
 /Users/js/Programmeer/zenex/web2py/applications/zenex2/models/plugin_wiki.py
 http://127.0.0.1:8000/admin/default/edit/zenex2/models/plugin_wiki.py,
 line 675, in widget
     return getattr(PluginWikiWidgets,name)(*args,**kargs)
   File 
 /Users/js/Programmeer/zenex/web2py/applications/zenex2/models/plugin_wiki.py
 http://127.0.0.1:8000/admin/default/edit/zenex2/models/plugin_wiki.py,
 line 280, in jqgrid
      % dict(callback=callback,colnames=json(colnames),
   File /Users/js/Programmeer/zenex/web2py/gluon/serializers.py, line
 31, in json
     return simplejson.dumps(value)
   File 
 /Users/js/Programmeer/zenex/web2py/gluon/contrib/simplejson/__init__.py,
 line 228, in dumps
     return _default_encoder.encode(obj)
   File 
 /Users/js/Programmeer/zenex/web2py/gluon/contrib/simplejson/encoder.py,
 line 232, in encode
     chunks = list(chunks)
   File 
 /Users/js/Programmeer/zenex/web2py/gluon/contrib/simplejson/encoder.py,
 line 498, in _iterencode
     for chunk in _iterencode_list(o, _current_indent_level):
   File 
 /Users/js/Programmeer/zenex/web2py/gluon/contrib/simplejson/encoder.py,
 line 396, in _iterencode_list
     for chunk in chunks:
   File 
 /Users/js/Programmeer/zenex/web2py/gluon/contrib/simplejson/encoder.py,
 line 511, in _iterencode
     o = _default(o)
   File 
 /Users/js/Programmeer/zenex/web2py/gluon/contrib/simplejson/encoder.py,
 line 206, in default
     raise TypeError(repr(o) +  is not JSON serializable)
 TypeError:  is not JSON serializable

 I have no idea where to look for the problem.  In the appadmin everything
 seems to work OK.

 Regards
 Johann

 --
  May grace and peace be yours in abundance through the full knowledge of God
 and of Jesus our Lord!  His divine power has given us 

Re: [web2py] Re: TypeError: is not JSON serializable

2010-11-18 Thread Johann Spies
On 19 November 2010 09:43, mdipierro mdipie...@cs.depaul.edu wrote:

 as a test... try remove the SPAN around labels


That solved the problem.  Many thanks!

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


[web2py] Re: TypeError: slice indices must be integers or None or have an __index__ method

2010-10-19 Thread DenesL
Hi Annet,

the error is in the first line

Field('inschrijving',length='36',...

should be

Field('inschrijving',length=36,...

Denes


On Oct 19, 8:07 am, annet annet.verm...@gmail.com wrote:
 I defined the following table:

 db.define_table('applicationform',

 Field('inschrijving',length='36',default='',notnull=True,ondelete='RESTRICT'),
     Field('bedrijfsnaam',length=54,default='',notnull=True),
     Field('kvk_nummer',length=8),
     Field('subdossiernummer',length=4,default=''),
     Field('rechtsvorm',default='',notnull=True),
     Field('straat',length=42,default='',notnull=True),
     Field('huisnummer',length=9,default='',notnull=True),
     Field('huisnummerextensie',length=6),
     Field('postcode',length=7,default='',notnull=True),
     Field('plaats',length=42,default='',notnull=True),
     Field('telefoonnummer',length=72),
     Field('faxnummer',length=72),
     Field('mobielnummer',length=72),
     Field('email',length=72),
     Field('website',length=72),
     Field('aanhef'),
     Field('first_name',length=24),
     Field('last_name',length=42,default='',notnull=True),
     Field('email_persoon',length=72,default='',notnull=True),
     Field('application',length=24,writable=False,readable=False),
     Field('created_on',type='datetime',writable=False,readable=False),

 Field('modified_on',type='datetime',writable=False,readable=False),
     Field('replied_on',type='datetime',writable=False,readable=False),
     migrate=False)

 db.applicationform.inschrijving.requires=IS_IN_DB(db,db.inschrijving.inschrijving,'%
 (inschrijving)s',zero=None)
 db.applicationform.bedrijfsnaam.requires=[IS_LENGTH(54,error_message='lengte
 overschreidt 54 tekens'),IS_NOT_EMPTY()]
 db.applicationform.bedrijfsnaam.label='Bedrijfsnaam * '
 db.applicationform.kvk_nummer.requires=[IS_MATCH('\d{8}',error_message='geen
 match 8 cijfers'),IS_NOT_EMPTY()]
 db.applicationform.kvk_nummer.label='Kvk-nummer * '
 db.applicationform.subdossiernummer.requires=[IS_MATCH('\d{4}',error_message='geen
 match 4 cijfers'),IS_NOT_EMPTY()]
 db.applicationform.subdossiernummer.default=''
 db.applicationform.subdossiernummer.label='Subdossiernummer * '
 db.applicationform.rechtsvorm.requires=IS_IN_DB(db,db.rechtsvorm.rechtsvorm,'%
 (rechtsvorm)s',zero=None)
 db.applicationform.rechtsvorm.default='Onbekend'
 db.applicationform.straat.requires=[IS_LENGTH(42,error_message='lengte
 overschreidt 42 tekens'),IS_NOT_EMPTY()]
 db.applicationform.straat.label='Straat * '
 db.applicationform.huisnummer.requires=[IS_LENGTH(9,error_message='lengte
 overschreidt 9 tekens'),IS_NOT_EMPTY()]
 db.applicationform.huisnummer.label='Huisnummer * '
 db.applicationform.huisnummerextensie.requires=IS_LENGTH(6,error_message='length
 overschreidt 6 tekens')
 db.applicationform.postcode.requires=[IS_LENGTH(7,error_message='length
 overschreidt 7 tekens'),IS_NOT_EMPTY()]
 db.applicationform.plaats.requires=[IS_IN_DB(db,db.plaats.plaats,'%
 (plaats)s')]
 db.applicationform.plaats.widget=SQLFORM.widgets.autocomplete(request,db.plaats.plaats,min_length=2)
 db.applicationform.plaats.label='Plaats * '
 db.applicationform.telefoonnummer.requires=IS_LENGTH(72,error_message='lengte
 overschreidt 72 tekens')
 db.applicationform.faxnummer.requires=IS_LENGTH(72,error_message='lengte
 overschreidt 72 tekens')
 db.applicationform.mobielnummer.requires=IS_LENGTH(72,error_message='lengte
 overschreidt 72 tekens')
 db.applicationform.email.requires=[IS_LENGTH(72,error_message='lengte
 overschreidt 72 tekens'), IS_NULL_OR(IS_EMAIL())]
 db.applicationform.email.label='E-mail'
 db.applicationform.website.requires=IS_LENGTH(72,error_message='lengte
 overschreidt 72 tekens')
 db.applicationform.website.label='Web site'
 db.applicationform.aanhef.requires=IS_IN_SET(['de
 heer','mevrouw'],zero=None)
 db.applicationform.first_name.requires=IS_LENGTH(24,error_message='lengte
 overschreidt 24 tekens')
 db.applicationform.first_name.label='Voornaam'
 db.applicationform.last_name.requires=[IS_LENGTH(42,error_message='lengte
 overschreidt 42 tekens'),IS_NOT_EMPTY()]
 db.applicationform.last_name.label='Achternaam * '
 db.applicationform.email_persoon.requires=[IS_LENGTH(72,error_message='lengte
 overschreidt 72 tekens'), IS_EMAIL(), IS_NOT_EMPTY()]
 db.applicationform.email_persoon.label='E-mail * '
 db.applicationform.application.requires=IS_LENGTH(24,error_message='lengte
 overschreidt 24 tekens')
 db.applicationform.created_on.default=request.now
 db.applicationform.modified_on.default=request.now
 db.applicationform.modified_on.update=request.now
 db.applicationform.replied_on.default=''

 In this function I expose the form:

 def application_form():
     if not len(request.args):
         redirect(URL(r=request,c='default',f='error'))
     else:
         response.functionname='Aanmeldingsformulier'
         db.applicationform.application.default=request.args(0)
         form=SQLFORM(db.applicationform)
         form[0].insert(0,TR(H4('Bedrijfsgegevens:')))
         

[web2py] Re: TypeError: 'function' object is unsubscriptable

2010-10-17 Thread annet

 This error makes sense, promobox is an empty list and
 any attempt to index it (as in promobox[0]) will give the error.
 Note that is different from the error in your first post.

Yes, but I had hoped that this function:

@auth.requires_login()
def index():
if auth.user.account!='1':
redirect(URL(r=request,c='view',f='index'))
else:
response.functionname='Business Card'
return dict()

.. and this view:

{{if 'promobox' in globals():}}
  div class=sidebox
{{if promobox[0].kop:}}
  h3{{=promobox[0].kop}}/h3
{{pass}}
{{=XML(promobox[0].tekst)}}
  /div !-- sidebox --
{{pass}}

.. would, in case of re-using views, prevent me from returning empty
lists to the view for every variable in the view I do not assign a
value to in the function.

I solved the problem using the last function, but I was curious why
the function and view in the first post result in: TypeError:
'function' object is unsubscriptable.


Kind regards,

Annet.


[web2py] Re: TypeError: 'function' object is unsubscriptable

2010-10-17 Thread ron_m
As a test remove the promobox=box item from the dict returned from the
controller and put this

{{print globals().keys()}}

in the view file before the failure and check the output on the
console. This is also assuming you are running in developer mode with
the rocket web server.

You will likely find 'promobox' in the list printed out, probably
defined somewhere in the module or model files. The assignment
promobox=box inside the dict constructor in the controller is covering
up an already existing global dictionary item that has key 'promobox'.
It will also likely be a function definition. This causes the if
'promobox' in globals(): to always pass the test as true and an
attempt to take the index gives you the error.

On Oct 17, 12:16 am, annet annet.verm...@gmail.com wrote:
  This error makes sense, promobox is an empty list and
  any attempt to index it (as in promobox[0]) will give the error.
  Note that is different from the error in your first post.

 Yes, but I had hoped that this function:

 @auth.requires_login()
 def index():
     if auth.user.account!='1':
         redirect(URL(r=request,c='view',f='index'))
     else:
         response.functionname='Business Card'
         return dict()

 .. and this view:

 {{if 'promobox' in globals():}}
   div class=sidebox
     {{if promobox[0].kop:}}
       h3{{=promobox[0].kop}}/h3
     {{pass}}
     {{=XML(promobox[0].tekst)}}
   /div !-- sidebox --
 {{pass}}

 .. would, in case of re-using views, prevent me from returning empty
 lists to the view for every variable in the view I do not assign a
 value to in the function.

 I solved the problem using the last function, but I was curious why
 the function and view in the first post result in: TypeError:
 'function' object is unsubscriptable.

 Kind regards,

 Annet.


[web2py] Re: TypeError: 'function' object is unsubscriptable

2010-10-16 Thread DenesL
Hi Annet,

somehow promobox must be getting thru,
what is it and how is it defined?.

Denes


[web2py] Re: TypeError: 'function' object is unsubscriptable

2010-10-16 Thread annet
Hi Denes,

This is the function:

@auth.requires_login()
def index():
if auth.user.account!='1':
redirect(URL(r=request,c='view',f='index'))
else:
response.functionname='Business Card'
return dict()


I also tried:

@auth.requires_login()
def index():
if auth.user.account!='1':
redirect(URL(r=request,c='view',f='index'))
else:
response.functionname='Business Card'
box=[]
return dict(promobox=box)


.. but that resulted in:

Traceback (most recent call last):
  File /Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
restricted.py, line 188, in restricted
exec ccode in environment
  File /Library/Python/2.5/site-packages/web2py_1.87.3/applications/
cms/views/card/index.html, line 137, in module
IndexError: list index out of range


Given the last function, this view works:

{{if promobox:}}
  div class=sidebox
{{if promobox[0].kop:}}
  h3{{=promobox[0].kop}}/h3
{{pass}}
{{=XML(promobox[0].tekst)}}
  /div !-- sidebox --
{{pass}}


.. so  {{if promobox:}} instead of {{if 'promobox'in globals():}}


I hope I provided you with sufficient information to find out why the
errors occur.


Kind regards,

Annet.


[web2py] Re: TypeError: 'function' object is unsubscriptable

2010-10-16 Thread DenesL
On Oct 16, 9:03 am, annet annet.verm...@gmail.com wrote:

 I also tried:

 @auth.requires_login()
 def index():
     if auth.user.account!='1':
         redirect(URL(r=request,c='view',f='index'))
     else:
         response.functionname='Business Card'
         box=[]
         return dict(promobox=box)

 .. but that resulted in:

 Traceback (most recent call last):
   File /Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
 restricted.py, line 188, in restricted
     exec ccode in environment
   File /Library/Python/2.5/site-packages/web2py_1.87.3/applications/
 cms/views/card/index.html, line 137, in module
 IndexError: list index out of range

This error makes sense, promobox is an empty list and
any attempt to index it (as in promobox[0]) will give the error.
Note that is different from the error in your first post.

 Given the last function, this view works:

 {{if promobox:}}
   div class=sidebox
     {{if promobox[0].kop:}}
       h3{{=promobox[0].kop}}/h3
     {{pass}}
     {{=XML(promobox[0].tekst)}}
   /div !-- sidebox --
 {{pass}}

 .. so  {{if promobox:}} instead of {{if 'promobox'in globals():}}

 I hope I provided you with sufficient information to find out why the
 errors occur.

 Kind regards,

 Annet.


[web2py] Re: TypeError: sequence item 1: expected string, Field found

2010-09-15 Thread howesc
Andrew,

take a careful inspection of the docs/book about field references.
you setup user as a reference to a table, but when trying to set the
default you are setting it to a field.  it needs to know which user to
select.  also, in this case the default would need to be the ID of a
user not a first name.  you should look for docs about the represent
parameter that should help with the default rendering of the field (i
don't remember the details myself, just know that it's there).

also the auto-magical joins do happen when you have the table setup
properly.  you should be able to do:

 {{=row.user.last_name}}

or

{{=row.user.email}}

and web2py will join the auth table for you auto-magically.

good luck,

cfh
On Sep 13, 9:29 pm, Andrew Evans randra...@gmail.com wrote:
 Sorry that title is the error I would see when trying to access the default
 value of first_name

 On Mon, Sep 13, 2010 at 9:26 PM, ukolo randra...@gmail.com wrote:
  Hello

  I am trying to access this and other fields

  db.define_table(
     auth.settings.table_user_name,
     Field('first_name', length=128, default=''),

  from this table

  db.define_table('product',
     Field('user', custom_auth_table,
  default=custom_auth_table.first_name, readable=False, writable=False),

  I am trying to figure out why I can't pull first_name or other values
  from my data

  {{for row in rows:}}

   {{=row.user}}

  Ultimately I would like to be able to use other values also like

   {{=row.user.custom_auth_table.last_name}}

  or

  {{=row.user.custom_auth_table.email}}

  How can I do this?

  Any ideas *cheers




[web2py] Re: TypeError: sequence item 1: expected string, Field found

2010-09-13 Thread Andrew Evans
Sorry that title is the error I would see when trying to access the default
value of first_name

On Mon, Sep 13, 2010 at 9:26 PM, ukolo randra...@gmail.com wrote:

 Hello

 I am trying to access this and other fields

 db.define_table(
auth.settings.table_user_name,
Field('first_name', length=128, default=''),

 from this table

 db.define_table('product',
Field('user', custom_auth_table,
 default=custom_auth_table.first_name, readable=False, writable=False),

 I am trying to figure out why I can't pull first_name or other values
 from my data

 {{for row in rows:}}

  {{=row.user}}

 Ultimately I would like to be able to use other values also like

  {{=row.user.custom_auth_table.last_name}}

 or

 {{=row.user.custom_auth_table.email}}

 How can I do this?

 Any ideas *cheers


[web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-22 Thread mdipierro
I used the same trick for lazyT (object returned by T). In trunk.

On Aug 22, 12:58 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Aug 21, 2010, at 10:41 PM, mdipierro wrote:

  I had it, together with __getslice__, I thought I pushed in 819 but
  perhaps I did not. Pushing again.

 That's better.



  On Aug 22, 12:17 am, Jonathan Lundell jlund...@pobox.com wrote:
  On Aug 21, 2010, at 10:02 PM, mdipierro wrote:

  Did you try 819?

  I think XML needs this:

      def __getitem__(self, key):
          return str(self).__getitem__(key)

  Massimo

  On Aug 21, 11:01 pm, mr.freeze nat...@freezable.com wrote:
  I get the same thing on a newly created app when running from trunk:

  Traceback (most recent call last):
    File C:\web2py\gluon\restricted.py, line 188, in restricted
      exec ccode in environment
    File C:\web2py\applications\crashtest/views\default/index.html,
  line 27, in module
  TypeError: 'XML' object is unsubscriptable

  On Aug 21, 9:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Which version. If not web2py stable, please check latest trunk.

  On Aug 21, 8:33 pm, Jose jjac...@gmail.com wrote:

  Hi,

  (I can not find the thread where it was this error)

  From admin create a new application: apptest

  go to:http://127.0.0.1:8000/apptest

  produces the following error:

  TypeError: 'XML' object is unsubscriptable

  if type(code) == types.CodeType:
              ccode = code
          else:
              ccode = compile2(code,layer)

  exec ccode in environment

      except HTTP:
          raise
      except Exception:
          # XXX Show exception in Wing IDE if running in debugger


[web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-22 Thread Jose


On 21 ago, 23:58, mdipierro mdipie...@cs.depaul.edu wrote:
 Which version. If not web2py stable, please check latest trunk.


When I wrote, was the version of the trunk. Today I updated and it
works fine, this error does not occur.


[web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread mdipierro
Which version. If not web2py stable, please check latest trunk.

On Aug 21, 8:33 pm, Jose jjac...@gmail.com wrote:
 Hi,

 (I can not find the thread where it was this error)

 From admin create a new application: apptest

 go to:http://127.0.0.1:8000/apptest

 produces the following error:

 TypeError: 'XML' object is unsubscriptable

 if type(code) == types.CodeType:
             ccode = code
         else:
             ccode = compile2(code,layer)

 exec ccode in environment

     except HTTP:
         raise
     except Exception:
         # XXX Show exception in Wing IDE if running in debugger


[web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread mr.freeze
I get the same thing on a newly created app when running from trunk:

Traceback (most recent call last):
  File C:\web2py\gluon\restricted.py, line 188, in restricted
exec ccode in environment
  File C:\web2py\applications\crashtest/views\default/index.html,
line 27, in module
TypeError: 'XML' object is unsubscriptable

On Aug 21, 9:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Which version. If not web2py stable, please check latest trunk.

 On Aug 21, 8:33 pm, Jose jjac...@gmail.com wrote:

  Hi,

  (I can not find the thread where it was this error)

  From admin create a new application: apptest

  go to:http://127.0.0.1:8000/apptest

  produces the following error:

  TypeError: 'XML' object is unsubscriptable

  if type(code) == types.CodeType:
              ccode = code
          else:
              ccode = compile2(code,layer)

  exec ccode in environment

      except HTTP:
          raise
      except Exception:
          # XXX Show exception in Wing IDE if running in debugger


[web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread mdipierro
Did you try 819?

Massimo

On Aug 21, 11:01 pm, mr.freeze nat...@freezable.com wrote:
 I get the same thing on a newly created app when running from trunk:

 Traceback (most recent call last):
   File C:\web2py\gluon\restricted.py, line 188, in restricted
     exec ccode in environment
   File C:\web2py\applications\crashtest/views\default/index.html,
 line 27, in module
 TypeError: 'XML' object is unsubscriptable

 On Aug 21, 9:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Which version. If not web2py stable, please check latest trunk.

  On Aug 21, 8:33 pm, Jose jjac...@gmail.com wrote:

   Hi,

   (I can not find the thread where it was this error)

   From admin create a new application: apptest

   go to:http://127.0.0.1:8000/apptest

   produces the following error:

   TypeError: 'XML' object is unsubscriptable

   if type(code) == types.CodeType:
               ccode = code
           else:
               ccode = compile2(code,layer)

   exec ccode in environment

       except HTTP:
           raise
       except Exception:
           # XXX Show exception in Wing IDE if running in debugger


Re: [web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread Jonathan Lundell
On Aug 21, 2010, at 10:02 PM, mdipierro wrote:

 Did you try 819?

I think XML needs this:

def __getitem__(self, key):
return str(self).__getitem__(key)




 
 Massimo
 
 On Aug 21, 11:01 pm, mr.freeze nat...@freezable.com wrote:
 I get the same thing on a newly created app when running from trunk:
 
 Traceback (most recent call last):
   File C:\web2py\gluon\restricted.py, line 188, in restricted
 exec ccode in environment
   File C:\web2py\applications\crashtest/views\default/index.html,
 line 27, in module
 TypeError: 'XML' object is unsubscriptable
 
 On Aug 21, 9:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 
 Which version. If not web2py stable, please check latest trunk.
 
 On Aug 21, 8:33 pm, Jose jjac...@gmail.com wrote:
 
 Hi,
 
 (I can not find the thread where it was this error)
 
 From admin create a new application: apptest
 
 go to:http://127.0.0.1:8000/apptest
 
 produces the following error:
 
 TypeError: 'XML' object is unsubscriptable
 
 if type(code) == types.CodeType:
 ccode = code
 else:
 ccode = compile2(code,layer)
 
 exec ccode in environment
 
 except HTTP:
 raise
 except Exception:
 # XXX Show exception in Wing IDE if running in debugger




[web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread mdipierro
I had it, together with __getslice__, I thought I pushed in 819 but
perhaps I did not. Pushing again.

On Aug 22, 12:17 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Aug 21, 2010, at 10:02 PM, mdipierro wrote:

  Did you try 819?

 I think XML needs this:

     def __getitem__(self, key):
         return str(self).__getitem__(key)



  Massimo

  On Aug 21, 11:01 pm, mr.freeze nat...@freezable.com wrote:
  I get the same thing on a newly created app when running from trunk:

  Traceback (most recent call last):
    File C:\web2py\gluon\restricted.py, line 188, in restricted
      exec ccode in environment
    File C:\web2py\applications\crashtest/views\default/index.html,
  line 27, in module
  TypeError: 'XML' object is unsubscriptable

  On Aug 21, 9:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Which version. If not web2py stable, please check latest trunk.

  On Aug 21, 8:33 pm, Jose jjac...@gmail.com wrote:

  Hi,

  (I can not find the thread where it was this error)

  From admin create a new application: apptest

  go to:http://127.0.0.1:8000/apptest

  produces the following error:

  TypeError: 'XML' object is unsubscriptable

  if type(code) == types.CodeType:
              ccode = code
          else:
              ccode = compile2(code,layer)

  exec ccode in environment

      except HTTP:
          raise
      except Exception:
          # XXX Show exception in Wing IDE if running in debugger


Re: [web2py] Re: TypeError: 'XML' object is unsubscriptable

2010-08-21 Thread Jonathan Lundell
On Aug 21, 2010, at 10:41 PM, mdipierro wrote:

 I had it, together with __getslice__, I thought I pushed in 819 but
 perhaps I did not. Pushing again.

That's better.

 
 On Aug 22, 12:17 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Aug 21, 2010, at 10:02 PM, mdipierro wrote:
 
 Did you try 819?
 
 I think XML needs this:
 
 def __getitem__(self, key):
 return str(self).__getitem__(key)
 
 
 
 Massimo
 
 On Aug 21, 11:01 pm, mr.freeze nat...@freezable.com wrote:
 I get the same thing on a newly created app when running from trunk:
 
 Traceback (most recent call last):
   File C:\web2py\gluon\restricted.py, line 188, in restricted
 exec ccode in environment
   File C:\web2py\applications\crashtest/views\default/index.html,
 line 27, in module
 TypeError: 'XML' object is unsubscriptable
 
 On Aug 21, 9:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 
 Which version. If not web2py stable, please check latest trunk.
 
 On Aug 21, 8:33 pm, Jose jjac...@gmail.com wrote:
 
 Hi,
 
 (I can not find the thread where it was this error)
 
 From admin create a new application: apptest
 
 go to:http://127.0.0.1:8000/apptest
 
 produces the following error:
 
 TypeError: 'XML' object is unsubscriptable
 
 if type(code) == types.CodeType:
 ccode = code
 else:
 ccode = compile2(code,layer)
 
 exec ccode in environment
 
 except HTTP:
 raise
 except Exception:
 # XXX Show exception in Wing IDE if running in debugger




[web2py] Re: TypeError: 'NoneType' object is not callable

2010-08-17 Thread mdipierro
this was a bug and was fixed in 1.83.2. please check it.

Massimo

On Aug 17, 3:24 am, Karan Poddar karan.pod...@gmail.com wrote:
 import datetime; now=datetime.datetime.today()

 db.define_table('Genre',
                 SQLField('Name','string'))

 db.Genre.Name.requires=IS_NOT_IN_DB(db,'Genre.Name')

 db.define_table('Songs',
                 SQLField('Name','string',requires=IS_NOT_EMPTY()),
                 SQLField('file','upload',requires=IS_NOT_EMPTY()),
                 SQLField('date','datetime'),

 SQLField('download','integer',default=0,readable=False,writable=False),
                 SQLField('genre',db.Genre),
                 SQLField('usr',db.auth_user),

 SQLField('album','string',default='Unknown',requires=IS_NOT_EMPTY()),

 SQLField('artist','string',default='Unknown',requires=IS_NOT_EMPTY()),

 SQLField('rating','double',default=0,readable=False,writable=False),

 SQLField('rater','integer',default=0,readable=False,writable=False),

 SQLField('play','integer',default=0,readable=False,writable=False))

 db.Songs.genre.requires=IS_IN_DB(db,'Genre.id','%(Name)s')
 db.Songs.usr.requires=IS_IN_DB(db,'auth_user.id','%(first_name)s')
 db.Songs.date.default=now
 db.Songs.date.readable=False
 db.Songs.date.writable=False
 i hav created the above table which doesn't shows any error until i
 put a data in db.Songs.After inserting the data,if i go to database
 administration n open db.Songs,it shows:
 Error traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.

 Traceback (most recent call last):
   File /home/karan/Desktop/web2py/gluon/restricted.py, line 186, in
 restricted
     exec ccode in environment
   File /home/karan/Desktop/web2py/applications/Music_Library/views/
 appadmin.html, line 160, in module
     strong{{=%02d % ram['oldest'][0]}}/strong hours
   File /home/karan/Desktop/web2py/gluon/sqlhtml.py, line 1175, in
 __init__
     r = field.represent(r)
   File /home/karan/Desktop/web2py/gluon/sql.py, line 498, in
 lambda
     field.represent = lambda id, r=referenced, f=ff: f(r,id)
   File /home/karan/Desktop/web2py/gluon/sql.py, line 472, in ff
     return r._format(row)
 TypeError: 'NoneType' object is not callable

 Error snapshot
 Detailed traceback description

     * Exception: type 'exceptions.TypeError'('NoneType' object is
 not callable)
       Exception instance attributes
           o __setattr__: method-wrapper '__setattr__' of
 exceptions.TypeError object
           o __reduce_ex__: built-in method __reduce_ex__ of
 exceptions.TypeError object
           o __getslice__: method-wrapper '__getslice__' of
 exceptions.TypeError object
           o __getitem__: method-wrapper '__getitem__' of
 exceptions.TypeError object
           o __setstate__: built-in method __setstate__ of
 exceptions.TypeError object
           o __getattribute__: method-wrapper '__getattribute__' of
 exceptions.TypeError object
           o __str__: method-wrapper '__str__' of exceptions.TypeError
 object
           o args: ('NoneType' object is not callable,)
           o __reduce__: built-in method __reduce__ of
 exceptions.TypeError object
           o __format__: built-in method __format__ of
 exceptions.TypeError object
           o __class__: type 'exceptions.TypeError'
           o __dict__: {}
           o __delattr__: method-wrapper '__delattr__' of
 exceptions.TypeError object
           o __subclasshook__: built-in method __subclasshook__ of
 type object
           o __repr__: method-wrapper '__repr__' of
 exceptions.TypeError object
           o __init__: method-wrapper '__init__' of
 exceptions.TypeError object
           o __hash__: method-wrapper '__hash__' of
 exceptions.TypeError object
           o __sizeof__: built-in method __sizeof__ of
 exceptions.TypeError object
           o __doc__: 'Inappropriate argument type.'
           o __unicode__: built-in method __unicode__ of
 exceptions.TypeError object
           o __new__: built-in method __new__ of type object
     * Python 2.6.5: /usr/bin/python

 File /home/karan/Desktop/web2py/gluon/restricted.py in restricted at
 line 186
 [ code | arguments | variables ]
 Function argument list: (code='response.write(\'!DOCTYPE html PUBLIC
 -//W3C//D...n /div\\n /body\\n/html\\n\', escape=False)',
 environment={'A': class 'gluon.html.A', 'Auth': class
 'gluon.tools.Auth', 'B': class 'gluon.html.B', 'BEAUTIFY': class
 'gluon.html.BEAUTIFY', 'BODY': class 'gluon.html.BODY', 'BR':
 class 'gluon.html.BR', 'CENTER': class 'gluon.html.CENTER',
 'CLEANUP': class 'gluon.validators.CLEANUP', 'CODE': class
 'gluon.html.CODE', 'CRYPT': class 'gluon.validators.CRYPT', ...},
 layer='/home/karan/Desktop/web2py/applications/Music_Library/views/
 appadmin.html')

 181.
 182.
 183.
 184.
 185.
 186.

 187.
 188.
 189.
 190.

         if type(code) == types.CodeType:
             ccode = code
         else:
             ccode = compile2(code,layer)

 exec ccode in environment

     except HTTP:
         raise
     except Exception:
         # XXX