From patchwork Mon Jan 14 03:20:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Doan X-Patchwork-Id: 14020 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 450E423E2E for ; Mon, 14 Jan 2013 03:20:20 +0000 (UTC) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by fiordland.canonical.com (Postfix) with ESMTP id 9B564A180E6 for ; Mon, 14 Jan 2013 03:20:19 +0000 (UTC) Received: by mail-vc0-f171.google.com with SMTP id n11so3117021vch.2 for ; Sun, 13 Jan 2013 19:20:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:content-type:mime-version:x-launchpad-project :x-launchpad-branch:x-launchpad-message-rationale :x-launchpad-branch-revision-number:x-launchpad-notification-type:to :from:subject:message-id:date:reply-to:sender:errors-to:precedence :x-generated-by:x-launchpad-hash:x-gm-message-state; bh=ZthxFD9pt2t8HqSP1f7X2m8oI0Uil+xJ5ydUvNCSUmM=; b=Sz4kyknL5Aaf9I8EaaqWx/eR0sr+OfPIlQQh69OW9vozbjuvrbS8Cmsn0KJ29VWbkL n0c5kEciBYzpqK6YxvniNh3taH3hy+Y0L4sgwN52Jlh0oeKficl7LFOn1Qam+OUggCAB qkSLWYQtxKmll3fXhl0AxfYgdDgm+sPETtO+3YTg5R3bmXg+QWtZXtPiqmL2FZ0d+UZ7 ITBPjcrGLdCYkR6pQVV1MH57s+UAfhzzsgftESGd5rzWfe7QoJlmxWS9gr3yANXlxCKn 3Ctu50ByaAQQwrON8j5/HvqksJkLUez/55fvG5SM4yseXHc+tNOZgv9xP4AgI5MWfBIG sxcw== X-Received: by 10.52.18.147 with SMTP id w19mr88519001vdd.94.1358133619000; Sun, 13 Jan 2013 19:20:19 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp41823veb; Sun, 13 Jan 2013 19:20:18 -0800 (PST) X-Received: by 10.180.24.9 with SMTP id q9mr9937377wif.14.1358133617853; Sun, 13 Jan 2013 19:20:17 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ck5si10801237wib.1.2013.01.13.19.20.17 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 13 Jan 2013 19:20:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Tuaav-0005z9-84 for ; Mon, 14 Jan 2013 03:20:17 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 282D0E01C5 for ; Mon, 14 Jan 2013 03:20:17 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-server X-Launchpad-Branch: ~linaro-validation/lava-server/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 406 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-server/trunk] Rev 406: remove "project" concept from lava-server Message-Id: <20130114032017.13824.26561.launchpad@ackee.canonical.com> Date: Mon, 14 Jan 2013 03:20:17 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16420"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 9f2eca289e607029d12d49ff69fb5269f2890998 X-Gm-Message-State: ALoCoQkVH9AGWbV2zk5AUmwulBuwKuIZ5gum5NVUrAfErflJhLAtv+EZKVd5n76wthwQG1v0paGy Merge authors: Andy Doan (doanac) Related merge proposals: https://code.launchpad.net/~doanac/lava-server/remove-project-concept/+merge/142956 proposed by: Andy Doan (doanac) review: Approve - Michael Hudson-Doyle (mwhudson) ------------------------------------------------------------ revno: 406 [merge] committer: Andy Doan branch nick: lava-server timestamp: Sun 2013-01-13 21:19:36 -0600 message: remove "project" concept from lava-server removed: lava_projects/ lava_projects/__init__.py lava_projects/admin.py lava_projects/extension.py lava_projects/forms.py lava_projects/migrations/ lava_projects/migrations/0001_add_model_Project.py lava_projects/migrations/0002_add_model_ProjectFormerIdentifier.py lava_projects/migrations/__init__.py lava_projects/models.py lava_projects/templates/ lava_projects/templates/lava_projects/ lava_projects/templates/lava_projects/_project_actions.html lava_projects/templates/lava_projects/_project_form.html lava_projects/templates/lava_projects/project_detail.html lava_projects/templates/lava_projects/project_list.html lava_projects/templates/lava_projects/project_register_form.html lava_projects/templates/lava_projects/project_rename_form.html lava_projects/templates/lava_projects/project_root.html lava_projects/templates/lava_projects/project_update_form.html lava_projects/urls.py lava_projects/views.py modified: setup.py --- lp:lava-server https://code.launchpad.net/~linaro-validation/lava-server/trunk You are subscribed to branch lp:lava-server. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription === removed directory 'lava_projects' === removed file 'lava_projects/__init__.py' --- lava_projects/__init__.py 2011-10-21 00:44:26 +0000 +++ lava_projects/__init__.py 1970-01-01 00:00:00 +0000 @@ -1,19 +0,0 @@ -# Copyright (C) 2010, 2011 Linaro Limited -# -# Author: Zygmunt Krynicki -# -# This file is part of LAVA Server. -# -# LAVA Server is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License version 3 -# as published by the Free Software Foundation -# -# LAVA Server 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 General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with LAVA Server. If not, see . - -__version__ = (0, 1, 0, "final", 0) === removed file 'lava_projects/admin.py' --- lava_projects/admin.py 2011-10-11 09:20:14 +0000 +++ lava_projects/admin.py 1970-01-01 00:00:00 +0000 @@ -1,38 +0,0 @@ -# Copyright (C) 2010, 2011 Linaro Limited -# -# Author: Zygmunt Krynicki -# -# This file is part of LAVA Server. -# -# LAVA Server is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License version 3 -# as published by the Free Software Foundation -# -# LAVA Server 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 General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with LAVA Server. If not, see . - -from django.contrib import admin - -from lava_projects.models import Project, ProjectFormerIdentifier - - -class ProjectAdmin(admin.ModelAdmin): - - list_display = ( - '__unicode__', 'identifier', 'registered_by', - 'registered_on', 'is_public', 'owner') - - -class ProjectFormerIdentifierAdmin(admin.ModelAdmin): - - list_display = ( - 'former_identifier', 'project', 'renamed_on', 'renamed_by') - - -admin.site.register(Project, ProjectAdmin) -admin.site.register(ProjectFormerIdentifier, ProjectFormerIdentifierAdmin) === removed file 'lava_projects/extension.py' --- lava_projects/extension.py 2011-10-11 09:20:14 +0000 +++ lava_projects/extension.py 1970-01-01 00:00:00 +0000 @@ -1,48 +0,0 @@ -# Copyright (C) 2010, 2011 Linaro Limited -# -# Author: Zygmunt Krynicki -# -# This file is part of LAVA Server. -# -# LAVA Server is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License version 3 -# as published by the Free Software Foundation -# -# LAVA Server 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 General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with LAVA Server. If not, see . - -from lava_server.extension import LavaServerExtension - - -class ProjectExtension(LavaServerExtension): - """ - Extension adding project support - """ - - @property - def app_name(self): - return "lava_projects" - - @property - def name(self): - return "Projects" - - @property - def main_view_name(self): - return "lava.project.root" - - @property - def description(self): - return "Project support for LAVA" - - @property - def version(self): - import lava_projects - import versiontools - return versiontools.format_version( - lava_projects.__version__, hint=lava_projects) === removed file 'lava_projects/forms.py' --- lava_projects/forms.py 2011-10-11 09:20:14 +0000 +++ lava_projects/forms.py 1970-01-01 00:00:00 +0000 @@ -1,179 +0,0 @@ -# Copyright (C) 2010, 2011 Linaro Limited -# -# Author: Zygmunt Krynicki -# -# This file is part of LAVA Server. -# -# LAVA Server is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License version 3 -# as published by the Free Software Foundation -# -# LAVA Server 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 General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with LAVA Server. If not, see . - -from django import forms -from django.contrib.auth.models import Group -from django.core.exceptions import ValidationError -from django.utils.translation import ugettext as _ - -from lava_projects.models import Project - - -class _ProjectForm(forms.Form): - """ - Mix-in with common project fields. - """ - - name = forms.CharField( - label=_(u"Projet name"), - help_text=_(u"Any name of your liking, can be updated later if you" - u" change your mind"), - required=True, - max_length=100) - - description = forms.CharField( - label=_(u"Description"), - help_text=_(u"Arbitrary text about the project, you can use markdown" - u" formatting to style it"), - widget=forms.widgets.Textarea(), - required=False) - - group = forms.ModelChoiceField( - label=_(u"Group owner"), - help_text=_(u"Members of the selected group will co-own this project"), - empty_label=_("None, I'll be the owner"), - required=False, - queryset=Group.objects.all()) - - is_public = forms.BooleanField( - label=_(u"Project is public"), - help_text=_(u"If selected then this project will be visible to anyone." - u" Otherwise only owners can see the project"), - required=False) - - is_aggregate = forms.BooleanField( - label=_(u"Project is an aggregation (distribution)"), - help_text=_(u"If selected the project will be treated like a" - u" distribution. Some UI elements are optimized for that" - u" case and behave differently."), - required=False) - - def restrict_group_selection_for_user(self, user): - assert user is not None - self.fields['group'].queryset = user.groups.all() - - -class ProjectRegistrationForm(_ProjectForm): - """ - Form for registering new projects. - """ - - identifier = forms.CharField( - label=_(u"Identifier"), - help_text=_(u"A unique identifier built from restricted subset of" - u" characters (only basic lowercase letters, numbers and" - u" dash)"), - required=True, - max_length=100) - - def __init__(self, *args, **kwargs): - super(ProjectRegistrationForm, self).__init__(*args, **kwargs) - self._reorder_fields(['name', 'identifier']) - - def _reorder_fields(self, first): - for field in reversed(first): - self.fields.keyOrder.remove(field) - self.fields.keyOrder.insert(0, field) - - def clean_identifier(self): - """ - Check that the identifier is correct: - - 1) It does not collide with other projects - 2) Or their past identifiers - """ - value = self.cleaned_data['identifier'] - try: - # Lookup project that is, or was, this identifier - project = Project.objects.all().get_by_identifier(value) - if project.identifier == value: - # Disallow current identifiers from other projects - raise ValidationError( - "Project {0} is already using this identifier".format( - project)) - else: - # Disallow past identifiers from other projects - raise ValidationError( - "Project {0} was using this identifier in the past".format( - project)) - except Project.DoesNotExist: - pass - return value - - -class ProjectUpdateForm(_ProjectForm): - """ - Form for updating project data - """ - - -class ProjectRenameForm(forms.Form): - """ - Form for changing the project identifier - """ - - name = forms.CharField( - label=_(u"Projet name"), - help_text=_(u"The new project name, same limits as before " - u"(100 chars)"), - required=True, - max_length=100) - - identifier = forms.CharField( - label=_(u"New identifier"), - help_text=_(u"The new identifier has to be different from any current" - u" or past identifier used by other projects."), - required=True, - max_length=100) - - def __init__(self, project, *args, **kwargs): - super(ProjectRenameForm, self).__init__(*args, **kwargs) - self.project = project - - def clean_identifier(self): - """ - Check that new identifier is correct: - - 1) It does not collide with other projects - 2) Or their past identifiers - 3) It is different than the one we are currently using - """ - value = self.cleaned_data['identifier'] - try: - # Lookup project that is, or was, using this identifier - project = Project.objects.all().get_by_identifier(value) - if project == self.project and project.identifier != value: - # Allow reusing identifiers inside one project - pass - elif project == self.project and project.identifier == value: - raise ValidationError( - _(u"The new identifier has to be different than the one" - u"you are currently using")) - elif project.identifier == value: - # Disallow current identifiers from other projects - raise ValidationError( - _(u"Project {0} is already using this identifier").format( - project)) - else: - # Disallow past identifiers from other projects - raise ValidationError( - _(u"Project {0} was using this identifier in the" - u"past").format(project)) - except Project.DoesNotExist: - pass - return value === removed directory 'lava_projects/migrations' === removed file 'lava_projects/migrations/0001_add_model_Project.py' --- lava_projects/migrations/0001_add_model_Project.py 2011-09-23 08:29:48 +0000 +++ lava_projects/migrations/0001_add_model_Project.py 1970-01-01 00:00:00 +0000 @@ -1,91 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding model 'Project' - db.create_table('lava_projects_project', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), - ('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.Group'], null=True, blank=True)), - ('is_public', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=100)), - ('identifier', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=100, db_index=True)), - ('description', self.gf('django.db.models.fields.TextField')(blank=True)), - ('is_aggregate', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('registered_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='projects', to=orm['auth.User'])), - ('registered_on', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - )) - db.send_create_signal('lava_projects', ['Project']) - - - def backwards(self, orm): - - # Deleting model 'Project' - db.delete_table('lava_projects_project') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'lava_projects.project': { - 'Meta': {'object_name': 'Project'}, - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.Group']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'identifier': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'}), - 'is_aggregate': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'registered_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'projects'", 'to': "orm['auth.User']"}), - 'registered_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'lava_projects.projectfomeridentifier': { - 'Meta': {'object_name': 'ProjectFomerIdentifier'}, - 'former_identifier': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'former_identifiers'", 'to': "orm['lava_projects.Project']"}) - } - } - - complete_apps = ['lava_projects'] === removed file 'lava_projects/migrations/0002_add_model_ProjectFormerIdentifier.py' --- lava_projects/migrations/0002_add_model_ProjectFormerIdentifier.py 2011-09-24 19:18:28 +0000 +++ lava_projects/migrations/0002_add_model_ProjectFormerIdentifier.py 1970-01-01 00:00:00 +0000 @@ -1,88 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding model 'ProjectFormerIdentifier' - db.create_table('lava_projects_projectformeridentifier', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('project', self.gf('django.db.models.fields.related.ForeignKey')(related_name='former_identifiers', to=orm['lava_projects.Project'])), - ('former_identifier', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=100, db_index=True)), - ('renamed_by', self.gf('django.db.models.fields.related.ForeignKey')(related_name='project_former_identifiers_created', to=orm['auth.User'])), - ('renamed_on', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - )) - db.send_create_signal('lava_projects', ['ProjectFormerIdentifier']) - - - def backwards(self, orm): - - # Deleting model 'ProjectFormerIdentifier' - db.delete_table('lava_projects_projectformeridentifier') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'lava_projects.project': { - 'Meta': {'object_name': 'Project'}, - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.Group']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'identifier': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'}), - 'is_aggregate': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'registered_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'projects'", 'to': "orm['auth.User']"}), - 'registered_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}) - }, - 'lava_projects.projectformeridentifier': { - 'Meta': {'object_name': 'ProjectFormerIdentifier'}, - 'former_identifier': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'former_identifiers'", 'to': "orm['lava_projects.Project']"}), - 'renamed_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'project_former_identifiers_created'", 'to': "orm['auth.User']"}), - 'renamed_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}) - } - } - - complete_apps = ['lava_projects'] === removed file 'lava_projects/migrations/__init__.py' === removed file 'lava_projects/models.py' --- lava_projects/models.py 2011-10-11 09:58:00 +0000 +++ lava_projects/models.py 1970-01-01 00:00:00 +0000 @@ -1,168 +0,0 @@ -# Copyright (C) 2010, 2011 Linaro Limited -# -# Author: Zygmunt Krynicki -# -# This file is part of LAVA Server. -# -# LAVA Server is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License version 3 -# as published by the Free Software Foundation -# -# LAVA Server 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 General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with LAVA Server. If not, see . - -from django.contrib.auth.models import User -from django.db import models -from django.db.models.query import QuerySet -from django.utils.translation import ugettext as _ -from django_restricted_resource.managers import RestrictedResourceManager -from django_restricted_resource.models import RestrictedResource - - -class ProjectQuerySet(QuerySet): - """ - Query set with extra methods for projects - """ - - def recently_registered(self): - return self.order_by("-registered_on")[:10] - - def get_by_identifier(self, identifier): - """ - Get project by identifier, also searching for past - identifiers (project renames) - """ - try: - return self.get(identifier=identifier) - except Project.DoesNotExist as no_such_project: - try: - return ProjectFormerIdentifier.objects.get( - former_identifier=identifier).project - except ProjectFormerIdentifier.DoesNotExist: - raise no_such_project - - -class ProjectManager(RestrictedResourceManager): - """ - Manager with custom query set for projects - """ - use_for_related_fields = True - - def get_query_set(self): - return ProjectQuerySet(self.model, using=self._db) - - def recently_registered(self): - return self.get_query_set().recently_registered() - - def get_by_identifier(self, identifier): - return self.get_query_set().get_by_identifier(identifier) - - -class ProjectFormerIdentifier(models.Model): - """ - Former identifier of a project. Allows users to change the project - identifier while keeping URLs working properly. - """ - - project = models.ForeignKey( - "Project", - null=False, - blank=False, - verbose_name=_(u"Project"), - related_name="former_identifiers") - - former_identifier = models.SlugField( - null=False, - blank=False, - max_length=100, - verbose_name=_(u"Former identifier"), - help_text=_(u"A unique identifier built from restricted subset of" - u" characters (only basic letters, numbers and dash)"), - unique=True) - - renamed_by = models.ForeignKey( - User, - related_name="project_former_identifiers_created", - blank=False, - null=False, - verbose_name=_(u"Renamed by"), - help_text=_(u"User who renamed the project")) - - renamed_on = models.DateTimeField( - auto_now_add=True, - blank=False, - null=False, - verbose_name=_(u"Renamed on"), - help_text=_(u"Date and time of rename operation")) - - def __unicode__(self): - return self.former_identifier - - -class Project(RestrictedResource): - """ - Project is a container of everything else. Projects are restricted - resources and thus belong to a particular user or group and have a "public" - flag. - """ - - name = models.CharField( - null=False, - blank=False, - max_length=100, - verbose_name=_(u"Name"), - help_text=_(u"Name (this is how your project will be displayed" - u" throughout LAVA)")) - - identifier = models.SlugField( - null=False, - blank=False, - max_length=100, - verbose_name=_(u"Identifier"), - help_text=_(u"A unique identifier built from restricted subset of" - u" characters (only basic letters, numbers and dash)"), - unique=True) - - description = models.TextField( - null=False, - blank=True, - verbose_name=_(u"Description"), - help_text=_(u"Arbitrary text about the project, you can use markdown" - u" formatting to style it")) - - is_aggregate = models.BooleanField( - blank=True, - null=False, - verbose_name=_(u"Aggregate"), - help_text=_(u"When selected the project will be treated like a" - u" distribution. Some UI elements are optimized for that" - u" case and behave differently.")) - - registered_by = models.ForeignKey( - User, - related_name="projects", - blank=False, - null=False, - verbose_name=_(u"Registered by"), - help_text=_(u"User who registered this project")) - - registered_on = models.DateTimeField( - auto_now_add=True, - blank=False, - null=False, - verbose_name=_(u"Registered on"), - help_text=_(u"Date and time of registration")) - - objects = ProjectManager() - - def __unicode__(self): - return self.name - - @models.permalink - def get_absolute_url(self): - return ('lava.project.detail', [self.identifier]) === removed directory 'lava_projects/templates' === removed directory 'lava_projects/templates/lava_projects' === removed file 'lava_projects/templates/lava_projects/_project_actions.html' --- lava_projects/templates/lava_projects/_project_actions.html 2011-09-23 08:29:48 +0000 +++ lava_projects/templates/lava_projects/_project_actions.html 1970-01-01 00:00:00 +0000 @@ -1,5 +0,0 @@ -

Actions

- === removed file 'lava_projects/templates/lava_projects/_project_form.html' --- lava_projects/templates/lava_projects/_project_form.html 2011-11-08 23:54:43 +0000 +++ lava_projects/templates/lava_projects/_project_form.html 1970-01-01 00:00:00 +0000 @@ -1,19 +0,0 @@ -{% extends "layouts/form.html" %} - - -{% block extrahead %} -{{ block.super }} - - - - - -{% endblock %} - - -{% block content %} - -{{ block.super }} -{% endblock %} === removed file 'lava_projects/templates/lava_projects/project_detail.html' --- lava_projects/templates/lava_projects/project_detail.html 2011-09-24 19:18:28 +0000 +++ lava_projects/templates/lava_projects/project_detail.html 1970-01-01 00:00:00 +0000 @@ -1,43 +0,0 @@ -{% extends "layouts/content_with_sidebar.html" %} -{% load markup %} - - -{% block sidebar %} -{% include "lava_projects/_project_actions.html" %} -{% if belongs_to_user %} -

Project administration

- -{% endif %} -{% endblock %} - - -{% block content %} -{% if former_identifier %} -
-

- This project was renamed to {{ project.identifier }} - {{ former_identifier.renamed_on|timesince }} ago. The old URL referring to - {{ former_identifier.former_identifier }} will redirect here - automatically but you should update your bookmarks or hyper-links

-
-{% endif %} -

{{ project }}

-

-{% if project.user == project.registered_by %} -Owned and registered by {{ project.owner }} on {{ project.registered_on|date }} -{% else %} -Owned by {{ project.owner }} -{% if project.group and belongs_to_user %} -(you are a member of this group) -{% endif %} -, registered by {{ project.registered_by }} on {{ project.registered_on|date }} -{% endif %} -

-
- {{ project.description|markdown }} -
-{% endblock %} === removed file 'lava_projects/templates/lava_projects/project_list.html' --- lava_projects/templates/lava_projects/project_list.html 2011-09-24 19:18:28 +0000 +++ lava_projects/templates/lava_projects/project_list.html 1970-01-01 00:00:00 +0000 @@ -1,19 +0,0 @@ -{% extends "layouts/content_with_sidebar.html" %} - - -{% block sidebar %} -{% include "lava_projects/_project_actions.html" %} -{% endblock %} - - -{% block content %} -

Existing projects

-
    - {% for project in project_list %} -
  • - {{ project }} - {% if not project.is_public %}(private){% endif %} -
  • - {% endfor %} -
-{% endblock %} === removed file 'lava_projects/templates/lava_projects/project_register_form.html' --- lava_projects/templates/lava_projects/project_register_form.html 2011-09-24 19:18:28 +0000 +++ lava_projects/templates/lava_projects/project_register_form.html 1970-01-01 00:00:00 +0000 @@ -1,18 +0,0 @@ -{% extends "lava_projects/_project_form.html" %} - - -{% block form_header %} -

Register a project in LAVA

-{% endblock %} - - -{% block form_footer %} -{{ block.super }} - -{% endblock %} === removed file 'lava_projects/templates/lava_projects/project_rename_form.html' --- lava_projects/templates/lava_projects/project_rename_form.html 2011-09-24 19:18:28 +0000 +++ lava_projects/templates/lava_projects/project_rename_form.html 1970-01-01 00:00:00 +0000 @@ -1,35 +0,0 @@ -{% extends "lava_projects/_project_form.html" %} - - -{% block form_header %} -

Rename {{ project }}

-

Renaming a project is always possible but should be done carefully. -Each historic identifier is stored to ensure old URLs continue to work. They -are also reserved to prevent new projects from using them.

-{% endblock %} - - -{% block form_field %} -{% if field.name == "identifier" %} - - Old identifier - - -

This is your current project identifier

- - -{% endif %} -{{ block.super }} -{% endblock %} - - -{% block form_footer %} -

Continue

- or cancel - -{% endblock %} === removed file 'lava_projects/templates/lava_projects/project_root.html' --- lava_projects/templates/lava_projects/project_root.html 2011-09-24 19:18:28 +0000 +++ lava_projects/templates/lava_projects/project_root.html 1970-01-01 00:00:00 +0000 @@ -1,30 +0,0 @@ -{% extends "layouts/content_with_sidebar.html" %} - - -{% block sidebar %} -{% include "lava_projects/_project_actions.html" %} -{% endblock %} - - -{% block content %} -

Projects

-

LAVA uses projects to organize other data structures. Projects are similar -to the project concept in other development tools and web applications.

- -

Anyone is free to register a - project and use that to coordinate testing efforts.

- -{% if recent_project_list %} -

Recently registered projects

-
    - {% for project in recent_project_list %} -
  • - {{ project }}, - registered {{ project.registered_on|timesince }} ago - {% if not project.is_public %}(private){% endif %} -
  • - {% endfor %} -
-

See all projects

-{% endif %} -{% endblock %} === removed file 'lava_projects/templates/lava_projects/project_update_form.html' --- lava_projects/templates/lava_projects/project_update_form.html 2011-09-24 19:18:28 +0000 +++ lava_projects/templates/lava_projects/project_update_form.html 1970-01-01 00:00:00 +0000 @@ -1,33 +0,0 @@ -{% extends "lava_projects/_project_form.html" %} - - -{% block form_header %} -

Update {{ project }}

-{% endblock %} - - -{% block form_field %} -{{ block.super }} -{% if field.name == "name" %} - - Identifier
(read only) - - -

- Rename this project if you wish to change the identifier

- - -{% endif %} -{% endblock %} - - -{% block form_footer %} -

Continue

- or cancel - -{% endblock %} === removed file 'lava_projects/urls.py' --- lava_projects/urls.py 2011-10-11 09:20:14 +0000 +++ lava_projects/urls.py 1970-01-01 00:00:00 +0000 @@ -1,35 +0,0 @@ -# Copyright (C) 2010, 2011 Linaro Limited -# -# Author: Zygmunt Krynicki -# -# This file is part of LAVA Server. -# -# LAVA Server is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License version 3 -# as published by the Free Software Foundation -# -# LAVA Server 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 General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with LAVA Server. If not, see . - -from django.conf.urls.defaults import * - - -urlpatterns = patterns( - 'lava_projects.views', - url('^$', 'project_root', - name='lava.project.root'), - url(r'^\+list/$', 'project_list', - name='lava.project.list'), - url(r'^\+register/$', 'project_register', - name='lava.project.register'), - url(r'^(?P[a-z0-9-]+)/$', 'project_detail', - name='lava.project.detail'), - url(r'^(?P[a-z0-9-]+)/\+update/$', 'project_update', - name='lava.project.update'), - url(r'^(?P[a-z0-9-]+)/\+rename/$', 'project_rename', - name='lava.project.rename')) === removed file 'lava_projects/views.py' --- lava_projects/views.py 2011-11-28 20:09:04 +0000 +++ lava_projects/views.py 1970-01-01 00:00:00 +0000 @@ -1,219 +0,0 @@ -# Copyright (C) 2010, 2011 Linaro Limited -# -# Author: Zygmunt Krynicki -# -# This file is part of LAVA Server. -# -# LAVA Server is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License version 3 -# as published by the Free Software Foundation -# -# LAVA Server 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 General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with LAVA Server. If not, see . - -from django.contrib.auth.decorators import login_required -from django.http import ( - Http404, - HttpResponse, - HttpResponseForbidden, - HttpResponseRedirect, -) -from django.shortcuts import get_object_or_404 -from django.template import RequestContext, loader -from django.utils.translation import ugettext as _ -from django.views.generic.list_detail import object_list - -from lava_server.views import index as lava_index -from lava_server.bread_crumbs import ( - BreadCrumb, - BreadCrumbTrail, -) -from lava_projects.models import ( - Project, - ProjectFormerIdentifier, -) -from lava_projects.forms import ( - ProjectRenameForm, - ProjectRegistrationForm, - ProjectUpdateForm, -) - - -@BreadCrumb(_("Projects"), parent=lava_index) -def project_root(request): - template_name = "lava_projects/project_root.html" - t = loader.get_template(template_name) - c = RequestContext(request, { - 'recent_project_list': Project.objects.accessible_by_principal( - request.user).recently_registered(), - 'bread_crumb_trail': BreadCrumbTrail.leading_to(project_root)}) - return HttpResponse(t.render(c)) - - -@BreadCrumb(_("List of all projects"), project_root) -def project_list(request): - return object_list( - request, - queryset=Project.objects.accessible_by_principal(request.user), - template_name="lava_projects/project_list.html", - extra_context={ - 'bread_crumb_trail': BreadCrumbTrail.leading_to( - project_list)}, - template_object_name="project") - - -@BreadCrumb("{project}", - parent=project_root, - needs=['project_identifier']) -def project_detail(request, identifier): - # A get by identifier, looking at renames, if needed. - try: - project = Project.objects.accessible_by_principal( - request.user).get_by_identifier(identifier) - except Project.DoesNotExist: - raise Http404("No such project") - # Redirect users to proper URL of this project if using one of the older - # names. - if project.identifier != identifier: - return HttpResponseRedirect( - project.get_absolute_url() + "?former_identifier=" + identifier) - # Lookup former identifier if we have been redirected - former_identifier = None - if request.GET.get("former_identifier"): - try: - former_identifier = ProjectFormerIdentifier.objects.get( - former_identifier=request.GET.get("former_identifier")) - except ProjectFormerIdentifier.DoesNotExist: - pass - # Render to template - template_name = "lava_projects/project_detail.html" - t = loader.get_template(template_name) - c = RequestContext(request, { - 'project': project, - 'former_identifier': former_identifier, - 'belongs_to_user': project.is_owned_by(request.user), - 'bread_crumb_trail': BreadCrumbTrail.leading_to( - project_detail, - project=project, - project_identifier=project.identifier)}) - return HttpResponse(t.render(c)) - - -@BreadCrumb(_("Register new project"), - parent=project_root) -@login_required -def project_register(request): - if request.method == 'POST': - form = ProjectRegistrationForm(request.POST, request.FILES) - form.restrict_group_selection_for_user(request.user) - # Check the form - if form.is_valid(): - # And make a project instance - project = Project.objects.create( - name=form.cleaned_data['name'], - identifier=form.cleaned_data['identifier'], - description=form.cleaned_data['description'], - is_aggregate=form.cleaned_data['is_aggregate'], - owner=form.cleaned_data['group'] or request.user, - is_public=form.cleaned_data['is_public'], - registered_by=request.user) - return HttpResponseRedirect(project.get_absolute_url()) - else: - form = ProjectRegistrationForm() - # Render to template - template_name = "lava_projects/project_register_form.html" - t = loader.get_template(template_name) - c = RequestContext(request, { - 'form': form, - 'bread_crumb_trail': BreadCrumbTrail.leading_to(project_register), - }) - return HttpResponse(t.render(c)) - - -@BreadCrumb(_("Reconfigure"), - parent=project_detail, - needs=['project_identifier']) -@login_required -def project_update(request, identifier): - project = get_object_or_404( - Project.objects.accessible_by_principal(request.user), - identifier=identifier) - if not project.is_owned_by(request.user): - return HttpResponseForbidden("You cannot update this project") - if request.method == 'POST': - form = ProjectUpdateForm(request.POST, request.FILES) - form.restrict_group_selection_for_user(request.user) - if form.is_valid(): - project.name = form.cleaned_data['name'] - project.description = form.cleaned_data['description'] - project.is_aggregate = form.cleaned_data['is_aggregate'] - project.owner = form.cleaned_data['group'] or request.user - project.is_public = form.cleaned_data['is_public'] - project.save() - return HttpResponseRedirect(project.get_absolute_url()) - else: - form = ProjectUpdateForm(initial=dict( - name=project.name, - description=project.description, - is_aggregate=project.is_aggregate, - group=project.group, - is_public=project.is_public)) - template_name = "lava_projects/project_update_form.html" - t = loader.get_template(template_name) - c = RequestContext(request, { - 'form': form, - 'project': project, - 'bread_crumb_trail': BreadCrumbTrail.leading_to( - project_update, - project=project, - project_identifier=project.identifier)}) - return HttpResponse(t.render(c)) - - -@BreadCrumb(_("Change identifier"), - parent=project_update, - needs=['project_identifier']) -@login_required -def project_rename(request, identifier): - project = get_object_or_404( - Project.objects.accessible_by_principal(request.user), - identifier=identifier) - if not project.is_owned_by(request.user): - return HttpResponseForbidden("You cannot update this project") - if request.method == 'POST': - form = ProjectRenameForm(project, request.POST) - if form.is_valid(): - # Remove old entry if we are reusing our older identifier - ProjectFormerIdentifier.objects.filter( - former_identifier=form.cleaned_data['identifier'], - project=project.pk).delete() - # Record the change taking place - ProjectFormerIdentifier.objects.create( - project=project, - former_identifier=project.identifier, - renamed_by=request.user) - # And update the project - project.name = form.cleaned_data['name'] - project.identifier = form.cleaned_data['identifier'] - project.save() - return HttpResponseRedirect(project.get_absolute_url()) - else: - form = ProjectRenameForm( - project, initial={ - 'name': project.name, - 'identifier': project.identifier}) - template_name = "lava_projects/project_rename_form.html" - t = loader.get_template(template_name) - c = RequestContext(request, { - 'form': form, - 'project': project, - 'bread_crumb_trail': BreadCrumbTrail.leading_to( - project_rename, - project=project, - project_identifier=project.identifier)}) - return HttpResponse(t.render(c)) === modified file 'setup.py' --- setup.py 2012-04-17 14:47:01 +0000 +++ setup.py 2013-01-11 17:19:47 +0000 @@ -33,8 +33,6 @@ lava-server = lava_server.manage:main [lava_server.commands] manage=lava_server.manage:manage - [lava_server.extensions] - project=lava_projects.extension:ProjectExtension """, test_suite="lava_server.tests.run_tests", license="AGPL",