[web2py] Re: Bootstrap tooltips require tether

2019-02-07 Thread Константин Комков
Its error coming only when I start ajax request and return also full page 
with web2py welcome.

> jQuery.ajax({
> type: "POST",
> url: "getRequest",
> data: 'data='+JSON.stringify(data),
> cache: false,
> success: function(data) {
> console.log(data);
> $('#results').html(data);
> },
> error: function(data){
> console.log("error");
> console.log(data);
> }
> });

controller

> def getRequest():
> import json
> a = json.loads(request.vars.data)
> try:
> 
> db.a_requests.insert(id_item=a['item'].encode('utf-8'),id_type=a['requestType'].encode('utf-8'),item_name=a['itemName'].encode('utf-8'),request=a['requestText'].encode('utf-8'),id_applicant=a['applicant'].encode('utf-8'),email=a['email'].encode('utf-8').strip(),phone=a['phone'].encode('utf-8'))
> b = True
> except Exception:
> b = False
> if b:
> return XML('Ваше обращение принято')
> else:
> return XML('Во время отправки обращения произошла ошибка') 

[image: 1.png]
 

-- 
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: problem with cpdb.py "EXCEPTION: could not set DAL"

2019-02-07 Thread Jon Subscripted
Hi everyone,
Eventually I managed to move on, without cpdb.py.

I had to do it as Massimo suggests in this thread "Best way to migrate from
sqlite to postgresql (or other db)":

https://groups.google.com/forum/#!topic/web2py/mQk2hoRf7gw

Eventhough, auth tables game me a lot of issues and had to tweak the
processs a little. I followed the steps below:

1) Launched my old app from command line:
>>> python web2py.py -S old_sqlite_based_app -M -P
2) Export the db to a single .csv file:
>>> db.export_to_csv_file(open('backup.csv','wb'))
3) Create new empty app with SQLite
4) Create empty db (schema only, no tables) in mysql
5) Change db uri to mysql empty db
6) Launch app from command line to get models built (mainly auth tables):
>>> python web2py.py -S new_empty_app -M -P
7) Stop it and check auth tables were built in mysql correctly
8) Clone my old app code with Mercurial in the new app folder
9) Launch app from command line to get models built (all remaining tables,
except auth which were already built)
10) Stop it and check all remaining tables were built in mysql correctly
11) Launch app from command line and load .csv file data
>>> db.import_from_csv_file(open('backup.csv','rb'))

I do not really know why, but some of the tables did not make it into the
new db.

I'm pretty happy with the result anyway.
Regards, Jon.

PS. When I was doing the process as orginally suggested by Massimo and
Michael Beller (without steps 3,5,6 and 6) I got the error below. Which I
do not understand, but led me to create the empty db to get some fresh auth
tables.
I just wonder if there's some kind of problem in my original tables...

C:\Users\Jon\Downloads\web2py_src\web2py>python web2py.py -S old_app -M -P
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2019
Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Database drivers available: sqlite3, imaplib, pyodbc, pymysql
Traceback (most recent call last):
  File "C:\Users\Jon\Downloads\web2py_src\web2py\gluon\restricted.py", line
219, in restricted
exec(ccode, environment)
  File "applications\old_app\models\menu.py", line 19, in 
if auth.has_membership('managers'):
  File "C:\Users\Jon\Downloads\web2py_src\web2py\gluon\authapi.py", line
592, in has_membership
group_id = self.id_group(group_id)  # interpret group_id as a role
  File "C:\Users\Jon\Downloads\web2py_src\web2py\gluon\authapi.py", line
454, in id_group
rows = self.db(self.table_group().role == role).select()
  File "C:\Python27\lib\site-packages\pydal\objects.py", line 2250, in
select
return adapter.select(self.query, fields, attributes)
  File "C:\Python27\lib\site-packages\pydal\adapters\base.py", line 762, in
select
return self._select_aux(sql, fields, attributes, colnames)
  File "C:\Python27\lib\site-packages\pydal\adapters\base.py", line 718, in
_select_aux
rows = self._select_aux_execute(sql)
  File "C:\Python27\lib\site-packages\pydal\adapters\base.py", line 712, in
_select_aux_execute
self.execute(sql)
  File "C:\Python27\lib\site-packages\pydal\adapters\__init__.py", line 67,
in wrap
return f(*args, **kwargs)
  File "C:\Python27\lib\site-packages\pydal\adapters\base.py", line 412, in
execute
rv = self.cursor.execute(command, *args[1:], **kwargs)
  File "C:\Python27\lib\site-packages\pymysql\cursors.py", line 170, in
execute
result = self._query(query)
  File "C:\Python27\lib\site-packages\pymysql\cursors.py", line 328, in
_query
conn.query(q)
  File "C:\Python27\lib\site-packages\pymysql\connections.py", line 517, in
query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "C:\Python27\lib\site-packages\pymysql\connections.py", line 732, in
_read_query_result
result.read()
  File "C:\Python27\lib\site-packages\pymysql\connections.py", line 1075,
in read
first_packet = self.connection._read_packet()
  File "C:\Python27\lib\site-packages\pymysql\connections.py", line 684, in
_read_packet
packet.check_error()
  File "C:\Python27\lib\site-packages\pymysql\protocol.py", line 220, in
check_error
err.raise_mysql_exception(self._data)
  File "C:\Python27\lib\site-packages\pymysql\err.py", line 109, in
raise_mysql_exception
raise errorclass(errno, errval)
ProgrammingError: (1146, u"Table 'test2.auth_group' doesn't exist")


Libre
de virus. www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Feb 5, 2019 at 10:38 AM Jon Subscripted 
wrote:

> Hi everyone,
> I took a look at cpdb.py code and saw that "-d" option is just used to
> find where "dal.py" and add the folder sys.path.
>
> So, instead of the relative path, I decided to use the absolute path. I do
> not get the "could not set DAL" exception anymore, but now I get the
> following error:
>
> "Field auth_cas.id is already

Re: [web2py] Re: problem with cpdb.py "EXCEPTION: could not set DAL"

2019-02-07 Thread Jon Subscripted
Hi eveyone,
Just one clarification.

When I said "I do not really know why, but some of the tables did not make
it into the new db." in my previous email, I meant that some table data (as
a whole) did not make it into the new db.

This meaning the table is there but none of the original data (not a
record) is in the db. Even if the data was correctly export to the .csv
file. Surprinsingly when a new record is inserted in any of the tables
presenting this problem, the id will start as if previous data had been
correctly loaded (e.g. if N record were in the original SQLite table, the
new will get N+1 id).

Regards, Jon.


Libre
de virus. www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Thu, Feb 7, 2019 at 1:05 PM Jon Subscripted 
wrote:

> Hi everyone,
> Eventually I managed to move on, without cpdb.py.
>
> I had to do it as Massimo suggests in this thread "Best way to migrate
> from sqlite to postgresql (or other db)":
>
> https://groups.google.com/forum/#!topic/web2py/mQk2hoRf7gw
>
> Eventhough, auth tables game me a lot of issues and had to tweak the
> processs a little. I followed the steps below:
>
> 1) Launched my old app from command line:
> >>> python web2py.py -S old_sqlite_based_app -M -P
> 2) Export the db to a single .csv file:
> >>> db.export_to_csv_file(open('backup.csv','wb'))
> 3) Create new empty app with SQLite
> 4) Create empty db (schema only, no tables) in mysql
> 5) Change db uri to mysql empty db
> 6) Launch app from command line to get models built (mainly auth tables):
> >>> python web2py.py -S new_empty_app -M -P
> 7) Stop it and check auth tables were built in mysql correctly
> 8) Clone my old app code with Mercurial in the new app folder
> 9) Launch app from command line to get models built (all remaining tables,
> except auth which were already built)
> 10) Stop it and check all remaining tables were built in mysql correctly
> 11) Launch app from command line and load .csv file data
> >>> db.import_from_csv_file(open('backup.csv','rb'))
>
> I do not really know why, but some of the tables did not make it into the
> new db.
>
> I'm pretty happy with the result anyway.
> Regards, Jon.
>
> PS. When I was doing the process as orginally suggested by Massimo and
> Michael Beller (without steps 3,5,6 and 6) I got the error below. Which I
> do not understand, but led me to create the empty db to get some fresh auth
> tables.
> I just wonder if there's some kind of problem in my original tables...
>
> C:\Users\Jon\Downloads\web2py_src\web2py>python web2py.py -S old_app -M -P
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2019
> Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
> Database drivers available: sqlite3, imaplib, pyodbc, pymysql
> Traceback (most recent call last):
>   File "C:\Users\Jon\Downloads\web2py_src\web2py\gluon\restricted.py",
> line 219, in restricted
> exec(ccode, environment)
>   File "applications\old_app\models\menu.py", line 19, in 
> if auth.has_membership('managers'):
>   File "C:\Users\Jon\Downloads\web2py_src\web2py\gluon\authapi.py", line
> 592, in has_membership
> group_id = self.id_group(group_id)  # interpret group_id as a role
>   File "C:\Users\Jon\Downloads\web2py_src\web2py\gluon\authapi.py", line
> 454, in id_group
> rows = self.db(self.table_group().role == role).select()
>   File "C:\Python27\lib\site-packages\pydal\objects.py", line 2250, in
> select
> return adapter.select(self.query, fields, attributes)
>   File "C:\Python27\lib\site-packages\pydal\adapters\base.py", line 762,
> in select
> return self._select_aux(sql, fields, attributes, colnames)
>   File "C:\Python27\lib\site-packages\pydal\adapters\base.py", line 718,
> in _select_aux
> rows = self._select_aux_execute(sql)
>   File "C:\Python27\lib\site-packages\pydal\adapters\base.py", line 712,
> in _select_aux_execute
> self.execute(sql)
>   File "C:\Python27\lib\site-packages\pydal\adapters\__init__.py", line
> 67, in wrap
> return f(*args, **kwargs)
>   File "C:\Python27\lib\site-packages\pydal\adapters\base.py", line 412,
> in execute
> rv = self.cursor.execute(command, *args[1:], **kwargs)
>   File "C:\Python27\lib\site-packages\pymysql\cursors.py", line 170, in
> execute
> result = self._query(query)
>   File "C:\Python27\lib\site-packages\pymysql\cursors.py", line 328, in
> _query
> conn.query(q)
>   File "C:\Python27\lib\site-packages\pymysql\connections.py", line 517,
> in query
> self._affected_rows = self._read_query_result(unbuffered=unbuffered)
>   File "C:\Python27\lib\site-packages\pymysql\connections.py", line 732,
> in _read_query_result
> result.read()
>   File "C:\Python27\lib\site-packages\pymysql\connections.py", line 1075,
> in read
> first_packet = self.conne

[web2py] Re: Bootstrap tooltips require tether

2019-02-07 Thread Константин Комков
Also I see in admin panel that controller default.py opens only index in my 
old applications, but now default.py opens getRequest, index. In old app 
default.py contained not only one function but opened only index.

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