George Notaras avatar George Notaras committed bde8304

Cleaned-up cloning action.

Comments (0)

Files changed (1)

src/powerdns_manager/actions.py

         form = ClonedZoneDomainForm(request.POST)
         if form.is_valid():
             
+            # Store the new domain name for the clone.
             clone_domain_name = form.cleaned_data['clone_domain_name']
             
             if not clone_domain_name:
                 # Construct RR name with interchanged domain
                 clone_rr_name = interchange_domain(rr.name, domain_obj.name, clone_domain_name)
                 
-                # Special treatment to the content of SOA and SRV
+                # Special treatment to the content of SOA and SRV RRs
                 if rr.type == 'SOA':
                     content_parts = rr.content.split()
                     # primary
                 else:
                     clone_rr_content = interchange_domain(rr.content, domain_obj.name, clone_domain_name)
                 
+                # Create and save the cloned record.
                 clone_rr = Record(
                     domain = clone_obj,
                     name = clone_rr_name,
                 clone_rr.save()
                 modeladmin.log_addition(request, clone_rr)
             
-            # Update the domain serial
-            #domain_obj.update_serial()
-            
             messages.info(request, 'Successfully cloned %s zone to %s' % \
                 (domain_obj.name, clone_domain_name))
             
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.