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