launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07195
[Merge] lp:~jtv/maas/default-meta into lp:maas
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/default-meta into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jtv/maas/default-meta/+merge/103046
As per the plan for model migration from models.py modules to models/ packages. Each model class that lives outside of src/*/models/__init__.py will need a nested Meta class that sets its app_label. Other things may turn up as well.
This branch provides simple base classes with the defaults for each app that needs them. A model class could, in the simplest case, just define Meta to be the same as DefaultMeta.
Jeroen
--
https://code.launchpad.net/~jtv/maas/default-meta/+merge/103046
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/default-meta into lp:maas.
=== modified file 'src/maasserver/__init__.py'
--- src/maasserver/__init__.py 2012-04-16 10:00:51 +0000
+++ src/maasserver/__init__.py 2012-04-23 05:54:18 +0000
@@ -10,4 +10,16 @@
)
__metaclass__ = type
-__all__ = []
+__all__ = [
+ 'DefaultMeta',
+ ]
+
+
+class DefaultMeta:
+ """Base class for model `Meta` classes in the maasserver app.
+
+ Each model in the models package outside of __init__.py needs a nested
+ `Meta` class that defines `app_label`. Otherwise, South won't recognize
+ the model and will fail to generate schema migrations for it.
+ """
+ app_label = 'maasserver'
=== modified file 'src/metadataserver/__init__.py'
--- src/metadataserver/__init__.py 2012-02-07 18:14:14 +0000
+++ src/metadataserver/__init__.py 2012-04-23 05:54:18 +0000
@@ -0,0 +1,25 @@
+# Copyright 2012 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Metadata service application."""
+
+from __future__ import (
+ absolute_import,
+ print_function,
+ unicode_literals,
+ )
+
+__metaclass__ = type
+__all__ = [
+ 'DefaultMeta',
+ ]
+
+
+class DefaultMeta:
+ """Base class for model `Meta` classes in the metadataserver app.
+
+ Each model in the models package outside of __init__.py needs a nested
+ `Meta` class that defines `app_label`. Otherwise, South won't recognize
+ the model and will fail to generate schema migrations for it.
+ """
+ app_label = 'metadataserver'