示例#1
0
    argdata = self._argdata(REQUEST)
    argdata['sql_delimiter'] = '\0'
    argdata['sql_quote__'] = dbc.sql_quote__

    security = getSecurityManager()
    security.addContext(self)
    try:
        query = self.template(p, **argdata)
    except TypeError, msg:
        msg = str(msg)
        if 'client' in msg:
            raise NameError("'client' may not be used as an "
                            "argument name in this context")
        raise
    finally:
        security.removeContext(self)

    if src__: return query

    if self.cache_time_ > 0 and self.max_cache_ > 0:
        result = self._cached_result(DB__, query, self.max_rows_, c)
    else:
        try:
            #         if 'portal_ids' in query:
            #           LOG("DA query", INFO, "query = %s" %(query,))
            result = DB__.query(query, self.max_rows_)
        except:
            LOG("DA call raise",
                ERROR,
                "DB = %s, c = %s, query = %s" % (DB__, c, query),
                error=True)
示例#2
0
文件: DA.py 项目: ccwalkerjm/erp5
    argdata=self._argdata(REQUEST)
    argdata['sql_delimiter']='\0'
    argdata['sql_quote__']=dbc.sql_quote__

    security=getSecurityManager()
    security.addContext(self)
    try:
        query = self.template(p, **argdata)
    except TypeError, msg:
        msg = str(msg)
        if 'client' in msg:
            raise NameError("'client' may not be used as an "
                    "argument name in this context")
        raise
    finally:
        security.removeContext(self)

    if src__: return query

    if self.cache_time_ > 0 and self.max_cache_ > 0:
        result=self._cached_result(DB__, query, self.max_rows_, c)
    else:
      try:
#         if 'portal_ids' in query:
#           LOG("DA query", INFO, "query = %s" %(query,))
        result=DB__.query(query, self.max_rows_)
      except:
        LOG("DA call raise", ERROR, "DB = %s, c = %s, query = %s" %(DB__, c, query), error=sys.exc_info())
        raise

    # patch: dynamic brain configuration