Skip to content

Instantly share code, notes, and snippets.

@jirihnidek
Last active December 23, 2015 12:19
Show Gist options
  • Save jirihnidek/6634901 to your computer and use it in GitHub Desktop.
Save jirihnidek/6634901 to your computer and use it in GitHub Desktop.
Subclassing of VerseNode and VerseTag
import vrsent as v
class CustomNode(v.VerseNode):
"""
Custom subclass of VeseNode
"""
custom_type = 10
def __str__(self):
"""
Custrom string representation
"""
return 'CustomNode, id' + str(self.id)
@classmethod
def _receive_node_create(cls, session, node_id, parent_id, user_id, custom_type):
"""
Custom callback method
"""
print('Custom create callback method')
return super(CustomNode, cls)._receive_node_create(session, node_id, \
parent_id, user_id, custom_type)
s = v.VerseSession(hostname='localhost', service='12344', \
callback_thread=True, username='your_name', password='your_pass')
n = v.VerseNode(s, custom_type=10)
print(n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment