customisation in dal.py - what is the best way

148 views
Skip to first unread message

Vineet

unread,
Aug 4, 2011, 9:49:26 AM8/4/11
to web2py-users
I want to do some customisation in dal.py.
Want to use MySQLdb instead of PyMySQL.
Reason behind it:-- I am going to use a 3rd party lib known as
'bizobj', which uses MySQLdb.
I can change the code to --
-----
import MySQLdb
drivers.append('MySQL')
etc.
---

Pl. tell me whether the below-mentioned procedure will be correct :

1) download the source
2) change the dal.py
3) compile it to .pyc file
4) overwrite the existing dal.pyc with the modified file

Also pl. indicate whether it may break any login in web2py.

Thanks.

Massimo Di Pierro

unread,
Aug 4, 2011, 1:57:10 PM8/4/11
to web2py-users
You should just do before db=DAL(...) in your models:

import MySQLdb
from gluon.dal import MySQLAdapter
MySQLAdapter.driver = MySQLdb

Richard Vézina

unread,
Aug 4, 2011, 6:04:38 PM8/4/11
to web...@googlegroups.com
Vineet if you still have your issue with ajaxsource with Datatables you should read this Thread :


I would appreciate if you get Datatables to work with JSON, if you report here... I am waiting for a solution since a lot of time, but I didn't have time to work on this issue...

Cheer

Richard
Message has been deleted

Vineet

unread,
Aug 5, 2011, 1:23:06 AM8/5/11
to web2py-users
@Massimo,
If I get you right, the MySQLdb module is still there in web2py;
and it is not replaced totally with pymysql;
As such, we can choose from these 2 modules.
Other statements would not break because pymysql is a drop-in
replacement for MySQLdb.
Is my understanding correct?

@Richard,
I will again work on datatable with json this weekend & post the
feedback here.

Thanks.
Vineet

On Aug 5, 3:04 am, Richard Vézina <ml.richard.vez...@gmail.com> wrote:
> Vineet if you still have your issue with ajaxsource with Datatables you
> should read this Thread :
>
> http://groups.google.com/group/web2py/browse_frm/thread/a3cfb94dbbfe6...
>
> I would appreciate if you get Datatables to work with JSON, if you report
> here... I am waiting for a solution since a lot of time, but I didn't have
> time to work on this issue...
>
> Cheer
>
> <http://groups.google.com/group/web2py/browse_frm/thread/a3cfb94dbbfe6...>

Massimo Di Pierro

unread,
Aug 5, 2011, 6:37:55 AM8/5/11
to web2py-users
if I understand the question. yes.
Reply all
Reply to author
Forward
0 new messages