示例#1
0
 def data_retrieve(self):
     if self.stock:
         key = 's:%s' % self.basename
     else:
         key = 'u:%s' % self.basename
     data = datastore.get(key)
     if data:
         return json.loads(data)
     else:
         return None
示例#2
0
 def data_retrieve(self):
     if self.stock:
         key = 's:%s' % self.basename
     else:
         key = 'u:%s' % self.basename
     data = datastore.get(key)
     if data:
         return json.loads(data)
     else:
         return None
示例#3
0
def retrieve_plugin(unique_id, plugin=None):
    try:
        d = json.loads(datastore.get(unique_id))
    except TypeError:
        return None
    if plugin is None:
        mod = load_plugin_module(d['module_basename'], d['stock'])
        plugin = mod.Plugin()
    if plugin.__class__.__name__ != d['plugin_class']:
        raise ValueError("plugin of class %s expected" % d['plugin_class'])
    plugin.from_dict(d)
    return plugin
示例#4
0
def retrieve_plugin(unique_id, plugin=None):
    try:
        d = json.loads(datastore.get(unique_id))
    except TypeError:
        return None
    if plugin is None:
        mod = load_plugin_module(d['module_basename'], d['stock'])
        plugin = mod.Plugin()
    if plugin.__class__.__name__ != d['plugin_class']:
        raise ValueError("plugin of class %s expected" % d['plugin_class'])
    plugin.from_dict(d)
    return plugin
示例#5
0
def retrieve_association(association_id):
    try:
        return json.loads(datastore.get(association_id))
    except TypeError:
        return None
示例#6
0
def retrieve_plugin_data(unique_id):
    try:
        return json.loads(datastore.get(unique_id))
    except TypeError:
        return None
示例#7
0
def unstore_association(association_id, cascade=True):
    if cascade:
        li = json.loads(datastore.get(association_id))
        for x in li:
            datastore.remove(x)
    datastore.remove(association_id)
示例#8
0
def idf_installed_items(name):
    if not idf_exists(name):
        return None
    unique_id = _IDF_UNIQUE_ID_MAGIC + name
    return json.loads(datastore.get(unique_id))
示例#9
0
def idf_installed_items(name):
    if not idf_exists(name):
        return None
    unique_id = _IDF_UNIQUE_ID_MAGIC + name
    return json.loads(datastore.get(unique_id))
示例#10
0
def retrieve_association(association_id):
    try:
        return json.loads(datastore.get(association_id))
    except TypeError:
        return None
示例#11
0
def retrieve_plugin_data(unique_id):
    try:
        return json.loads(datastore.get(unique_id))
    except TypeError:
        return None
示例#12
0
def unstore_association(association_id, cascade=True):
    if cascade:
        li = json.loads(datastore.get(association_id))
        for x in li:
            datastore.remove(x)
    datastore.remove(association_id)