source: OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/gluon/dal.py @ 42095c5

mainqndtest v1.1.1
Last change on this file since 42095c5 was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100755
File size: 1.3 KB
Line 
1# -*- coding: utf-8 -*-
2
3"""
4| This file is part of the web2py Web Framework
5| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
6| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
7
8Takes care of adapting pyDAL to web2py's needs
9-----------------------------------------------
10"""
11
12from pydal import DAL
13from pydal import Field
14from pydal.objects import Row, Rows, Table, Query, Set, Expression
15from pydal import SQLCustomType, geoPoint, geoLine, geoPolygon
16from pydal.migrator import Migrator, InDBMigrator
17from gluon.serializers import custom_json, xml
18from gluon.utils import web2py_uuid
19from gluon import sqlhtml
20from pydal.drivers import DRIVERS
21
22
23DAL.serializers = {'json': custom_json, 'xml': xml}
24DAL.uuid = lambda x: web2py_uuid()
25DAL.representers = {
26    'rows_render': sqlhtml.represent,
27    'rows_xml': sqlhtml.SQLTABLE
28}
29DAL.Field = Field
30DAL.Table = Table
31
32# add web2py contrib drivers to pyDAL
33if not DRIVERS.get('pymysql'):
34    try:
35        from .contrib import pymysql
36        DRIVERS['pymysql'] = pymysql
37    except:
38        pass
39if not DRIVERS.get('pyodbc'):
40    try:
41        from .contrib import pypyodbc as pyodbc
42        DRIVERS['pyodbc'] = pyodbc
43    except:
44        pass
45if not DRIVERS.get('pg8000'):
46    try:
47        from .contrib import pg8000
48        DRIVERS['pg8000'] = pg8000
49    except:
50        pass
Note: See TracBrowser for help on using the repository browser.