@ensure_configuration
def save_design(request, save_form, query_form, type_, design, explicit_save=False):
 if (type_ == beeswax_models.RDBMS):
  design_cls = SQLdesign
 else:
  raise ValueError((_('Invalid design type %(type)s') % {'type': type_}))
 old_design = design
 design_obj = design_cls(query_form)
 new_data = design_obj.dumps()
 if explicit_save:
  design.name = save_form.cleaned_data['name']
  design.desc = save_form.cleaned_data['desc']
  design.is_auto = False
 elif (new_data != old_design.data):
  if (old_design.id is not None):
   design = old_design.clone()
   if (not old_design.is_auto):
    design.name = (old_design.name + beeswax_models.SavedQuery.AUTO_DESIGN_SUFFIX)
  else:
   design.name = beeswax_models.SavedQuery.DEFAULT_NEW_DESIGN_NAME
  design.is_auto = True
 design.name = design.name[:64]
 design.type = type_
 design.data = new_data
 design.save()
 LOG.info(('Saved %s design "%s" (id %s) for %s' % (((design.name and '') or 'auto '), design.name, design.id, design.owner)))
 if design.doc.exists():
  design.doc.update(name=design.name, description=design.desc)
 else:
  Document.objects.link(design, owner=design.owner, extra=design.type, name=design.name, description=design.desc)
 if design.is_auto:
  design.doc.get().add_to_history()
 return design

@ ensure_configuration def save_design ( request , save_form , query_form , type_ , design , explicit_save = False ) : if ( type_ == beeswax_models . RDBMS ) : design_cls = SQLdesign else : raise ValueError ( ( _ ( 'Invalid design type %(type)s' ) % { 'type' : type_ } ) ) old_design = design design_obj = design_cls ( query_form ) new_data = design_obj . dumps ( ) if explicit_save : design . name = save_form . cleaned_data [ 'name' ] design . desc = save_form . cleaned_data [ 'desc' ] design . is_auto = False elif ( new_data != old_design . data ) : if ( old_design . id is not None ) : design = old_design . clone ( ) if ( not old_design . is_auto ) : design . name = ( old_design . name + beeswax_models . SavedQuery . AUTO_DESIGN_SUFFIX ) else : design . name = beeswax_models . SavedQuery . DEFAULT_NEW_DESIGN_NAME design . is_auto = True design . name = design . name [ : 64 ] design . type = type_ design . data = new_data design . save ( ) LOG . info ( ( 'Saved %s design "%s" (id %s) for %s' % ( ( ( design . name and '' ) or 'auto ' ) , design . name , design . id , design . owner ) ) ) if design . doc . exists ( ) : design . doc . update ( name = design . name , description = design . desc ) else : Document . objects . link ( design , owner = design . owner , extra = design . type , name = design . name , description = design . desc ) if design . is_auto : design . doc . get ( ) . add_to_history ( ) return design
save_design -> savedquery a helper method to save the design: * if explicit_save .