diff options
author | Priit Laes <plaes@plaes.org> | 2010-08-10 23:51:20 +0300 |
---|---|---|
committer | Priit Laes <plaes@plaes.org> | 2010-08-10 23:51:20 +0300 |
commit | 84e3dbec93d78e5361d21d03cb03c0045ff00c86 (patch) | |
tree | 0cacdadd1887ab01f33eb3f39d687a56483c510c | |
parent | Readd Package.rename support to syncer (diff) | |
download | gsoc2010-grumpy-84e3dbec93d78e5361d21d03cb03c0045ff00c86.tar.gz gsoc2010-grumpy-84e3dbec93d78e5361d21d03cb03c0045ff00c86.tar.bz2 gsoc2010-grumpy-84e3dbec93d78e5361d21d03cb03c0045ff00c86.zip |
Fix bug in package rename
-rw-r--r-- | grumpy/models.py | 3 | ||||
-rw-r--r-- | grumpy/testsuite/pkgmodel.py | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/grumpy/models.py b/grumpy/models.py index 31127a0..82a8c6f 100644 --- a/grumpy/models.py +++ b/grumpy/models.py @@ -221,11 +221,12 @@ class Package(db.Model): def rename(self, key): """Rename a package and all its ebuilds""" # Look up or create new category - cat = key.split('/')[0] + cat, pkg = key.split('/') c = Category.query.filter_by(name=cat).first() if not c: c = Category(cat) self.key = key + self.pkg = pkg self.category = c for ebuild in self.ebuilds.values(): ebuild.rename(key) diff --git a/grumpy/testsuite/pkgmodel.py b/grumpy/testsuite/pkgmodel.py index 4154141..0c65c91 100644 --- a/grumpy/testsuite/pkgmodel.py +++ b/grumpy/testsuite/pkgmodel.py @@ -157,8 +157,6 @@ class PkgModelTestCase(GrumpyTestCase): assert Developer.query.count() == 2 def test_package_rename(self): - data = {} - info = {'maintainers' : (), 'herds': ()} with self.app.test_request_context(): self.make_package(self.get_pkg('sys-apps/action-1.0-r2', {}, {})) assert Category.query.count() == 1 @@ -176,6 +174,7 @@ class PkgModelTestCase(GrumpyTestCase): assert p == None p = Package.query.filter_by(key='sys-fail/kala').first() assert p != None + assert p.pkg == 'kala' e = Ebuild.query.first() assert e.cpv == 'sys-fail/kala-1.0-r2' |