Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #5
0
def retrieve_association(association_id):
    try:
        return json.loads(datastore.get(association_id))
    except TypeError:
        return None
Beispiel #6
0
def retrieve_plugin_data(unique_id):
    try:
        return json.loads(datastore.get(unique_id))
    except TypeError:
        return None
Beispiel #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)
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))
Beispiel #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))
Beispiel #10
0
def retrieve_association(association_id):
    try:
        return json.loads(datastore.get(association_id))
    except TypeError:
        return None
Beispiel #11
0
def retrieve_plugin_data(unique_id):
    try:
        return json.loads(datastore.get(unique_id))
    except TypeError:
        return None
Beispiel #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)