def save(self): dao = DaoService() crawler_parm = (self.crawler.name,self.crawler.url,self.crawler.category_id,self.crawler.author,self.crawler.interval,self.crawler.charset) id = dao.insert_t_crawler(crawler_parm) tag_parms = CommonUtils.htm_tag_to_parms(self.tagList, id) dao.insert_html_tags(tag_parms)
def query_categories(self): dao = DaoBaseService() obj = dao.query(SqlConstants.QUERY_CATEGORIES_BY_ID % 2) return CommonUtils.query_result_to_categories(obj)
def query_tcrawler_by_id(self, id): dao = DaoBaseService() obj = dao.query(SqlConstants.QUERY_TCRAWLER_BY_ID % (id)) return CommonUtils.query_result_to_t_crawler(obj[0])
def query_all_tcrawlers_category(self, id): dao = DaoBaseService() obj = dao.query(SqlConstants.QUERY_ALL_TCRAWLERS_CATEGORY % (id)) return CommonUtils.query_result_to_t_crawlers(obj)
def query_tag_by_id(self, id): dao = DaoBaseService() obj = dao.query(SqlConstants.QUERY_HTML_TAG_BY_ID % id) return CommonUtils.query_result_to_tag(obj[0])
def query_tags_by_crawler_id(self, id): dao = DaoBaseService() obj = dao.query(SqlConstants.QUERY_HTML_TAGS_BY_T_CRAWLER_ID % id) return CommonUtils.query_result_to_tags(obj)