diff apps/bundle/tasks.py @ 177:86129d185ddb

Add versioning to bundles Some other bundle-related changes were made, including: * Editing the snippetform CSS and HTML to allow bundle/form.djhtml to be reused for editing * Changing {% block title %} to {% block section %} in the base template for bundles to allow for more flexibility when creating breadcrumbs * Saved common URL patterns in variables in bundle/urls.py * Renamed explore.html to explore.djhtml for consistency You should now be able to upload new versions as well as view the files (or a particular file) for a bundle at a specific version. Coming soon: the ability to add a timestamp and a comment for each new uploaded version (if this feature is desirable).
author dellsystem <ilostwaldo@gmail.com>
date Sat, 20 Oct 2012 23:28:50 -0400
parents a05e547449de
children 76abe6d681ea
line wrap: on
line diff
--- a/apps/bundle/tasks.py	Sat Oct 20 19:24:09 2012 -0400
+++ b/apps/bundle/tasks.py	Sat Oct 20 23:28:50 2012 -0400
@@ -30,7 +30,8 @@
         filename = os.path.basename(file_path)
         full_path = file_path[len(bundle.get_temp_path()) + 1:]
         bundle_file = BundleFile(bundle=bundle, name=filename,
-            parent=parent_dir, full_path=full_path)
+            parent=parent_dir, full_path=full_path,
+            version=bundle.latest_version)
 
         if file_path in files:
             bundle_file.is_dir = False
@@ -79,7 +80,8 @@
     elif mime_type.startswith('text/'):
         # Should be a plain text file - create a CodeFile for it
         bundle_file = BundleFile(bundle=bundle, name=bundle.file_name,
-            full_path=bundle.file_name, file_size=os.path.getsize(file))
+            full_path=bundle.file_name, file_size=os.path.getsize(file),
+            version=bundle.latest_version)
         bundle_file.save_file_contents(open(file, 'rt'),
             original_filename=bundle.file_name)