From 3061d1c9515cd44ecc79f95c57b268564a481ccf Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 6 Nov 2013 20:56:15 -0600 Subject: Django 1.6 upgrade, deprecation cleanup PendingDeprecationWarning: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is deprecated - form needs updating Signed-off-by: Dan McGee --- mirrors/admin.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mirrors') diff --git a/mirrors/admin.py b/mirrors/admin.py index d0f2f475..e35d9ce7 100644 --- a/mirrors/admin.py +++ b/mirrors/admin.py @@ -10,6 +10,7 @@ class MirrorUrlForm(forms.ModelForm): class Meta: model = MirrorUrl + fields = ('url', 'country', 'active') def clean_url(self): # is this a valid-looking URL? @@ -39,6 +40,7 @@ class MirrorUrlInlineAdmin(admin.TabularInline): class MirrorRsyncForm(forms.ModelForm): class Meta: model = MirrorRsync + fields = ('ip',) class MirrorRsyncInlineAdmin(admin.TabularInline): @@ -50,6 +52,10 @@ class MirrorRsyncInlineAdmin(admin.TabularInline): class MirrorAdminForm(forms.ModelForm): class Meta: model = Mirror + fields = ('name', 'tier', 'upstream', 'admin_email', 'alternate_email', + 'public', 'active', 'isos', 'rsync_user', 'rsync_password', + 'notes') + upstream = forms.ModelChoiceField( queryset=Mirror.objects.filter(tier__gte=0, tier__lte=1), required=False) -- cgit v1.2.3-54-g00ecf From ee6002c911952ddc8cfd07fded3de2c9b0193dc6 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 6 Nov 2013 21:17:27 -0600 Subject: Django 1.6 upgrade, deprecation cleanup PendingDeprecationWarning: commit_on_success is deprecated in favor of atomic. Signed-off-by: Dan McGee --- devel/management/commands/pgp_import.py | 4 ++-- devel/management/commands/rematch_developers.py | 4 ++-- devel/management/commands/reporead.py | 10 +++++----- devel/management/commands/reporead_inotify.py | 2 +- devel/views.py | 4 ++-- mirrors/management/commands/mirrorcheck.py | 2 +- packages/views/flag.py | 2 +- packages/views/signoff.py | 2 +- todolists/views.py | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) (limited to 'mirrors') diff --git a/devel/management/commands/pgp_import.py b/devel/management/commands/pgp_import.py index faa9ff5e..3f557fe9 100644 --- a/devel/management/commands/pgp_import.py +++ b/devel/management/commands/pgp_import.py @@ -134,7 +134,7 @@ def import_keys(keyring): logger.info("creating or finding %d keys", len(keydata)) created_ct = updated_ct = 0 - with transaction.commit_on_success(): + with transaction.atomic(): finder = UserFinder() # we are dependent on parents coming before children; parse_keydata # uses an OrderedDict to ensure this is the case. @@ -232,7 +232,7 @@ def import_signatures(keyring): logger.info("creating or finding up to %d signatures", len(pruned_edges)) created_ct = updated_ct = 0 - with transaction.commit_on_success(): + with transaction.atomic(): for edge in pruned_edges: sig, created = PGPSignature.objects.get_or_create( signer=edge.signer, signee=edge.signee, diff --git a/devel/management/commands/rematch_developers.py b/devel/management/commands/rematch_developers.py index 2b379588..7a06e084 100644 --- a/devel/management/commands/rematch_developers.py +++ b/devel/management/commands/rematch_developers.py @@ -44,7 +44,7 @@ def handle_noargs(self, **options): match_packager(finder) match_flagrequest(finder) -@transaction.commit_on_success +@transaction.atomic def match_packager(finder): logger.info("getting all unmatched packager strings") package_count = matched_count = 0 @@ -70,7 +70,7 @@ def match_packager(finder): package_count, matched_count) -@transaction.commit_on_success +@transaction.atomic def match_flagrequest(finder): logger.info("getting all flag request email addresses from unknown users") req_count = matched_count = 0 diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py index ff7a8427..19d54e1e 100644 --- a/devel/management/commands/reporead.py +++ b/devel/management/commands/reporead.py @@ -302,7 +302,7 @@ def update_common(archname, reponame, pkgs, sanity_check=True): # If isolation level is repeatable-read, we need to ensure each package # update starts a new transaction and re-queries the database as # necessary to guard against simultaneous updates. - with transaction.commit_on_success(): + with transaction.atomic(): # force the transaction dirty, even though we will only do reads transaction.set_dirty() @@ -365,7 +365,7 @@ def db_update(archname, reponame, pkgs, force=False): dbpkg = Package(pkgname=pkg.name, arch=architecture, repo=repository, created=timestamp) try: - with transaction.commit_on_success(): + with transaction.atomic(): populate_pkg(dbpkg, pkg, timestamp=timestamp) Update.objects.log_update(None, dbpkg) except IntegrityError: @@ -380,7 +380,7 @@ def db_update(archname, reponame, pkgs, force=False): for pkgname in (dbset - syncset): logger.info("Removing package %s", pkgname) dbpkg = dbdict[pkgname] - with transaction.commit_on_success(): + with transaction.atomic(): Update.objects.log_update(dbpkg, None) # no race condition here as long as simultaneous threads both # issue deletes; second delete will be a no-op @@ -403,7 +403,7 @@ def db_update(archname, reponame, pkgs, force=False): # The odd select_for_update song and dance here are to ensure # simultaneous updates don't happen on a package, causing # files/depends/all related items to be double-imported. - with transaction.commit_on_success(): + with transaction.atomic(): dbpkg = Package.objects.select_for_update().get(id=dbpkg.id) if not force and pkg_same_version(pkg, dbpkg): logger.debug("Package %s was already updated", pkg.name) @@ -431,7 +431,7 @@ def filesonly_update(archname, reponame, pkgs, force=False): # The odd select_for_update song and dance here are to ensure # simultaneous updates don't happen on a package, causing # files to be double-imported. - with transaction.commit_on_success(): + with transaction.atomic(): if not dbpkg.files_last_update or not dbpkg.last_update: pass elif not force and dbpkg.files_last_update >= dbpkg.last_update: diff --git a/devel/management/commands/reporead_inotify.py b/devel/management/commands/reporead_inotify.py index 6aa4e0e0..e3c720bc 100644 --- a/devel/management/commands/reporead_inotify.py +++ b/devel/management/commands/reporead_inotify.py @@ -66,7 +66,7 @@ def handle(self, path_template=None, **options): if hasattr(thread, 'cancel'): thread.cancel() - @transaction.commit_on_success + @transaction.atomic def setup_notifier(self): '''Set up and configure the inotify machinery and logic. This takes the provided or default path_template and builds a list of diff --git a/devel/views.py b/devel/views.py index 378d6d57..fe7fdf8c 100644 --- a/devel/views.py +++ b/devel/views.py @@ -166,7 +166,7 @@ def change_profile(request): request.user.email = form.cleaned_data['email'] if form.cleaned_data['passwd1']: request.user.set_password(form.cleaned_data['passwd1']) - with transaction.commit_on_success(): + with transaction.atomic(): request.user.save() profile_form.save() return HttpResponseRedirect('/devel/') @@ -334,7 +334,7 @@ def new_user_form(request): if request.POST: form = NewUserForm(request.POST) if form.is_valid(): - with transaction.commit_on_success(): + with transaction.atomic(): form.save() log_addition(request, form.instance.user) return HttpResponseRedirect('/admin/auth/user/%d/' % \ diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py index 3f026c36..e48aa42e 100644 --- a/mirrors/management/commands/mirrorcheck.py +++ b/mirrors/management/commands/mirrorcheck.py @@ -241,7 +241,7 @@ def __init__(self, urls, location, timeout=10, num_threads=10): thread.daemon = True self.threads.append(thread) - @transaction.commit_on_success + @transaction.atomic def run(self): logger.debug("starting threads") for thread in self.threads: diff --git a/packages/views/flag.py b/packages/views/flag.py index 39cdcef8..9fe60e2c 100644 --- a/packages/views/flag.py +++ b/packages/views/flag.py @@ -84,7 +84,7 @@ def flag(request, name, repo, arch): else: email = form.cleaned_data['email'] - @transaction.commit_on_success + @transaction.atomic def perform_updates(): current_time = now() pkgs.update(flag_date=current_time) diff --git a/packages/views/signoff.py b/packages/views/signoff.py index c37aa0fc..fcc6de45 100644 --- a/packages/views/signoff.py +++ b/packages/views/signoff.py @@ -81,7 +81,7 @@ class Meta: def _signoff_options_all(request, name, repo): seen_ids = set() - with transaction.commit_on_success(): + with transaction.atomic(): # find or create a specification for all architectures, then # graft the form data onto them packages = Package.objects.filter(pkgbase=name, diff --git a/todolists/views.py b/todolists/views.py index ff75686d..c37c13f5 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -147,7 +147,7 @@ class DeleteTodolist(DeleteView): success_url = '/todo/' -@transaction.commit_on_success +@transaction.atomic def create_todolist_packages(form, creator=None): package_names = form.package_names() packages = form.packages() -- cgit v1.2.3-54-g00ecf