当前位置: 首页>>代码示例>>Python>>正文


Python debug.Debug类代码示例

本文整理汇总了Python中base_app.classes.debug.Debug的典型用法代码示例。如果您正苦于以下问题:Python Debug类的具体用法?Python Debug怎么用?Python Debug使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Debug类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: search

 def search(self, name, date, _type, manual, count_bolton_section, bolton_types):
     try:
         __body = {"$and": []}
         if name != '':
             __body['$and'].append({'name': {"$regex": '^' + name}})
         if date != '':
             start_date = khayyam.JalaliDatetime().strptime(date + " 00:00:00", "%Y/%m/%d %H:%M:%S").todatetime()
             end_date = khayyam.JalaliDatetime().strptime(date + " 23:59:59", "%Y/%m/%d %H:%M:%S").todatetime()
             __body['$and'].append({'date': {"$gte": start_date, "$lt": end_date}})
         if _type != '':
             __body['$and'].append({'type': ObjectId(_type)})
         if manual != '':
             __body['$and'].append({'manual': manual})
         if count_bolton_section != '':
             __body['$and'].append({'sections': {"$size": int(count_bolton_section)}})
         if not len(__body['$and']):
             __body = {}
         all_bolton = MongodbModel(collection='bolton', body=__body).get_all()
         self.result['value'] = []
         for i in all_bolton:
             self.result['value'].append(self.get_bolton(bolton_types, i))
         self.result['status'] = True
         return self.result
     except:
         print Debug.get_exception(sub_system='admin', severity='error', tags='mongodb > save', data='collection > bolton')
         return self.result
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:26,代码来源:bolton.py

示例2: get_all_two_level

    def get_all_two_level(self, access):
        try:
            r = MongodbModel(collection='subject', body={"parent": None, "_id": {"$in": access}}).get_all()
            if r:
                l = []
                for i in r:
                    s_r = MongodbModel(collection='subject', body={"parent": i['_id'], "_id": {"$in": access}}).get_all()
                    s_l = []
                    for j in s_r:
                        s_l.append(dict(
                            id=j['_id'],
                            name=j['name'],
                        ))
                    l.append(dict(
                        id=i['_id'],
                        name=i['name'],
                        child=s_l
                    ))
                self.result['value'] = l
                self.result['status'] = True

            return self.result
        except:
            Debug.get_exception(sub_system='admin', severity='error', tags='mongodb > get_all', data='collection > subject')
            return self.result
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:25,代码来源:subject.py

示例3: get_all_detail

    def get_all_detail(self, sort=None, reverse=True):
        try:
            __body = {"bolton": self.bolton, "section": self.section}
            __key = {"_id": 1, "title": 1, "date": 1, "agency": 1, "agency_name": 1, "agency_color": 1,
                     "direction_content": 1, "news_group": 1, "main_source_news": 1, "news_maker": 1,
                     "star": 1, "read": 1, "important": 1, "note": 1}
            ascending = 1 if reverse else -1
            __sort = [('date', ascending)]
            if sort == 'user_choose':
                __sort = [('_id', ascending)]
            elif sort == 'category':
                __sort = [('category_name', ascending), ('date', ascending), ('agency_name', ascending)]
            elif sort == 'agency':
                __sort = [('agency_name', ascending), ('date', ascending)]
            elif sort == 'subject':
                __sort = [('subject_name', ascending), ('date', ascending)]
            elif sort == 'direction':
                __sort = [('direction_name', ascending), ('date', ascending)]
            r = MongodbModel(collection='bolton_news', body=__body, key=__key, sort=__sort).get_all_key_multi_sort()
            r = [i for i in r]

            self.result['value'] = []
            for i in r:
                self.get_news_detail(i)

            self.result['status'] = True

            return self.result
        except:
            print Debug.get_exception(sub_system='admin', severity='error', tags='mongodb > get_all', data='collection > bolton_news')
            self.result['value'] = []
            return self.result
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:32,代码来源:bolton_news.py

示例4: save_charts_content

    def save_charts_content(self, **body):
        try:
            __body = {"$set": {"charts_content": {
                "content_format": body['content_format'],
                "importance_news": body['importance_news'],
                "performance_agency_number_news": body['based_count_news'],
                "general_statistics_agency": body['stats_news'],
                "daily_statistics_news": body['daily_news'],
                "important_topic_news": body['news_headlines'],
                "important_keyword_news": body['tags_news'],
                "reflecting_news": body['reflecting_news'],
                "importance_news_media_placement": body['importance_media'],
                "content_direction": body['positive_negative_orientation'],
                "agency_direction": body['orientation_news_sources'],
                "important_news_maker": body['important_news_makers'],
                "main_sources_news_1": body['main_sources_news_1'],
                "main_sources_news_2": body['main_sources_news_2'],
            }}}

            __condition = {'_id': ObjectId(self.id)}
            self.result['value'] = MongodbModel(collection='user_group', body=__body, condition=__condition).update()
            self.result['status'] = True
            return self.result
        except:
            Debug.get_exception(sub_system='admin', severity='error', tags='mongodb > save_charts_content', data='collection > user_group')
            return self.result
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:26,代码来源:group.py

示例5: delete

 def delete(self, kill=False):
     try:
         workers = RedisBaseModel(key=self.__key).get()
         try:
             workers = json.loads(workers)
         except:
             workers = []
         if workers is None:
             workers = []
         _workers = []
         _w = None
         for w in workers:
             if w['_id'] != self.id:
                 _workers.append(w)
             else:
                 _w = w
         if _w is not None:
             _w['end'] = datetime.datetime.now()
             _w['start'] = d_parser.parse(_w['start'])
             _w['kill'] = kill
             MongodbModel(collection="worker", body=_w).insert()
         RedisBaseModel(key=self.__key, value=json.dumps(_workers)).set()
         return True
     except:
         Debug.get_exception(sub_system='admin', severity='error', tags='redis > set', data='')
         return False
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:26,代码来源:worker.py

示例6: insert

    def insert(self):
        try:
            body = {
                'link': self.link,
                'hash_link': self.get_hash(self.link),
                'title': self.title,
                'hash_title': self.get_hash(self.title),
                'ro_title': self.ro_title,
                'summary': self.summary,
                'thumbnail': self.thumbnail,
                'agency': self.agency,
                'subject': self.subject,
                'content': self.content,
                'date': datetime.datetime.today()
            }
            e = self.is_exist()
            if e is False:
                self.result['value'] = ElasticSearchModel(doc_type=BriefsModel.doc_type, body=body).insert()
                self.result['status'] = True
                self.result['message'] = 'INSERT'
            else:
                self.result['status'] = False
                self.result['message'] = 'EXIST'
                self.result['value'] = {'_id': e}

            return self.result

        except:
            Debug.get_exception(sub_system='engine_feed', severity='critical_error', tags='insert_brief', data=self.link)
            return self.result
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:30,代码来源:briefs.py

示例7: get_result_query

    def get_result_query(self, **query):
        try:
            from base_app.models.elasticsearch.base_model import ElasticSearchModel
            e = ElasticSearchModel(_id=str(query['item_id']), body=query['body'], index=query['index'], doc_type=query['doc_type'])
            result = {}
            if query['function'] == 'search':
                result = e.search()
            elif query['function'] == 'insert':
                result = e.insert()
            elif query['function'] == 'delete':
                result = e.delete()
            elif query['function'] == 'update':
                result = e.update()
            elif query['function'] == 'count_all':
                result = e.count_all()
            elif query['function'] == 'count':
                result = e.count()
            elif query['function'] == 'get_one':
                result = e.get_one()

            self.result['value'] = result
            self.result['status'] = True
            return self.result
        except:
            Debug.get_exception(sub_system='admin', severity='error', tags='mongodb > get_all', data='collection > elastic_statistic')
            return self.result
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:26,代码来源:elastic_statistic.py

示例8: count

 def count():
     try:
         __body = {"code": -1}
         return MongodbModel(collection='news_queue', body=__body).count()
     except:
         Debug.get_exception(sub_system='admin', severity='error', tags='mongodb > get_all', data='collection > news_queue')
         return 0
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:7,代码来源:news_queue.py

示例9: save

    def save(self, **agency):
        try:
            __body = {
                'name': agency['name'],
                'base_link': agency['link'],
                'color': agency['color'],
                'category': agency['category'],
                'direction': agency['direction'],
                'rss_list': agency['rss_list'],
                'comparatives': agency['comparatives'],
                'type': agency['type_agency'],
                'active': agency['active'],
                'pic': agency['pic'],
                'float_left': agency['float_left'],
                'add_by_confirm': agency['add_by_confirm'],
                'extract_image': agency['extract_image'],
                'copy_key_words': agency['key_words'],
                'link': agency['link'],
                'links': agency['links'],
            }

            self.result['value'] = str(MongodbModel(collection='agency', body=__body).insert())
            self.result['status'] = True
            return self.result
        except:
            Debug.get_exception(sub_system='agency', severity='error', tags='save')
            return self.result
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:27,代码来源:agency.py

示例10: get_all_key_limit

 def get_all_key_limit(self):
     try:
         return self.collection.find(self.__body, self.__key).skip(self.__size * (self.__page - 1)).limit(self.__size)
     except:
         Debug.get_exception(sub_system='admin', severity='critical_error', tags='mongodb > get_all_pagination',
                             data='body: ' + str(self.__body))
         return False
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:7,代码来源:base_model.py

示例11: get_all

 def get_all(self):
     try:
         return self.collection.find(self.__body)
     except:
         Debug.get_exception(sub_system='admin', severity='critical_error', tags='mongodb > get_all',
                             data='collection: ' + self.__collection + ' body: ' + str(self.__body))
         return False
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:7,代码来源:base_model.py

示例12: get_all_sort

 def get_all_sort(self):
     try:
         return self.collection.find(self.__body).sort([(self.__sort, self.__ascending)])
     except:
         Debug.get_exception(sub_system='admin', severity='critical_error', tags='mongodb > get_all_pagination',
                             data='body: ' + str(self.__body))
         return False
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:7,代码来源:base_model.py

示例13: update

 def update(self, **agency):
     try:
         __body = {"$set": {
             'name': agency['name'],
             'base_link': agency['link'],
             'color': agency['color'],
             'category': agency['category'],
             'direction': agency['direction'],
             'active': agency['active'],
             'pic': agency['pic'],
             'float_left': agency['float_left'],
             'add_by_confirm': agency['add_by_confirm'],
             'extract_image': agency['extract_image'],
             'copy_key_words': agency['key_words'],
             'link': agency['link'],
             'links': agency['links'],
             'comparatives': agency['comparatives'],
             'rss_list': agency['rss_list']
         }}
         condition = {"_id": self.id}
         self.result['value'] = MongodbModel(collection='agency', body=__body, condition=condition).update()
         self.result['status'] = True
         return self.result
     except:
         Debug.get_exception(sub_system='agency', severity='error', tags='save')
         return self.result
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:26,代码来源:agency.py

示例14: get_one

    def get_one(self):
        try:
            r = MongodbModel(collection='user_setting', body={'user': self.user}).get_one()
            if r:
                l = {
                    "make_bolton": r['make_bolton'],
                    "bolton_count": r['bolton_count'],
                    "bolton_count_part": int(r['bolton_count_part']),
                    "make_bolton_automatic": int(r['make_bolton_automatic']),
                    "bolton_automatic_count": r['bolton_automatic_count'],
                    "bolton_automatic_count_part": r['bolton_automatic_count_part'],
                    "make_newspaper": r['make_newspaper'],
                    "newspaper_count": r['newspaper_count'],
                    "newspaper_count_part": r['newspaper_count_part'],
                    "pattern_sources": r['pattern_sources'],
                    "pattern_sources_count": r['pattern_sources_count'],
                    "pattern_search": r['pattern_search'],
                    "pattern_search_count": r['pattern_search_count'],
                    "diagram": r['diagram'],
                    "content_analysis": r['content_analysis']
                }
                self.result['value'] = l
                self.result['status'] = True

            return self.result
        except:
            Debug.get_exception(sub_system='admin', severity='error', tags='mongodb > get_one', data='collection > user_setting')
            return self.result
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:28,代码来源:user_setting.py

示例15: get

 def get(self):
     try:
         return self.db.get(self.__key)
     except:
         Debug.get_exception(sub_system='admin', severity='critical_error', tags='mongodb > insert',
                             data='key: ' + self.__key)
         return False
开发者ID:A-bazdar,项目名称:negah-khabari,代码行数:7,代码来源:base_model.py


注:本文中的base_app.classes.debug.Debug类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。