python类DataError()的实例源码

models.py 文件源码 项目:CoBL-public 作者: lingdb 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def populate_from_bibtex(self, bibtex_dict):
        for key in bibtex_dict.keys():
            if key not in ['ID', 'date']:
                setattr(self, key, bibtex_dict[key])
        try:
            self.save()
        except DataError as e:
            print(e, bibtex_dict)
scrub_listings.py 文件源码 项目:rets-django 作者: bgirer 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def handle_listing(listing_object, results_item):
        try:
            new_listing_object = extract_listing_data(results_item)
            updated_listing_object = update_core_listing_data(listing_object,
                                                              new_listing_object)
            updated_listing_object.save()
        except (ValueError, DataError, PG_DataError):
            logger.debug(traceback.print_exc(limit=None))
            raise ListingException()


# Handle premature exits
tests.py 文件源码 项目:babar3 作者: Babaritech 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_message_short_enough(self):
        """
        Test that a message length can't be superior to 140 characters
        """
        t = Tweet(
            time = 60,
            message = 't'*141
        )
        # assertRaises doesn't seem to work
        try:
            t.save()
        except Exception as e:
            self.assertTrue(type(e) is DataError)
tests.py 文件源码 项目:django_postgres_extensions 作者: primal100 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_array_int_raises(self):
        self.assertRaises(DataError, self.queryset.update, prices=ArrayAppend('prices', 'test'))


问题


面经


文章

微信
公众号

扫码关注公众号