示例#1
0
文件: db.py 项目: LittleForker/webpy
    def __init__(self, db_module, keywords):
        """Creates a database.
        """
        # some DB implementaions take optional paramater `driver` to use a specific driver modue
        # but it should not be passed to connect
        keywords.pop('driver', None)

        self.db_module = db_module
        self.keywords = keywords

        
        self._ctx = threadeddict()
        # flag to enable/disable printing queries
        self.printing = config.get('debug_sql', config.get('debug', False))
        self.supports_multiple_insert = False
        
        try:
            import DBUtils
            # enable pooling if DBUtils module is available.
            self.has_pooling = True
        except ImportError:
            self.has_pooling = False
            
        # Pooling can be disabled by passing pooling=False in the keywords.
        self.has_pooling = self.keywords.pop('pooling', True) and self.has_pooling
示例#2
0
文件: db.py 项目: mugongjian/webpy
    def __init__(self, db_module, keywords):
        """Creates a database.
        """
        # some DB implementaions take optional paramater `driver` to use a specific driver modue
        # but it should not be passed to connect
        keywords.pop('driver', None)

        self.db_module = db_module
        self.keywords = keywords

        self._ctx = threadeddict()
        # flag to enable/disable printing queries
        self.printing = config.get('debug_sql', config.get('debug', False))
        self.supports_multiple_insert = False

        try:
            import DBUtils
            # enable pooling if DBUtils module is available.
            self.has_pooling = True
        except ImportError:
            self.has_pooling = False

        # Pooling can be disabled by passing pooling=False in the keywords.
        self.has_pooling = self.keywords.pop('pooling',
                                             True) and self.has_pooling
示例#3
0
def get_ace_version():
    """
    Get the installed ace version.

    :return: ace version
    """
    from webapi import config
    return config.get('webapi', 'ace_version')
示例#4
0
def get_fontawesome_version():
    """
    Get the installed fontawesome version.

    :return: fontawesome version
    """
    from webapi import config
    return config.get('webapi', 'fontawesome_version')
示例#5
0
def get_jquery_version():
    """
    Get the installed jquery version.

    :return: jquery version
    """
    from webapi import config
    return config.get('webapi', 'jquery_version')
示例#6
0
def get_bootstrap_version():
    """
    Get the installed bootstrap version.

    :return: bootstrap version
    """
    from webapi import config
    return config.get('webapi', 'bootstrap_version')
示例#7
0
 def __init__(self, loc='templates/', cache=None, base=None):
     if cache is None:
         cache = not config.get('debug', False)
     self._loc = loc
     if cache:
         self._cache = {}
     else:
         self._cache = False
     
     self._base = base
示例#8
0
    def __init__(self, loc='templates/', cache=None, base=None):
        if cache is None:
            cache = not config.get('debug', False)
        self.loc = loc
        if cache:
            self.cache = {}
        else:
            self.cache = False

        self.base = base
示例#9
0
    def __init__(self, loc='templates', cache=None, base=None, **keywords):
        self._loc = loc
        self._keywords = keywords

        if not cache or config.get('debug', False):
            self._cache = None
        else:
            self._cache = {}

        if base and not hasattr(base, '__call__'):
            # make base a function, so that it can be passed to sub-renders
            self._base = lambda page: self._template(base)(page)
        else:
            self._base = base
示例#10
0
文件: template.py 项目: btbytes/webpy
 def __init__(self, loc='templates', cache=None, base=None, **keywords):
     self._loc = loc
     self._keywords = keywords
     
     if cache or config.get('debug', False):
         self._cache = {}
     else:
         self._cache = None
     
     if base and not hasattr(base, '__call__'):
         # make base a function, so that it can be passed to sub-renders
         self._base = lambda page: self._template(base)(page)
     else:
         self._base = base
示例#11
0
    def __init__(self, loc="templates", cache=None, base=None, **keywords):
        self._loc = loc
        self._keywords = keywords

        if cache is None:
            cache = not config.get("debug", False)

        if cache:
            self._cache = {}
        else:
            self._cache = None

        if base and not hasattr(base, "__call__"):
            # make base a function, so that it can be passed to sub-renders
            self._base = lambda page: self._template(base)(page)
        else:
            self._base = base
示例#12
0
 def __init__(self, db_module, keywords):
     """Creates a database.
     """
     self.db_module = db_module
     self.keywords = keywords
     
     self._ctx = threadeddict()
     # flag to enable/disable printing queries
     self.printing = config.get('debug', False)
     self.supports_multiple_insert = False
     
     try:
         import DBUtils
         # enable pooling if DBUtils module is available.
         self.has_pooling = True
     except ImportError:
         self.has_pooling = False
         
     # Pooling can be disabled by passing pooling=False in the keywords.
     self.has_pooling = self.keywords.pop('pooling', True) and self.has_pooling
示例#13
0
 def __init__(self, db_module, keywords):
     """Creates a database.
     """
     self.db_module = db_module
     self.keywords = keywords
     
     self._ctx = threadeddict()
     # flag to enable/disable printing queries
     self.printing = config.get('debug', False)
     self.supports_multiple_insert = False
     
     try:
         import DBUtils
         # enable pooling if DBUtils module is available.
         self.has_pooling = True
     except ImportError:
         self.has_pooling = False
         
     # Pooling can be disabled by passing pooling=False in the keywords.
     self.has_pooling = self.keywords.pop('pooling', True) and self.has_pooling