Ejemplo n.º 1
0
def manage_addNyGadflyContainer(self, id='.container', REQUEST=None, **kwargs):
    """ """
    ob = NyGadflyContainer(id)
    self._setObject(id, ob)
    ob = self._getOb(id)
    manage_addZGadflyConnection(ob, id=CONNECTION_ID, title='', 
                                connection='demo', check=True)
    ob._init_table(**kwargs)
    if REQUEST is not None:
        return self.manage_main(self, REQUEST, update_menu=1)
    return ob
Ejemplo n.º 2
0
def manage_addNyGadflyContainer(self, id='.container', REQUEST=None, **kwargs):
    """ """
    ob = NyGadflyContainer(id)
    self._setObject(id, ob)
    ob = self._getOb(id)
    manage_addZGadflyConnection(ob,
                                id=CONNECTION_ID,
                                title='',
                                connection='demo',
                                check=True)
    ob._init_table(**kwargs)
    if REQUEST is not None:
        return self.manage_main(self, REQUEST, update_menu=1)
    return ob
Ejemplo n.º 3
0
def manage_addNyGadflyContainer(self, id='.container', REQUEST=None, **kwargs):
    """ """
    ob = NyGadflyContainer(id)
    self._setObject(id, ob)
    ob = self._getOb(id)
    
    # Avoid crashing if gadfly is not initialized
    dir=os.path.join(data_dir, CONNECTION_STRING)
    if not os.path.isdir(dir):
        try:
            os.makedirs(dir)
        except OSError, error:
            LOG(LOG_KEY, ERROR, error)
            raise
    # Add gadfly connection
    manage_addZGadflyConnection(ob, id=CONNECTION_ID, title='', 
                                connection=CONNECTION_STRING, check=True)
    ob._init_table(**kwargs)
    if REQUEST is not None:
        return self.manage_main(self, REQUEST, update_menu=1)
    return ob

class NyGadflyContainer(Folder):
    """ Class that implements the Naaya Gadfly Container.
    
    >>> ob = NyGadflyContainer()
    >>> ob._init_table(page='VARCHAR', hits='FLOAT')
    >>> ob.add(hits=0, page='path/to/mypage')
    >>> ob.get(hits, page='path/to/mypage')
    [{'HITS': 0}]
    >>> ob.get(hits=0)
    [{'HITS': 0, 'PAGE': 'path/to/mypage'}]
Ejemplo n.º 4
0
    ob = NyGadflyContainer(id)
    self._setObject(id, ob)
    ob = self._getOb(id)

    # Avoid crashing if gadfly is not initialized
    dir = os.path.join(data_dir, CONNECTION_STRING)
    if not os.path.isdir(dir):
        try:
            os.makedirs(dir)
        except OSError, error:
            LOG(LOG_KEY, ERROR, error)
            raise
    # Add gadfly connection
    manage_addZGadflyConnection(ob,
                                id=CONNECTION_ID,
                                title='',
                                connection=CONNECTION_STRING,
                                check=True)
    ob._init_table(**kwargs)
    if REQUEST is not None:
        return self.manage_main(self, REQUEST, update_menu=1)
    return ob


class NyGadflyContainer(Folder):
    """ Class that implements the Naaya Gadfly Container.
    
    >>> ob = NyGadflyContainer()
    >>> ob._init_table(page='VARCHAR', hits='FLOAT')
    >>> ob.add(hits=0, page='path/to/mypage')
    >>> ob.get(hits, page='path/to/mypage')