-# -*- coding: utf-8 -*-
-#
# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
def __len__(self):
return self.chunk_set.count()
- def __nonzero__(self):
+ def __bool__(self):
"""
Necessary so that __len__ isn't used for bool evaluation.
"""
return True
- def __unicode__(self):
+ def __str__(self):
return self.title
@models.permalink
# =======================
def accessible(self, request):
- return self.public or request.user.is_authenticated()
+ return self.public or request.user.is_authenticated
@classmethod
@transaction.atomic
try:
bi = self.wldocument(changes=changes, strict=True).book_info
- except ParseError, e:
- raise AssertionError(_('Invalid XML') + ': ' + unicode(e))
+ except ParseError as e:
+ raise AssertionError(_('Invalid XML') + ': ' + str(e))
except NoDublinCore:
raise AssertionError(_('No Dublin Core found.'))
- except ValidationError, e:
- raise AssertionError(_('Invalid Dublin Core') + ': ' + unicode(e))
+ except ValidationError as e:
+ raise AssertionError(_('Invalid Dublin Core') + ': ' + str(e))
valid_about = self.correct_about()
assert bi.about == valid_about, _("rdf:about is not") + " " + valid_about
def publishable_error(self):
try:
return self.assert_publishable()
- except AssertionError, e:
+ except AssertionError as e:
return e
else:
return None