diff options
-rw-r--r-- | devel/views.py | 2 | ||||
-rw-r--r-- | main/models.py | 2 | ||||
-rw-r--r-- | packages/views.py | 16 | ||||
-rwxr-xr-x | scripts/reporead.py | 7 | ||||
-rw-r--r-- | todolists/views.py | 2 |
5 files changed, 12 insertions, 17 deletions
diff --git a/devel/views.py b/devel/views.py index 29dfcd0..78c466a 100644 --- a/devel/views.py +++ b/devel/views.py @@ -21,7 +21,7 @@ def index(request): 'todos': Todolist.objects.incomplete(), 'repos': Repo.objects.all(), 'arches': Arch.objects.all(), 'maintainers': [ - User(id=0, username="orphan", first_name="Orphans") + User(id=None, username="orphan", first_name="Orphans") ] + list(User.objects.filter(is_active=True).order_by('last_name')) } diff --git a/main/models.py b/main/models.py index 7a3496a..98547a3 100644 --- a/main/models.py +++ b/main/models.py @@ -162,7 +162,7 @@ class Package(models.Model): id = models.AutoField(primary_key=True) repo = models.ForeignKey(Repo, related_name="packages") arch = models.ForeignKey(Arch, related_name="packages") - maintainer = models.ForeignKey(User, related_name="maintained_packages") + maintainer = models.ForeignKey(User, related_name="maintained_packages", null=True, blank=True) needupdate = models.BooleanField(default=False) pkgname = models.CharField(max_length=255) pkgbase = models.CharField(max_length=255, null=True, blank=True) diff --git a/packages/views.py b/packages/views.py index d696b7e..aa66271 100644 --- a/packages/views.py +++ b/packages/views.py @@ -21,10 +21,10 @@ def update(request): mode = None if request.POST.has_key('adopt'): mode = 'adopt' - maint_id = request.user.id + maint = request.user if request.POST.has_key('disown'): mode = 'disown' - maint_id = 0 + maint = None if mode: pkgs = Package.objects.filter( @@ -35,7 +35,7 @@ def update(request): repo__in=request.user.userprofile_user.all( )[0].allowed_repos.all()) for pkg in pkgs: - pkg.maintainer_id = maint_id + pkg.maintainer = maint pkg.save() request.user.message_set.create(message="%d packages %sed" % ( @@ -65,8 +65,8 @@ def getmaintainer(request, name, repo, arch): pkg= get_object_or_404(Package, pkgname=name, repo__name__iexact=repo, arch__name=arch) - return HttpResponse(str(pkg.maintainer if pkg.maintainer_id else 'None')) - + return HttpResponse(str(pkg.maintainer)) + class PackageSearchForm(forms.Form): repo = forms.ChoiceField(required=False) arch = forms.ChoiceField(required=False) @@ -132,7 +132,7 @@ def search(request, page=None): packages = packages.filter( arch__name=form.cleaned_data['arch']) if form.cleaned_data['maintainer'] == 'orphan': - packages=packages.filter(maintainer__id = 0) + packages=packages.filter(maintainer=None) elif form.cleaned_data['maintainer']: packages = packages.filter( maintainer__username=form.cleaned_data['maintainer']) @@ -251,8 +251,8 @@ def flag(request, pkgid): for package in pkgs: package.needupdate = 1 package.save() - - if pkg.maintainer_id == 0: + + if not pkg.maintainer: toemail = 'arch-notifications@archlinux.org' subject = 'Orphan %s package [%s] marked out-of-date' % (pkg.repo.name, pkg.pkgname) else: diff --git a/scripts/reporead.py b/scripts/reporead.py index 5d0ff26..c346afa 100755 --- a/scripts/reporead.py +++ b/scripts/reporead.py @@ -236,12 +236,7 @@ def db_update(archname, pkgs): for p in [x for x in pkgs if x.name in in_sync_not_db]: logger.info("Adding package %s", p.name) - ## note: maintainer is being set to orphan for now - ## maybe later we can add logic to match pkgbuild maintainers - ## to db maintainer ids - pkg = Package( - pkgname = p.name, arch = architecture, repo = repository, - maintainer_id = 0) + pkg = Package(pkgname = p.name, arch = architecture, repo = repository) populate_pkg(pkg, p, timestamp=now) # packages in database and not in syncdb (remove from database) diff --git a/todolists/views.py b/todolists/views.py index c06397e..00236c6 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -124,7 +124,7 @@ def delete_todolist(request, object_id): def send_todolist_email(todo): '''Sends an e-mail to the maintainer of a package notifying them that the package has been added to a to-do list''' - if todo.pkg.maintainer_id == 0: + if not todo.pkg.maintainer: return page_dict = { |