mapstory.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:django-gazetteer 作者: rob-metalinkage 项目源码 文件源码
def getfeatures(self,sourcebinding):
        """
            Yields a feature iterator. Each feature is a dict
            Throws exceptions
            May want to switch to server-side cursor.
        """
        cur = self.conn.cursor(cursor_factory = psycopg2.extras.RealDictCursor) 
        SQL = "select * from %s "  
        if sourcebinding.filter or sourcebinding.config.filter :
            print "Need to apply filter!"
            # filterclause = 'WHERE '

            # process clauses in an injection-safe way and append to SQL 
        try :
            cur.execute(SQL, (AsIs(sourcebinding.source), ))
        except Exception as e:
            # import pdb; pdb.set_trace() 
            raise e
        for r in cur :
            yield r
                # break
            # refactor if necessary to force connection close on failure
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号