Changeset 23

Show
Ignore:
Timestamp:
11/19/08 10:25:06 (7 weeks ago)
Author:
fporcari
Message:

varie da me

Location:
gnrpy
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • gnrpy/gnr/app/gnrapp.py

    r11 r23  
    222222        self.packagesIdByPath = {} 
    223223        self.config = Bag(os.path.join(self.instanceFolder, 'instanceconfig.xml')) 
    224          
    225224        if custom_config: 
    226225            self.config.update(custom_config) 
  • gnrpy/gnr/core/docs/source/index.rst

    r5 r23  
    1212 
    1313    tutorials/dependences 
    14     tutorials/bagdoc 
     14    tutorials/basicbag 
     15 
     16 
    1517 
    1618Indices and tables 
     
    2628 
    2729    modules/gnrbag 
     30    modules/gnrstructures 
     31 
  • gnrpy/gnr/core/gnrstructures.py

    r1 r23  
    2828from gnr.core import gnrstring 
    2929 
     30 
    3031class GnrStructData(Bag): 
     32    """ 
     33    is a subclass of Bag that implements functional syntax for adding  
     34    particular elements to the tree. 
     35    """ 
    3136    def makeRoot(cls, source=None,protocls=None): 
    32         """This method builds the root instance for the given class. 
    33         @param cls: structure class 
    34         @param source: filepath of xml file""" 
     37        """ 
     38        This method builds the root instance for the given class. 
     39         
     40        * `cls`: structure class 
     41        * `source`: filepath of xml file""" 
    3542        if protocls: 
    3643            instance=protocls() 
     
    5865         
    5966    def child(self, tag, name='*_#', content=None, _parentTag=None, **kwargs): 
    60         """This method sets a new item of the type tag into the current structure 
    61         @param tag: structure type 
    62         @param name: structure name. Default value is formed by 'tag_position' 
    63         @param content: optional structure content 
    64         @param kwargs: other parameters 
    65         @return : the new structure if content is none else the parent""" 
     67        """ 
     68         
     69        This method sets a new item of the type tag into the current structure 
     70         
     71        * `tag`: structure type 
     72        * `name`: structure name. Default value is formed by 'tag_position' 
     73        * `content`: optional structure content 
     74        * `kwargs`: other parameters 
     75         
     76        Return : the new structure if content is none else the parent""" 
    6677        where=self 
    6778        childname=name 
     
    107118     
    108119    def save(self,path): 
    109         """This method saves the structure as an xml file 
    110         @param path: destination of the saved file""" 
     120        """ 
     121        This method saves the structure as an xml file 
     122         
     123        * `path`: destination of the saved file 
     124        """ 
    111125        self.toXml(path, typeattrs=False) 
    112126         
    113127    def load(self,path): 
    114128        """This method loads the structure from an xml file 
    115         @param path: path of the file""" 
     129        * `path`: path of the file""" 
    116130        cls=self.__class__ 
    117131        b = Bag() 
     
    121135 
    122136class GnrStructObj(GnrObject): 
     137    """ 
     138    is a tree of GnrObjects that is auto-builded starting from an instance  
     139    of GnrStructData.  
     140    """ 
    123141    def makeRoot(cls, parent , structnode, objclassdict, **kwargs): 
    124         """This class method instatiates the first element (root) 
    125         @param cls: 
    126         @param parent: 
    127         @param structnode 
    128         @param objclassdict: dictionary of the classes 
    129         @param kwargs: 
    130         return""" 
     142        """ 
     143        This class method instatiates the first element (root) 
     144         
     145        * `cls` 
     146        * `parent` 
     147        * `structnode` 
     148        * `objclassdict``: dictionary of the classes 
     149        * `kwargs` 
     150         
     151        return 
     152        """ 
    131153        if isinstance(structnode, Bag): 
    132154            structnode = structnode.getNode('#0') 
     
    136158    makeRoot = classmethod(makeRoot) 
    137159     
    138     def __init__(self, tag=None, structnode=None, parent=None, name=None, attrs=None, children=None, objclassdict=None, **kwargs): 
     160    def __init__(self, tag=None, structnode=None, parent=None, name=None,  
     161                attrs=None, children=None, objclassdict=None, **kwargs): 
    139162        self.structnode = structnode 
    140163        if objclassdict: 
  • gnrpy/gnr/sql/gnrsql.py

    r7 r23  
    3434from gnr.core.gnrclasses import GnrClassCatalog 
    3535from gnr.sql.gnrsqlmodel import DbModel 
    36 from gnr.sql.gnrsql_exceptions import GnrSqlException,GnrSqlExecutionException,GnrSqlSaveChangesException 
     36from gnr.sql.gnrsql_exceptions import GnrSqlException,GnrSqlExecutionException,\ 
     37                                      GnrSqlSaveChangesException 
    3738from gnr.sql.adapters import * 
    3839 
     
    262263        return as_ 
    263264         
    264     def relationExplorer(self, table, prevCaption='', prevRelation='', transaltor=None, **kwargs): 
    265         return self.table(table).relationExplorer(prevCaption=prevCaption, prevRelation=prevRelation, transaltor=transaltor, **kwargs) 
     265    def relationExplorer(self, table, prevCaption='', prevRelation='', 
     266                        transaltor=None, **kwargs): 
     267        return self.table(table).relationExplorer(prevCaption=prevCaption,  
     268                                                  prevRelation=prevRelation, 
     269                                                  transaltor=transaltor, **kwargs) 
    266270         
    267271    def createDb(self, name, encoding='unicode'): 
  • gnrpy/packages/adm/webpages/manage_users.py

    r1 r23  
    8383     
    8484    def onSaving(self, data): 
    85         li = [] 
    86         data['#0'].pop('tag_bag_removed') 
    87         tags = data['#0'].popNode('tag_bag') 
    88         oldtags = tags.getAttr('oldValue') 
    89         tags = tags.value 
    90         if tags: 
    91             for node in tags: 
    92                 tag = node.getAttr('tagname') 
    93                 li.append(tag) 
    94             tags = ','.join(li) 
    95         else: 
    96             tags = '' 
    97         data.setItem('#0.auth_tags', tags,oldValue=oldtags) 
     85        if data['record.tag_bag']: 
     86            li = [] 
     87            data['#0'].pop('tag_bag_removed') 
     88            tags = data['record'].popNode('tag_bag') 
     89            oldtags = tags.getAttr('oldValue') 
     90            tags = tags.value 
     91            if tags: 
     92                for node in tags: 
     93                    tag = node.getAttr('tagname') 
     94                    li.append(tag) 
     95                    tags = ','.join(li) 
     96                else: 
     97                    tags = '' 
     98            data.setItem('#0.auth_tags', tags, oldValue=oldtags) 
    9899             
    99100