Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __fixup_param(name, klass, options, param):
optional = 'optional' in options
default = [x[1] for x in options if isinstance(x, tuple) and x[0] == 'default']
if default:
default = default[0]
else:
default = None
if param is None:
if klass is list and default:
param = default[:]
else:
param = default
if klass is json and isinstance(param, (list, dict)):
param = simplejson.dumps(param)
return param
def save(self, *args, **kwargs):
if self.name == 'Untitled':
models.Model.save(self, *args, **kwargs) # save to set self.id
self.name = 'Sheet %d' % (self.id,)
self.column_widths_json = jsonlib.dumps(self.column_widths)
models.Model.save(self, *args, **kwargs)