[web2py] Databese error in registration process

2019-03-12 Thread Константин Комков
After updating to web2py 2.18.3 one of users could't be registrated in 
database. Before that he had error *'ascii' codec can't decode byte 0xd0 in 
position 0: ordinal not in range(128) *too, but I apply fix by Leonel 
Câmara and changed:
if not isinstance(obj, bytes):
to
if not hasattr(obj, 'decode') or not callable(obj.decode):
Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.

Traceback (most recent call last):
  File ".\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
  File "C:\inetpub\wwwroot\applications\stud\controllers/default.py", line 
1792, in 
  File ".\gluon\globals.py", line 421, in 
self._caller = lambda f: f()
  File ".\gluon\tools.py", line 3868, in f
return action(*a, **b)
  File "C:\inetpub\wwwroot\applications\stud\controllers/default.py", line 254, 
in index

str(form.vars.f),str(form.vars.i),str(form.vars.pser),str(form.vars.pnum),str(form.vars.num),auth.user_id)#auth.user.last_name,auth.user.first_name
  File "C:\inetpub\wwwroot\gluon\packages\dal\pydal\base.py", line 772, in 
executesql
adapter.execute(query)
  File "C:\inetpub\wwwroot\gluon\packages\dal\pydal\adapters\__init__.py", line 
67, in wrap
return f(*args, **kwargs)
  File "C:\inetpub\wwwroot\gluon\packages\dal\pydal\adapters\base.py", line 
413, in execute
rv = self.cursor.execute(command, *args[1:], **kwargs)
  File "C:\Python27\lib\site-packages\fdb\fbcore.py", line 3592, in execute
self._ps._execute(parameters)
  File "C:\Python27\lib\site-packages\fdb\fbcore.py", line 3304, in _execute
"Error while executing SQL statement:")
DatabaseError: ('Error while executing SQL statement:\n- SQLCODE: -802\n- 
arithmetic exception, numeric overflow, or string truncation\n- unknown ISC 
error 335544914', -802, 335544321)

Error snapshot [image: help] 


(('Error while executing SQL 
statement:\n- SQLCODE: -802\n- arithmetic exception, numeric overflow, or 
string truncation\n- unknown ISC error 335544914', -802, 335544321))

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: Databese error in registration process

2019-03-12 Thread Константин Комков
Maybe error in that string:

db.executesql(
 "execute procedure esp_web_new_user('{0}','{1}','{2}','{3}','{4}',{5})".format(
 
str(form.vars.f),str(form.vars.i),str(form.vars.pser),str(form.vars.pnum),str(form.vars.num),auth.user_id)#auth.user.last_name,auth.user.first_name
 )

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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] broken fetch in 2.18.3?

2019-03-12 Thread Dave S
In moving my application to 2.18.3 (windows exe kit, 
stable+timestamp.2019.03.03.23.22.30), I'm getting the following exception:

 File "applications\badlist\modules\restuff.py", line 51, in restuff 
 bin=fetch(url)
 File "C:\Users\Dave\web2py_win\web2py_win.2-18-3\web2py\gluon\tools.py", 
line 4635, in fetch
 html = urlopen(req).read()
 File "urllib.py", line 87, in urlopen
 File "urllib.py", line 185, in open
 File "urllib.py", line 1066, in unwrap
 File "urllib2.py", line 256, in __getattr__
AttributeError: strip
(strip)

In 2.14.6, tools.py L4635 (which was L5226 back then) read as

html = urllib2.urlopen(req).read()
and in 2.18.3 this has been changed to (as shown above)|

 html = urlopen(req).read()

where urlopen is from pydal/_compat.py (in the if PY2 case)

 from urllib.request import FancyURLopener, urlopen 

I suspect something is missing that's relevant to the change.   In my line 
51, url is a string that's ultimately from a form field, and the fetch is 
for an image file (binary, hence stored in the cleverly named bin).

I'm not currently using fetch() on a linux system, and haven't install 
Python3 on Windows, so I haven't tried the PY3 environment.

/dps


(Off-topic:  the Google Groups post editor seems to be wanting to play with 
formatting my message in funny ways, including changing to "small" 
unpredictably.  I'm not sure I've overridden its choices.)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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] uwsgi not logging when web2py installed on ubuntu 18.04 with nginx with setup script

2019-03-12 Thread Toby
I set up a new DigitalOcean server (Ubuntu 18.04) and ran the install 
script setup-web2py-nginx-uwsgi-ubuntu.sh

It works OK and I can access the admin interface, but I noticed that 
uwsgi logging is not working. Even once the app is running there is no log 
file created at /var/log/uwsgi/

Any idea how I get logging to work?

Thanks!

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


[web2py] Re: Databese error in registration process

2019-03-12 Thread Leonel Câmara
In a web2py shell for your application try:

 " '{0}' ".format("foo' ")

You will get:

" 'foo' ' "

You can see how this will cause it to have unclosed ' in the strings which 
then can give you that error. How you fix this is by quoting the string 
using your DB's dialect

 " '{0}' ".format(db._adapter.dialect.quote("foo' "))

Which gets you something like:

' \'"foo\' "\' '

See the difference?  
  
This is the problem with using executesql, what you had here was an SQL 
Injection vulnerability which is fixed by using quote.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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] Update text for GRID buttons - View/Edit etc

2019-03-12 Thread Sarbjit
Hello,

I want to change the default text of the buttons visible in SQLFORM.GRID. I 
am using the following code, but it is not updating the text

grid.element(_title='View')['innerHTML']='Details'

Any idea on how this can be done?

Thanks !

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


[web2py] Re: uwsgi not logging when web2py installed on ubuntu 18.04 with nginx with setup script

2019-03-12 Thread Toby
I've narrowed down the problem.

The file /etc/init/uwsgi-emperor.conf is not being created because the 
directory /etc/init doesn't exist. 

The directory /etc/init doesn't exist because it's for Upstart 
configuration, and Ubuntu 17.10 and higher don't support upstart 

.

It looks like I need to use Systemd instead of Upstart, but I'm a linux 
noob and I don't know how.

So, how do I replace the script uwsgi-emperor.conf with a Systemd script?








On Tuesday, March 12, 2019 at 11:10:02 AM UTC, Toby wrote:
>
> I set up a new DigitalOcean server (Ubuntu 18.04) and ran the install 
> script setup-web2py-nginx-uwsgi-ubuntu.sh
>
> It works OK and I can access the admin interface, but I noticed that 
> uwsgi logging is not working. Even once the app is running there is no log 
> file created at /var/log/uwsgi/
>
> Any idea how I get logging to work?
>
> Thanks!
>
>

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


Re: [web2py] Web2py Windows edition with 3.x Interpreter

2019-03-12 Thread Jitun John
Apologies for the delay... 
I think my program has issues with new version of pydal 19.02, while it 
works fine on pydal 18.08

Thanks Nico for all the hard work.
I will test and let you know soon.


On Sunday, March 3, 2019 at 4:54:38 PM UTC+5:30, Nico Zanferrari wrote:
>
> Good morning!
>
> I'm proud to say that I've succeeded in building the Windows 64 bit binary 
> with python 3.7.2 using pyinstaller !  Grab it from 
> https://github.com/nicozanf/web2py-pyinstaller 
>
> There are some little gothas, but it seems to work fine:
> - in the console I've got many errors like 
> 'ERROR:Rocket.Errors.Thread-2:Tried to send "500 Server Error" to client 
> but received socket error'. They disappear as soon as I've disabled IPv6 
> and rebooted. There are users that report also to fix similar problems by 
> adding the hostname on the hosts file
> - psycopg2 is placed in a folder by itself, instead than in the root folder
> - in the currently official binary build (with pyhton 2.7) there are also 
> two binaries: web2py_no_console.exe and web2py_on_gevent.exe. They don't 
> run correctly, and don't seem to be so important for me so I've decided to 
> skip their generation.
> - Macintosh compatibility is needed, but I cannot work on it
>
> Please, help with testing it! I'll make a PR on the official web2py 
> repository after some feedback.
>
> Cheers,
> Nico
>
> Il giorno mer 27 feb 2019 alle ore 12:03 Nico Zanferrari <
> nico...@gmail.com > ha scritto:
>
>> Hi,
>>
>> this is a big problem also from my point of view and I've already opened 
>> issue 
>> 2027  . However it's not 
>> so easy to achieve this goal, because you've to switch to 3.x + go 64 bit + 
>> change the *freezer* program (py2exe and bbfreeze do not work with 
>> python >= 3.5). I'm playing with pyinstaller, but I'm not promising 
>> anything. And also a binary Mac version is needed (I only have a Win box), 
>> plus testing everything.
>>
>> Cheers,
>> Nico 
>>
>> Il giorno mer 27 feb 2019 alle ore 11:45 elisha bere > > ha scritto:
>>
>>> Hie, 
>>>
>>> Is it possible to change from 2.7 to 3.x in my web2py app
>>>
>>> On 17 Feb 2019 20:57, "Jitun John" > 
>>> wrote:
>>>
 "It requires Python 2.6 (no more supported), Python 2.7 (stable) or 
 Python 3.5+ (*recommended for new projects*) already installed on your 
 system. 
 There are also *binary packages for Windows* and Mac OS X.* They 
 include the Python 2.7 interpreter* so you do not need to have it 
 pre-installed."

 Sorry for my ignorance, I am assuming "Python 2.7 interpreter" as 
 "python27.dll" and "pywintypes27.dll" files.

 I recently moved my app from 2.x to 3.x using PyCharm IDE and the app 
 works fine when using IDE on 3.7 python.
 But when I try to compile it to .exe (using .iss file + hstart.exe), I 
 cant use the existing web2py_win.zip file.

 Gives me " unsupported pickle protocol: 3"

 As we are recommending new projects on 3.x, Is it possible for the next 
 version to have a 3.x interpreter ?
 or if we have a workaround, I am happy to try it.

 Thanks.

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

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

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


[web2py] Re: uwsgi not logging when web2py installed on ubuntu 18.04 with nginx with setup script

2019-03-12 Thread Toby
OK, so now I realise that the script setup-web2py-nginx-uwsgi-ubuntu.sh 

 
creates init scripts for both upstart and systemd (why? Is that to support 
multiple versions of Ubuntu?). It writes to the systemd script to 
/etc/systemd/system/emperor.uwsgi.service

So, looks like I need to edit the 
file /etc/systemd/system/emperor.uwsgi.service and change the logging 
settings in there. 

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


Re: [web2py] Re: Date Picker Widget

2019-03-12 Thread Ben Lawrence
Hi Web2py developers, 
This thread did not seem to be implemented. Massimo said he will put it 
into the next release, but should I do it with a push request?
regards
Ben

On Friday, September 9, 2011 at 6:36:02 AM UTC-7, Richard wrote:
>
> Sure... Do you want the Annet CSS or mine ?
>
> Richard
>
> On Thu, Sep 8, 2011 at 9:17 PM, Massimo Di Pierro  > wrote:
>
>> can you send me a patch (until a get one for a better calendar ;-)
>>
>> On Sep 8, 4:31 pm, Richard Vézina  wrote:
>> > Ok, putting much more then the basic z-index init of dialog works find 
>> at
>> > least...
>> >
>> > I don't see when you want a datepicker to be behind an other element?!
>> >
>> > Richard
>> >
>> > On Thu, Sep 8, 2011 at 5:27 PM, Richard Vézina
>> > wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > God... The fix seems to work only for the first trigger of the 
>> popup...
>> >
>> > > Richard
>> >
>> > > On Thu, Sep 8, 2011 at 5:25 PM, Richard Vézina <
>> > > ml.richard.vez...@gmail.com> wrote:
>> >
>> > >> It seems that you can initialise dialog with a given zIndex
>> >
>> > >> And the default zIndex that I have in the js is zIndex: 1000
>> >
>> > >> I just read the js and it seems to change between 1000 and 1001... I 
>> try
>> > >> with 1002 in the .calendar css class of "web2py datepicker" and it 
>> works
>> > >> find.
>> >
>> > >> Don't know maybe adding a note in the css file of the "web2py 
>> datepicker"
>> > >> near the z-index parameter should be done to inform user of what to 
>> do in
>> > >> case of problem...
>> >
>> > >> ;-)
>> >
>> > >> Richard
>> >
>> > >> On Thu, Sep 8, 2011 at 5:11 PM, Richard Vézina <
>> > >> ml.richard.vez...@gmail.com> wrote:
>> >
>> > >>> .calendar{
>> > >>> z-index: 1000;
>> > >>> position: relative;
>> > >>> display: none;
>> > >>> border-right: 1px solid #808080;
>> > >>> border-left: 1px solid #808080;
>> > >>> border-bottom: 1px solid #808080;
>> > >>> font-size: 11px;
>> > >>> color: #9A9A9A;
>> > >>> cursor: default;
>> > >>> background: #fafaed;
>> > >>> font-family: Arial, Helvetica,sans-serif;
>> > >>> }
>> >
>> > >>> SOLVED
>> >
>> > >>> It maybe to much should check the dialog plugin and put just one 
>> value
>> > >>> above...
>> >
>> > >>>  Richard
>> >
>> > >>> On Thu, Sep 8, 2011 at 5:07 PM, Richard Vézina <
>> > >>> ml.richard.vez...@gmail.com> wrote:
>> >
>> >  I have the same problem is you find a solution...
>> >
>> >  I will try with z-index, but I am not sure if it will work, should 
>> pick
>> >  one upper the dialog plugin use if it's the source of the problem.
>> >
>> >  Richard
>> >
>> >  On Thu, Sep 8, 2011 at 4:34 PM, Paul Gerrard <
>> >  p...@gerrardconsulting.com> wrote:
>> >
>> > > Hi,
>> >
>> > > I used this css as is (although I did change the background 
>> colour to
>> > > match my site. however... I'm using the dat picker on a field
>> > > displayed in a jquerydialog. the datepicket pops up - behind the
>> > > dialog box. I think the z-indexvalue needs bumping up (or is it
>> > > down?)
>> >
>> > > Looks good tho :O)
>> >
>> > > On Sep 7, 7:23 am, annet  wrote:
>> > > > Hi David,
>> >
>> > > > I didn't like the calendar that comes with web2py, not for its
>> > > > functionality but for its appearance. Instead of replacing it I 
>> just
>> > > > restyled it:
>> >
>> > > > .calendar {
>> > > >   cursor: default;
>> > > >   background-color: #FF;
>> > > >   color: #44;
>> > > >   font-size: 11px;
>> > > >   border: 1px solid #AA;
>> > > >   border-radius: 6px;
>> > > >   -webkit-border-radius: 6px;
>> > > >   -moz-border-radius: 6px;
>> > > >   padding: 6px;}
>> >
>> > > > .calendar table {
>> > > >   border-collapse: separate;
>> > > >   border-spacing: 2px;}
>> >
>> > > > .calendar thead {}
>> > > > .calendar thead tr, .calendar thead .headrow {
>> > > >   background-color: #4169E1;
>> > > >   color: #44;}
>> >
>> > > > .calendar thead .daynames {}
>> > > > .calendar .button, .calendar thead .title {
>> > > >   color: #FF;
>> > > >   font-size: 12px;
>> > > >   text-align: center;
>> > > >   padding: 3px;}
>> >
>> > > > .calendar thead tr .hilite, .calendar thead tr .active, 
>> .calendar
>> > > > thead .headrow .hilite, .calendar thead .headrow .active {
>> > > >   background-color: #FF;
>> > > >   color: #4169E1;
>> > > >   padding: 3px;}
>> >
>> > > > .calendar thead .daynames .hilite, .calendar thead .daynames 
>> .active
>> > > {
>> > > >   background-color: #FF;
>> > > >   color: #44;}
>> >
>> > > > .calendar thead .name {
>> > > >   background-color: #FF;
>> > > >   text-align: center;
>> > > >   padding: 3px;}
>> >
>> > > > .calendar tbody {}
>> > > > .calendar tbody td {
>> > > >   text-align: right;
>> > > >   border: 1px solid #

Re: [web2py] Web2py Windows edition with 3.x Interpreter

2019-03-12 Thread Kevin Keller
Whats the problem with pydal John?

On Tue, Mar 12, 2019 at 5:37 PM Jitun John  wrote:

> Apologies for the delay...
> I think my program has issues with new version of pydal 19.02, while it
> works fine on pydal 18.08
>
> Thanks Nico for all the hard work.
> I will test and let you know soon.
>
>
> On Sunday, March 3, 2019 at 4:54:38 PM UTC+5:30, Nico Zanferrari wrote:
>>
>> Good morning!
>>
>> I'm proud to say that I've succeeded in building the Windows 64 bit
>> binary with python 3.7.2 using pyinstaller !  Grab it from
>> https://github.com/nicozanf/web2py-pyinstaller
>>
>> There are some little gothas, but it seems to work fine:
>> - in the console I've got many errors like
>> 'ERROR:Rocket.Errors.Thread-2:Tried to send "500 Server Error" to client
>> but received socket error'. They disappear as soon as I've disabled IPv6
>> and rebooted. There are users that report also to fix similar problems by
>> adding the hostname on the hosts file
>> - psycopg2 is placed in a folder by itself, instead than in the root
>> folder
>> - in the currently official binary build (with pyhton 2.7) there are also
>> two binaries: web2py_no_console.exe and web2py_on_gevent.exe. They don't
>> run correctly, and don't seem to be so important for me so I've decided to
>> skip their generation.
>> - Macintosh compatibility is needed, but I cannot work on it
>>
>> Please, help with testing it! I'll make a PR on the official web2py
>> repository after some feedback.
>>
>> Cheers,
>> Nico
>>
>> Il giorno mer 27 feb 2019 alle ore 12:03 Nico Zanferrari <
>> nico...@gmail.com> ha scritto:
>>
>>> Hi,
>>>
>>> this is a big problem also from my point of view and I've already opened 
>>> issue
>>> 2027  . However it's not
>>> so easy to achieve this goal, because you've to switch to 3.x + go 64 bit +
>>> change the *freezer* program (py2exe and bbfreeze do not work with
>>> python >= 3.5). I'm playing with pyinstaller, but I'm not promising
>>> anything. And also a binary Mac version is needed (I only have a Win box),
>>> plus testing everything.
>>>
>>> Cheers,
>>> Nico
>>>
>>> Il giorno mer 27 feb 2019 alle ore 11:45 elisha bere 
>>> ha scritto:
>>>
 Hie,

 Is it possible to change from 2.7 to 3.x in my web2py app

 On 17 Feb 2019 20:57, "Jitun John"  wrote:

> "It requires Python 2.6 (no more supported), Python 2.7 (stable) or
> Python 3.5+ (*recommended for new projects*) already installed on
> your system.
> There are also *binary packages for Windows* and Mac OS X.* They
> include the Python 2.7 interpreter* so you do not need to have it
> pre-installed."
>
> Sorry for my ignorance, I am assuming "Python 2.7 interpreter" as
> "python27.dll" and "pywintypes27.dll" files.
>
> I recently moved my app from 2.x to 3.x using PyCharm IDE and the app
> works fine when using IDE on 3.7 python.
> But when I try to compile it to .exe (using .iss file + hstart.exe), I
> cant use the existing web2py_win.zip file.
>
> Gives me " unsupported pickle protocol:
> 3"
>
> As we are recommending new projects on 3.x, Is it possible for the
> next version to have a 3.x interpreter ?
> or if we have a workaround, I am happy to try it.
>
> Thanks.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

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

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

[web2py] Re: uwsgi not logging when web2py installed on ubuntu 18.04 with nginx with setup script

2019-03-12 Thread Toby
Got it working. Here's what I needed to do:

1. Add the following line to the bottom of /etc/uwsgi/web2py.ini
*logto = /var/log/uwsgi/uwsgi.log*

2. Comment out this line (by putting a # in front):
*StandardError = syslog*
in the file /etc/systemd/system/emperor.uwsgi.service
The best way to edit the file 

 
is to run 
*sudo systemctl edit --full emperor.uwsgi.service*

3. Reload systemd 

 to 
pick up the changes:
*sudo systemctl daemon-reload*

Or, use the script attached where I've made the changes. 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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.
#!/bin/bash
echo 'setup-web2py-nginx-uwsgi-ubuntu-precise.sh'
echo 'Requires Ubuntu > 12.04 or Debian >= 8 and installs Nginx + uWSGI + Web2py'
# Check if user has root privileges
if [[ $EUID -ne 0 ]]; then
   echo "You must run the script as root or using sudo"
   exit 1
fi
# parse command line arguments
nopassword=0
nocertificate=0
while [ "$#" -gt 0 ]; do
  case "$1" in
--no-password) nopassword=1; shift 1;;
--no-certificate) nocertificate=1; shift 1;;
  esac
done
# Get Web2py Admin Password
if [ "$nopassword" -eq 0 ]
then
  echo -e "Web2py Admin Password: \c "
  read -s PW
  printf "\n"  # fix no new line artifact of "read -s" to avoid cleartext password
fi
# Upgrade and install needed software
apt-get update
apt-get -y upgrade
apt-get autoremove
apt-get autoclean
apt-get -y install nginx-full
apt-get -y install build-essential python-dev libxml2-dev python-pip unzip
pip install setuptools --no-use-wheel --upgrade
PIPPATH=`which pip`
$PIPPATH install --upgrade uwsgi
# Create common nginx sections
mkdir /etc/nginx/conf.d/web2py
echo '
gzip_static on;
gzip_http_version   1.1;
gzip_proxiedexpired no-cache no-store private auth;
gzip_disable"MSIE [1-6]\.";
gzip_vary   on;
' > /etc/nginx/conf.d/web2py/gzip_static.conf
echo '
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
' > /etc/nginx/conf.d/web2py/gzip.conf
# Create configuration file /etc/nginx/sites-available/web2py
echo 'server {
listen  80;
server_name $hostname;
###to enable correct use of response.static_version
location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
alias /home/www-data/web2py/applications/$1/static/$2;
expires max;
### if you want to use pre-gzipped static files (recommended)
### check scripts/zip_static_files.py and remove the comments
# include /etc/nginx/conf.d/web2py/gzip_static.conf;
}
###

###if you use something like myapp = dict(languages=['en', 'it', 'jp'], default_language='en') in your routes.py
#location ~* ^/(\w+)/(en|it|jp)/static/(.*)$ {
#alias /home/www-data/web2py/applications/$1/;
#try_files static/$2/$3 static/$3 =404;
#}
###

location / {
#uwsgi_pass  127.0.0.1:9001;
uwsgi_pass  unix:///tmp/web2py.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;

###remove the comments to turn on if you want gzip compression of your pages
# include /etc/nginx/conf.d/web2py/gzip.conf;
### end gzip section

### remove the comments if you use uploads (max 10 MB)
#client_max_body_size 10m;
###
}
}
server {
listen 443 default_server ssl;
server_name $hostname;
ssl_certificate /etc/nginx/ssl/web2py.crt;
ssl_certificate_key /etc/nginx/ssl/web2py.key;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_ciphers ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
keepalive_timeout70;
location / {
#uwsgi_pass  127.0.0.1:9001;
uwsgi_pass  unix:///tmp/web2py.socket;
include uwsgi_params;
uwsgi_param U

[web2py] Re: Update text for GRID buttons - View/Edit etc

2019-03-12 Thread Marcelo Huerta
El martes, 12 de marzo de 2019, 11:55:58 (UTC-3), Sarbjit escribió:
>
> Hello,
>
> I want to change the default text of the buttons visible in SQLFORM.GRID. 
> I am using the following code, but it is not updating the text
>
> grid.element(_title='View')['innerHTML']='Details'
>
> Any idea on how this can be done?
>

Isn't maybe easier to edit the button name in the languages/xx.py file 
corresponding to the language of your application? 

>  
>

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


[web2py] Re: Databese error in registration process

2019-03-12 Thread Marcelo Huerta

El martes, 12 de marzo de 2019, 4:13:31 (UTC-3), Константин Комков escribió:
>
> Maybe something do not work in that string, but before it work without 
> errors and now I have problem with only one user and I see that 20 users 
> was be registrated without errors after him also?
>
> db.executesql(
>  "execute procedure 
> esp_web_new_user('{0}','{1}','{2}','{3}','{4}',{5})".format(
>  
> str(form.vars.f),str(form.vars.i),str(form.vars.pser),str(form.vars.pnum),str(form.vars.num),auth.user_id)#auth.user.last_name,auth.user.first_name
>  )
>
>
Please visit http://bobby-tables.com/ 

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


[web2py] Is it possible to sort the grid search fields list?

2019-03-12 Thread João Matos
Hello,

Is it possible to sort the grid search fields list?

And limit the fields list to the only ones shown in the grid itself?

Thanks,

JM

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: Is it possible to sort the grid search fields list?

2019-03-12 Thread 黄祥
is the sqlform.grid(sortable=True) doesnt meet your requirement ?
ref:
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid-signature

best regards,
stifan

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


[web2py] Admin app - File management errors

2019-03-12 Thread guiromero85
Hi, I was trying latest 2.18.3 release, and I think I have found a possible 
bug.

Running Rocket under Python 3.6.0 (Ubuntu) *I can't delete nor upload files*, 
for example, into /static/images folder. I receive a flash message 
indicating that was not possible to upload or delete a desired file.
If I run 2.18.3 under Python 2.7, it works well and I have no problems with 
file management, so I guess it could be a Python3 related issue.
I have checked folder permissions, tried under Ubuntu and Windows, and 
still fails.

However, I am able to edit and save files using the internal editor, that 
is, I don't receive communication error or permission denied when trying to 
write the file.

I may be wrong, so I appreciate any help to fix this, if this is not a 
web2py bug.

Thanks in advance,
Guillermo.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: Error: Exporting CSV file in SQLFORM.grid

2019-03-12 Thread gilad
Could you share your solution?

On Wednesday, January 14, 2015 at 7:31:56 PM UTC+2, Prasad Muley wrote:
>
> Hello All,
>
>I've used a SQLFORM.grid for displaying table content. I've 
> provided export to CSV option in grid.
>
> My app settings are as below:
>
> *models/db.py*
>
> db.define_table('company',
> Field('name', 'string', length=128, notnull=True, 
> unique=True),
> Field('address', 'string'), format='%(name)s')
>
>
> db.define_table('document',
>   Field('name', 'string', length=128, 
> notnull=True),
>   Field('type', 'string', notnull=True),
>   Field('company', db.company, format='%(name)s') 
>   
>
> Here, 
> document table has company as a reference key,
> *Exported CSV should contain the company names not ids*
>
> So I've defined a class *CSVExporter* according to anthony 
>   solution for 
> web2pygrid-csv-exports-shows-ids-not-values-for-reference-fields 
> 
>
> *modules/doc_utils.py*
> from cStringIO import StringIO
>
>
> class CSVExporter(object):
> """This class is used when grid's table contains reference key id.
>Exported CSV should contain reference key name of reference 
>key not ids"""
> file_ext = "csv"
> content_type = "text/csv"
>
> def __init__(self, rows):
> self.rows = rows
>
> def export(self):
> if self.rows:
> s = StringIO()
> self.rows.export_to_csv_file(s, represent=True)
> return s.getvalue()
> else:
> return ''
>
> *#Grid uses Custom search for string*
>
>
> def search_query(fields, keywords):
>  Custom search for doc grid"""
> if isinstance(keywords, (tuple, list)):
> keywords = keywords[0]
> request.vars.keywords = keywords
> key = keywords.strip()
> if key and not '"' in key and not "'" in key and key:
> SEARCHABLE_TYPES = ('string', 'text', 'list:string')
> words = key.split(' ') if key else []
> filters = []
> for field in fields:
> #apply search on company_name also
> if field.name == "portfolio_company":
> #get db from current module
> db = current.db
> #get company name from record
> company_ids = [company.id for company in db(
> db.company.name.contains(words)).select(db.company.id
> )]
> if company_ids:
> filters.append(field.belongs(company_ids))
> continue
> if field.type in SEARCHABLE_TYPES:
> all_words_filters = []
> for word in words:
> all_words_filters.append(field.contains(word))
> filters.append(reduce(lambda a, b: (a & b), 
> all_words_filters))
> parts = filters
> else:
> parts = None
> if parts:
> return reduce(lambda a, b: a | b, parts)
> else:
> return None
>
> *controllers/documents.py*
> from applications.asdf.doc_utils import CSVExporter, search_query
>
>
> def docs():
> export_csv = False
> export_classes = None
> query = valid_db_query_here
> if auth.has_membership('manager'): 
>  export_csv = True
>  export_classes = dict(csv=(CSVExporter, 'CSV'), 
> xml=False, html=False,
> json=False, 
> csv_with_hidden_cols=False,
> tsv=False, 
> tsv_with_hidden_cols=False)
>
> grid = SQLFORM.grid(query, orderby=~db.document.created_on,
>  showbuttontext=False, 
> csv=export_csv, deletable=False,
>  searchable=search_query, 
> exportclasses=export_classes)
>
> 
>return (grid=grid)
>
> If I search single keyword like Google or MicroSoft in then export works 
> as expected.
>
> if I search multiple keywords like Google India Private Limited or Redhat 
> India Pvt Ltd then it shows expected rows in grid
>
> But If I click on export button then it gives me *Following error*
>
>
> *Ticket ID*
> *127.0.0.1.2015-01-14.21-56-57.34fb2b60-2857-4c1a-9626-a854630fc9c7*
>
> * 'list' object has no attribute 
> 'colnames'*
>
> *Version*
> *web2py™ Version 2.9.5-stable+timestamp.2014.03.16.02.35.39*
> *Traceback*
> *1.*
> *2.*
> *3.*
> *4.*
> *5.*
> *6.*
> *7.*
> *8.*
> *9.*
> *10.*
> *11.*
> *12.*
> *13.*
> *14.*
> *15.*
> *16.*
> *Traceback (most recent call last):*
> *  File "/home/prasad/Rootpy/web2py_2.9/gluon/restricted.py", line 220, in 
> restricted*
> *exec ccode in environment*
> *  File 
> "/home/prasad/Rootpy/web2py_2.9/applications/asdf/cont

[web2py] Re: Mysql 8.0.15

2019-03-12 Thread learthurjoly
Hello !
I have exactly the same problem. Have you found a solution to this problem?
My version: 2.18.3-stable+timestamp.2019.03.03.23.22.30 (Running on 
Apache/2.4.25 (Debian 9 stretch), Python 2.7.13)



Le jeudi 14 février 2019 20:09:22 UTC+1, Andrea Fae' a écrit :
>
> Hello, I'm sorry but I'm not able to use web2py with this type of db.
>
> I just installed mysql version 8.0.15 on windows 10 pro and I have 
> connector for Python 3.7 and 2.7 installed 
> I created using mysql.exe a db named 'gadb', without any tables.
>
> with web2py I created a new "welcome" application changing db.py in this 
> way (not using appconfig.ini)
>
> i changed only this:
> db = DAL('mysql://root:rootpassword@localhost/gadb',pool_size=20)
> 
> commenting this
> """db = DAL(configuration.get('db.uri'),
>  pool_size=configuration.get('db.pool_size'),
>  migrate_enabled=configuration.get('db.migrate'),
>  check_reserved=['all'])"""
>
> but when I try to start the application I have this error:
>
> Error ticket for "testmysql"Ticket ID
>
> 127.0.0.1.2019-02-14.20-04-44.4a997a45-2232-4144-ab7e-6005309040bb
>  Failure to connect, tried 5 times: 
> Traceback (most recent call last): File 
> "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__ 
> self._adapter = adapter(**kwargs) File 
> "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in 
> __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File 
> "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in 
> __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File 
> "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in __init__ 
> self.reconnect() File "C:\web2py\gluon\packages\dal\pydal\connection.py", 
> line 172, in reconnect self.connection = self.connector() File 
> "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in 
> connector return self.driver.connect(**self.driver_args) File 
> "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect return 
> Connection(*args, **kwargs) File 
> "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__ 
> self.connect() File "C:\web2py\gluon\contrib\pymysql\connections.py", line 
> 905, in connect self._get_server_information() File 
> "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in 
> _get_server_information self.server_charset = charset_by_id(lang).name File 
> "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id return 
> self._by_id[id] KeyError: 255Versione
> web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
> 26.
> 27.
> 28.
> 29.
> 30.
> 31.
> 32.
> 33.
> 34.
> 35.
> 36.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "C:/web2py/applications/testmysql/models/db.py" 
> , line 33, 
> in 
> db = DAL('mysql://root:AeDeFsubfi3!@localhost/gadb',pool_size=20)
>   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 169, in __call__
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 474, in __init__
> "Failure to connect, tried %d times:\n%s" % (attempts, tb)
> RuntimeError: Failure to connect, tried 5 times:
> Traceback (most recent call last):
>   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
> self._adapter = adapter(**kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in 
> __call__
> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in 
> __init__
> super(SQLAdapter, self).__init__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in 
> __init__
> self.reconnect()
>   File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in 
> reconnect
> self.connection = self.connector()
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in 
> connector
> return self.driver.connect(**self.driver_args)
>   File "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect
> return Connection(*args, **kwargs)
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
> self.connect()
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 905, in connect
> self._get_server_information()
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in 
> _get_server_information
> self.server_charset = charset_by_id(lang).name
>   File "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id
> return self._by_id[id]
> KeyError: 255
>
> In file: C:\web2py\applications\tes

[web2py] Mysql-Web2py connection failure

2019-03-12 Thread learthurjoly
Hello everyone,
I have a problem when I try to connect web2py to a mysql database.
I'm using a Debian 9 strech, Web2py 2.18.3-stable + 
timestamp.2019.03.03.23.22.30 (Running on Apache / 2.4.25, Python 2.7.13) 
and mysql 8.0.15.
I don't have any problem when I use storage.sqlite.
But when I try to migrate on Mysql, I always have the same error:

Identifiant du Billet

81.23.32.9.2019-03-05.13-55-17.e8fb714e-4e1d-4e5c-8502-a36374e00a23
 Failure to connect, tried 5 times: 
Traceback (most recent call last): File 
"/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 455, in 
__init__ self._adapter = adapter(**kwargs) File 
"/home/www-data/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 
40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) 
File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 369, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) 
File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 53, in __init__ self.reconnect() File 
"/home/www-data/web2py/gluon/packages/dal/pydal/connection.py", line 172, 
in reconnect self.connection = self.connector() File 
"/home/www-data/web2py/gluon/packages/dal/pydal/adapters/mysql.py", line 
52, in connector return self.driver.connect(**self.driver_args) File 
"/home/www-data/web2py/gluon/contrib/pymysql/__init__.py", line 90, in 
Connect return Connection(*args, **kwargs) File 
"/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 688, in 
__init__ self.connect() File 
"/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 905, in 
connect self._get_server_information() File 
"/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 1231, in 
_get_server_information self.server_charset = charset_by_id(lang).name File 
"/home/www-data/web2py/gluon/contrib/pymysql/charset.py", line 38, in by_id 
return self._by_id[id] KeyError: 255Version
web2py™ Version 2.18.3-stable+timestamp.2019.03.03.23.22.30Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.

Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/www-data/web2py/applications/welcome/models/db.py" 
, line 36, in 

check_reserved=['all'])
  File "/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 170, in 
__call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 475, in 
__init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 455, in 
__init__
self._adapter = adapter(**kwargs)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/__init__.py", 
line 40, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
369, in __init__
super(SQLAdapter, self).__init__(*args, **kwargs)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
53, in __init__
self.reconnect()
  File "/home/www-data/web2py/gluon/packages/dal/pydal/connection.py", line 
172, in reconnect
self.connection = self.connector()
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/mysql.py", line 
52, in connector
return self.driver.connect(**self.driver_args)
  File "/home/www-data/web2py/gluon/contrib/pymysql/__init__.py", line 90, in 
Connect
return Connection(*args, **kwargs)
  File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 688, 
in __init__
self.connect()
  File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 905, 
in connect
self._get_server_information()
  File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", line 1231, 
in _get_server_information
self.server_charset = charset_by_id(lang).name
  File "/home/www-data/web2py/gluon/contrib/pymysql/charset.py", line 38, in 
by_id
return self._by_id[id]
KeyError: 255

In file: /home/www-data/web2py/applications/welcome/models/db.py

1.

 at 0x7f32fd9425b0, file 
"/home/www-data/web2py/applications/welcome/models/db.py", line 7>


I use the following syntax: 
'mysql://user:passwd@localhost/gmao?set_encoding=utf8mb4'
I also notice this error message when I try to replace storage.sqlite by 
mysql :
An error occured, please reload 
the page
I have the same error when I try to modify this in appconfig.ini.

Thank you all in advance for your help.
Arthur

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report

[web2py] web2py 2.18.4 is OUT

2019-03-12 Thread Massimo Di Pierro
includes many small fixes, thanks Leonel, Paolo, and everybody who 
contributed.

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


Re: [web2py] Re: Error: Exporting CSV file in SQLFORM.grid

2019-03-12 Thread sandeep patel
I have solved this problem. This problem is occurring because of filter
object you have to convert into the list.
You have to need some changes in the sqlhtml file.
go to gluon/sqlhtml.py change line no : 2688

>From - sfields = reduce(lambda a, b: a + b, [filter(is_searchable, t) for t
in tables])
To - sfields = reduce(lambda a, b: a + b, [list(filter(is_searchable, t))
for t in tables])

Note: Web2py version 2.17.2 and Python 3

Thanks
Sandeep


On Wed, Mar 13, 2019 at 11:02 AM  wrote:

> Could you share your solution?
>
> On Wednesday, January 14, 2015 at 7:31:56 PM UTC+2, Prasad Muley wrote:
>>
>> Hello All,
>>
>>I've used a SQLFORM.grid for displaying table content. I've
>> provided export to CSV option in grid.
>>
>> My app settings are as below:
>>
>> *models/db.py*
>>
>> db.define_table('company',
>> Field('name', 'string', length=128, notnull=True,
>> unique=True),
>> Field('address', 'string'), format='%(name)s')
>>
>>
>> db.define_table('document',
>>   Field('name', 'string', length=128,
>> notnull=True),
>>   Field('type', 'string', notnull=True),
>>   Field('company', db.company, format='%(name)s')
>>
>>
>> Here,
>> document table has company as a reference key,
>> *Exported CSV should contain the company names not ids*
>>
>> So I've defined a class *CSVExporter* according to anthony
>>   solution for
>> web2pygrid-csv-exports-shows-ids-not-values-for-reference-fields
>> 
>>
>> *modules/doc_utils.py*
>> from cStringIO import StringIO
>>
>>
>> class CSVExporter(object):
>> """This class is used when grid's table contains reference key id.
>>Exported CSV should contain reference key name of reference
>>key not ids"""
>> file_ext = "csv"
>> content_type = "text/csv"
>>
>> def __init__(self, rows):
>> self.rows = rows
>>
>> def export(self):
>> if self.rows:
>> s = StringIO()
>> self.rows.export_to_csv_file(s, represent=True)
>> return s.getvalue()
>> else:
>> return ''
>>
>> *#Grid uses Custom search for string*
>>
>>
>> def search_query(fields, keywords):
>>  Custom search for doc grid"""
>> if isinstance(keywords, (tuple, list)):
>> keywords = keywords[0]
>> request.vars.keywords = keywords
>> key = keywords.strip()
>> if key and not '"' in key and not "'" in key and key:
>> SEARCHABLE_TYPES = ('string', 'text', 'list:string')
>> words = key.split(' ') if key else []
>> filters = []
>> for field in fields:
>> #apply search on company_name also
>> if field.name == "portfolio_company":
>> #get db from current module
>> db = current.db
>> #get company name from record
>> company_ids = [company.id for company in db(
>> db.company.name.contains(words)).select(db.company.id
>> )]
>> if company_ids:
>> filters.append(field.belongs(company_ids))
>> continue
>> if field.type in SEARCHABLE_TYPES:
>> all_words_filters = []
>> for word in words:
>> all_words_filters.append(field.contains(word))
>> filters.append(reduce(lambda a, b: (a & b),
>> all_words_filters))
>> parts = filters
>> else:
>> parts = None
>> if parts:
>> return reduce(lambda a, b: a | b, parts)
>> else:
>> return None
>>
>> *controllers/documents.py*
>> from applications.asdf.doc_utils import CSVExporter, search_query
>>
>>
>> def docs():
>> export_csv = False
>> export_classes = None
>> query = valid_db_query_here
>> if auth.has_membership('manager'):
>>  export_csv = True
>>  export_classes = dict(csv=(CSVExporter, 'CSV'),
>> xml=False, html=False,
>> json=False,
>> csv_with_hidden_cols=False,
>> tsv=False,
>> tsv_with_hidden_cols=False)
>>
>> grid = SQLFORM.grid(query, orderby=~db.document.created_on,
>>  showbuttontext=False,
>> csv=export_csv, deletable=False,
>>  searchable=search_query,
>> exportclasses=export_classes)
>>
>>
>>return (grid=grid)
>>
>> If I search single keyword like Google or MicroSoft in then export works
>> as expected.
>>
>> if I search multiple keywords like Google India Private Limited or Redhat
>> India Pvt Ltd then it shows expected rows in grid
>>
>> But If I click on export button then it gives me *Following error*

[web2py] Re: web2py 2.18.4 is OUT

2019-03-12 Thread Константин Комков
Thank you! But http://web2py.com/book don't work.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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.