Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, **kwargs):
if "tiid" in kwargs:
self.tiid = kwargs["tiid"]
else:
shortuuid.set_alphabet('abcdefghijklmnopqrstuvwxyz1234567890')
self.tiid = shortuuid.uuid()[0:24]
now = datetime.datetime.utcnow()
if "created" not in kwargs:
self.created = now
if "last_modified" not in kwargs:
self.last_modified = now
if "last_update_run" not in kwargs:
self.last_update_run = now
super(Product, self).__init__(**kwargs)
def __init__(self, **kwargs):
if not "refset_id" in kwargs:
shortuuid.set_alphabet('abcdefghijklmnopqrstuvwxyz1234567890')
self.refset_id = shortuuid.uuid()[0:24]
if not "created" in kwargs:
self.created = datetime.datetime.utcnow()
super(ReferenceSetList, self).__init__(**kwargs)
def make(collection_id=None):
shortuuid.set_alphabet('abcdefghijklmnopqrstuvwxyz1234567890')
key = shortuuid.uuid()[0:10]
if collection_id is None:
collection_id = _make_id()
now = datetime.datetime.utcnow().isoformat()
collection = {}
collection["_id"] = collection_id
collection["created"] = now
collection["last_modified"] = now
collection["type"] = "collection"
collection["owner"] = None
collection["key"] = key # using the hash was needless complexity...
return collection, key
def filter(self, qs, value):
if value:
shortuuid.set_alphabet('23456789abcdefghjkmnpqrstuvwxyz')
value = shortuuid.decode(value)
return super(ObjectIDFilter, self).filter(qs, value)
import random
import string
from datetime import timedelta, datetime
import pytz
import shortuuid
shortuuid.set_alphabet(string.ascii_uppercase + string.digits)
def get_random_string(length):
# 0123456789ABCDEFGHJKLMNPQRSTUVWXYZ
return ''.join([random.choice(string.ascii_uppercase + string.digits)
for n in range(length)])
def get_uuid(length):
return shortuuid.uuid()[:length]
def format_url(url):
return url
def generate_pairing_code():
shortuuid.set_alphabet("0123456789ABCDEF")
return shortuuid.random(length=6)
def make():
now = datetime.datetime.utcnow().isoformat()
shortuuid.set_alphabet('abcdefghijklmnopqrstuvwxyz1234567890')
item = {}
item["_id"] = shortuuid.uuid()[0:24]
item["aliases"] = {}
item["biblio"] = {}
item["last_modified"] = now
item["created"] = now
item["type"] = "item"
return item
def make():
now = datetime.datetime.utcnow().isoformat()
shortuuid.set_alphabet('abcdefghijklmnopqrstuvwxyz1234567890')
item = {}
item["_id"] = shortuuid.uuid()[0:24]
item["aliases"] = {}
item["biblio"] = {}
item["last_modified"] = now
item["created"] = now
item["type"] = "item"
return item
def __init__(self, **kwargs):
# logger.debug(u"new Item {kwargs}".format(
# kwargs=kwargs))
if "tiid" in kwargs:
self.tiid = kwargs["tiid"]
else:
shortuuid.set_alphabet('abcdefghijklmnopqrstuvwxyz1234567890')
self.tiid = shortuuid.uuid()[0:24]
now = datetime.datetime.utcnow()
if "created" in kwargs:
self.created = kwargs["created"]
else:
self.created = now
if "last_modified" in kwargs:
self.last_modified = kwargs["last_modified"]
else:
self.last_modified = now
if "last_update_run" in kwargs:
self.last_update_run = kwargs["last_update_run"]
else:
self.last_update_run = now