Changeset 23
- Timestamp:
- 11/19/08 10:25:06 (7 weeks ago)
- Location:
- gnrpy
- Files:
-
- 5 modified
-
gnr/app/gnrapp.py (modified) (1 diff)
-
gnr/core/docs/source/index.rst (modified) (2 diffs)
-
gnr/core/gnrstructures.py (modified) (5 diffs)
-
gnr/sql/gnrsql.py (modified) (2 diffs)
-
packages/adm/webpages/manage_users.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gnrpy/gnr/app/gnrapp.py
r11 r23 222 222 self.packagesIdByPath = {} 223 223 self.config = Bag(os.path.join(self.instanceFolder, 'instanceconfig.xml')) 224 225 224 if custom_config: 226 225 self.config.update(custom_config) -
gnrpy/gnr/core/docs/source/index.rst
r5 r23 12 12 13 13 tutorials/dependences 14 tutorials/bagdoc 14 tutorials/basicbag 15 16 15 17 16 18 Indices and tables … … 26 28 27 29 modules/gnrbag 30 modules/gnrstructures 31 -
gnrpy/gnr/core/gnrstructures.py
r1 r23 28 28 from gnr.core import gnrstring 29 29 30 30 31 class GnrStructData(Bag): 32 """ 33 is a subclass of Bag that implements functional syntax for adding 34 particular elements to the tree. 35 """ 31 36 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""" 35 42 if protocls: 36 43 instance=protocls() … … 58 65 59 66 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""" 66 77 where=self 67 78 childname=name … … 107 118 108 119 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 """ 111 125 self.toXml(path, typeattrs=False) 112 126 113 127 def load(self,path): 114 128 """This method loads the structure from an xml file 115 @param path: path of the file"""129 * `path`: path of the file""" 116 130 cls=self.__class__ 117 131 b = Bag() … … 121 135 122 136 class GnrStructObj(GnrObject): 137 """ 138 is a tree of GnrObjects that is auto-builded starting from an instance 139 of GnrStructData. 140 """ 123 141 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 """ 131 153 if isinstance(structnode, Bag): 132 154 structnode = structnode.getNode('#0') … … 136 158 makeRoot = classmethod(makeRoot) 137 159 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): 139 162 self.structnode = structnode 140 163 if objclassdict: -
gnrpy/gnr/sql/gnrsql.py
r7 r23 34 34 from gnr.core.gnrclasses import GnrClassCatalog 35 35 from gnr.sql.gnrsqlmodel import DbModel 36 from gnr.sql.gnrsql_exceptions import GnrSqlException,GnrSqlExecutionException,GnrSqlSaveChangesException 36 from gnr.sql.gnrsql_exceptions import GnrSqlException,GnrSqlExecutionException,\ 37 GnrSqlSaveChangesException 37 38 from gnr.sql.adapters import * 38 39 … … 262 263 return as_ 263 264 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) 266 270 267 271 def createDb(self, name, encoding='unicode'): -
gnrpy/packages/adm/webpages/manage_users.py
r1 r23 83 83 84 84 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) 98 99 99 100
