diff --git a/rattail/__init__.py b/rattail/__init__.py index da0247814b1f2b3d3fcb2d20eccf3fe52ecdd3a5..20f9104cc76c936fd1a40d8e2a9566b9c9b1ddc1 100644 --- a/rattail/__init__.py +++ b/rattail/__init__.py @@ -30,17 +30,4 @@ from pkgutil import extend_path __path__ = extend_path(__path__, __name__) -from edbob.db.extensions import Extension - -import rattail.model from rattail._version import __version__ -from rattail.enum import * -from rattail.model import * - - -__all__ = rattail.model.__all__ - - -class RattailExtension(Extension): - - name = 'rattail' diff --git a/rattail/db.py b/rattail/db/__init__.py similarity index 93% rename from rattail/db.py rename to rattail/db/__init__.py index 4f8a5e93115f5298399c3e09d7246c2f1d41326a..f46ee2f27e091450204f33ffef6bada55c43ebde 100644 --- a/rattail/db.py +++ b/rattail/db/__init__.py @@ -26,11 +26,22 @@ ``rattail.db`` -- Database Stuff """ +import edbob from edbob.db.extensions import activate_extension import rattail +def init(config): + """ + Initialize the Rattail database framework. + """ + + from rattail.db import extension + edbob.graft(rattail, extension.model) + edbob.graft(rattail, extension.enum) + + def init_database(engine, session): """ Initialize an ``edbob`` database for use with Rattail. diff --git a/rattail/db/extension/__init__.py b/rattail/db/extension/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f97ee171d0686a00c11b535f03b7a95153baed67 --- /dev/null +++ b/rattail/db/extension/__init__.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +################################################################################ +# +# Rattail -- Retail Software Framework +# Copyright © 2010-2012 Lance Edgar +# +# This file is part of Rattail. +# +# Rattail 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. +# +# Rattail 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 Rattail. If not, see . +# +################################################################################ + +""" +``rattail.extension`` -- Database Extension +""" + +from edbob.db.extensions import Extension + + +class RattailExtension(Extension): + + name = 'rattail' diff --git a/rattail/enum.py b/rattail/db/extension/enum.py similarity index 100% rename from rattail/enum.py rename to rattail/db/extension/enum.py diff --git a/rattail/model.py b/rattail/db/extension/model.py similarity index 100% rename from rattail/model.py rename to rattail/db/extension/model.py diff --git a/setup.py b/setup.py index 8fd88a9930a1563ec28bcc6a8c4a4d1fc629b99d..2d31cf4a16497a52999d7c6bf26c254bd9884c81 100644 --- a/setup.py +++ b/setup.py @@ -109,7 +109,7 @@ rattail = rattail.commands:main rattailw = rattail.commands:main [edbob.db.extensions] -rattail = rattail:RattailExtension +rattail = rattail.db.extension:RattailExtension [rattail.commands] filemon = rattail.commands:FileMonitorCommand