save point (see note)
Changed license to AGPLv3, "finished" console command framework (for now?), and added initial db/lib/pyramid/wx subpackages - though those are not yet well tested.
This commit is contained in:
parent
3d75732d36
commit
a6decbb313
36 changed files with 2910 additions and 172 deletions
55
edbob/util.py
Normal file
55
edbob/util.py
Normal file
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
################################################################################
|
||||
#
|
||||
# edbob -- Pythonic Software Framework
|
||||
# Copyright © 2010-2012 Lance Edgar
|
||||
#
|
||||
# This file is part of edbob.
|
||||
#
|
||||
# edbob is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# edbob is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
# more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with edbob. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
"""
|
||||
``edbob.util`` -- Utilities
|
||||
"""
|
||||
|
||||
import edbob
|
||||
|
||||
|
||||
class requires_impl(edbob.Object):
|
||||
"""
|
||||
Decorator for properties or methods defined on parent classes only for
|
||||
documentation's sake, but which in fact rely on the derived class entirely
|
||||
for implementation.
|
||||
|
||||
This merely adds a helpful message to the ``NotImplementedError`` exception
|
||||
which will be raised.
|
||||
"""
|
||||
|
||||
is_property = False
|
||||
|
||||
def __call__(self, func):
|
||||
if self.is_property:
|
||||
message = "Please define the %s.%s attribute"
|
||||
else:
|
||||
message = "Please implement the %s.%s() method"
|
||||
|
||||
def wrapped(self, *args, **kwargs):
|
||||
msg = message % (self.__class__.__name__, func.__name__)
|
||||
msg += " (within the %s module)" % self.__class__.__module__
|
||||
raise NotImplementedError(msg)
|
||||
|
||||
return wrapped
|
Loading…
Add table
Add a link
Reference in a new issue