1.1.2.16. The gnr.core.gnrstructures structures

Last page update: November 23, 2011

Classes:

Complete reference:

1.1.2.16.3. TestStructModule

1.1.2.16.4. gnr.core.gnrstructures - The complete reference list

synopsis:Structs – an alternative attribute-oriented way to build Bags.
class gnr.core.gnrstructures.GnrStructData(source=None, **kwargs)

This is a subclass of the Bag class that implements functional syntax for adding particular elements to the tree

backwardNodebyAttr(attrname, checker=None)

TODO

Parameters:
  • attrname – TODO
  • checker – TODO
child(tag, childname='*_#', childcontent=None, content=None, _parentTag=None, _attributes=None, _returnStruct=True, _position=None, **kwargs)

Set a new item of the tag type into the current structure. Return the new structure if content is None, else the parent

Parameters:
  • tag – structure type
  • name – structure name
  • content – optional structure content
  • _parentTag – TODO
  • _attributes – TODO
  • childname – the childname
load(path)

Loads the structure from an XML file

Parameters:path – path of the file to load
classmethod makeRoot(source=None, protocls=None)

Build the root instance for the given class and return it

Parameters:
  • source – the filepath of the xml file
  • protocls – the structure class
save(path)

Saves the structure as an XML file

Parameters:path – destination path of the saved file
class gnr.core.gnrstructures.GnrStructObj(tag=None, structnode=None, parent=None, name=None, attrs=None, children=None, objclassdict=None, **kwargs)

It is a tree of GnrObjects classes that it is auto-builded starting from an instance of the GnrStructData class

afterChildrenCreation()

TODO

asBag()

TODO

buildChild(childnode, **kwargs)

Build a child

Parameters:childnode – the child node
buildChildren(children)

TODO

Parameters:children – TODO
deleteChild(name)

Delete a child

Parameters:name – the child name
deleteChildren()

TODO

get(name, default=None)

Build a child

Parameters:
  • name – TODO
  • default – TODO
getById(id)

TODO

Parameters:id – the id of the object
getItem(path, default=None, static=False)

Build a child

Parameters:
  • path – TODO
  • default – TODO
  • static – TODO
getResolver(name, default=None)

Build a child

Parameters:
  • name – TODO
  • default – TODO
init()

TODO

items()

Same of items method’s dict, applied on the children attribute

keys()

Same of keys method’s dict, applied on the children attribute

classmethod makeRoot(parent, structnode, objclassdict, **kwargs)

Instantiate the root element

Parameters:
  • cls – TODO
  • parent – TODO
  • structnode – TODO
  • objclassdict – dictionary of the classes
newChild(child)

TODO

Parameters:child – TODO
onDelete()

Hook method on delete action

values()

Same of values method’s dict, applied on the children attribute

class gnr.core.gnrstructures.TestStructModule

TODO

buildOne(name, path)

TODO

Parameters:
  • name – TODO
  • path – TODO