Пример #1
0
 def saving(self, xfer):
     uploadlogo = xfer.getparam('uploadlogo')
     if uploadlogo is not None:
         tmp_file = save_from_base64(uploadlogo)
         with open(tmp_file, "rb") as image_tmp:
             image = open_image_resize(image_tmp, 100, 100)
             image = image.convert("RGB")
             img_path = get_user_path("contacts", "Image_%s.jpg" % self.item.abstractcontact_ptr_id)
             with open(img_path, "wb") as image_file:
                 image.save(image_file, 'JPEG', quality=90)
         unlink(tmp_file)
     LucteriosEditor.saving(self, xfer)
     self.item.set_custom_values(xfer.params)
Пример #2
0
 def saving(self, xfer):
     uploadlogo = xfer.getparam('uploadlogo')
     if uploadlogo is not None:
         tmp_file = save_from_base64(uploadlogo)
         with open(tmp_file, "rb") as image_tmp:
             image = open_image_resize(image_tmp, 100, 100)
             image = image.convert("RGB")
             img_path = get_user_path("contacts", "Image_%s.jpg" % self.item.abstractcontact_ptr_id)
             with open(img_path, "wb") as image_file:
                 image.save(image_file, 'JPEG', quality=90)
         unlink(tmp_file)
     LucteriosEditor.saving(self, xfer)
     self.item.set_custom_values(xfer.params)
Пример #3
0
 def saving(self, xfer):
     args = {}
     for arg_name in ['min', 'max', 'prec', 'list', 'multi']:
         args_val = xfer.getparam('args_' + arg_name)
         if args_val is not None:
             if arg_name == 'list':
                 args[arg_name] = list(args_val.split(","))
             elif arg_name == 'multi':
                 args[arg_name] = (args_val != 'False') and (args_val != '0') and (args_val != '') and (args_val != 'n')
             else:
                 args[arg_name] = float(args_val)
     self.item.args = six.text_type(args)
     LucteriosEditor.saving(self, xfer)
     self.item.save()
Пример #4
0
 def saving(self, xfer):
     args = {}
     for arg_name in ['min', 'max', 'prec', 'list', 'multi']:
         args_val = xfer.getparam('args_' + arg_name)
         if args_val is not None:
             if arg_name == 'list':
                 args[arg_name] = list(args_val.split(","))
             elif arg_name == 'multi':
                 args[arg_name] = (args_val != 'False') and (args_val != '0') and (args_val != '') and (args_val != 'n')
             else:
                 args[arg_name] = float(args_val)
     self.item.args = six.text_type(args)
     LucteriosEditor.saving(self, xfer)
     self.item.save()