# set up the bundle
bundle = None
if action == 'create':
+ bundle_name = data['bundle_name'].strip()
+ if not bundle_name:
+ return ['No bundle name was specified']
+
bundle = Bundle(owner = user, project = project,
- name = data['bundle_name'])
+ name = bundle_name)
bundle.save()
context.add_message("Bundle %s created" % bundle.name)
for patch in patches:
if action == 'create' or action == 'add':
- try:
+ bundlepatch_count = BundlePatch.objects.filter(bundle = bundle,
+ patch = patch).count()
+ if bundlepatch_count == 0:
bundle.append_patch(patch)
context.add_message("Patch '%s' added to bundle %s" % \
(patch.name, bundle.name))
- except Exception, ex:
- context.add_message("Couldn't add patch '%s' to bundle: %s" % \
- (patch.name, ex.message))
+ else:
+ context.add_message("Patch '%s' already in bundle %s" % \
+ (patch.name, bundle.name))
elif action == 'remove':
try:
str = 'archived'
elif action == 'unarchive':
- patch.archived = True
+ patch.archived = False
patch.save()
str = 'un-archived'