Author: ArcRiley Date: 2009-03-04 03:04:14 -0500 (Wed, 04 Mar 2009) New Revision: 1548
Modified: trunk/concordance/examples/echo.py trunk/concordance/examples/register.py trunk/concordance/src/__init__.py Log: copied concordance._core.step to concordance.step, updated examples Modified: trunk/concordance/examples/echo.py =================================================================== --- trunk/concordance/examples/echo.py 2009-03-04 06:25:26 UTC (rev 1547) +++ trunk/concordance/examples/echo.py 2009-03-04 08:04:14 UTC (rev 1548) @@ -38,4 +38,4 @@ client[host] = EchoService(host) while True : - concordance._core.step() + concordance.step() Modified: trunk/concordance/examples/register.py =================================================================== --- trunk/concordance/examples/register.py 2009-03-04 06:25:26 UTC (rev 1547) +++ trunk/concordance/examples/register.py 2009-03-04 08:04:14 UTC (rev 1548) @@ -27,6 +27,8 @@ import concordance import xml.etree.cElementTree as ElementTree +host = 'selket.apogean.org' + #All the Users are stored in a Dictionary/Hash(in-memory) in a session #they are NOT (de)serialized UserDB = {} @@ -43,7 +45,7 @@ self.pwd = pwd #Mothers Maiden Name can also be added -class InBandRegistration(concordance.Core) : +class InBandRegistration(concordance.services.Service) : def createNode(self, parent_node,tag_name, tag_val): ''' Method that creates a node given its name and value; @@ -248,15 +250,11 @@ pass - def clientHandle(self, session, message) : + def xml(self, in_root) : ''' this method keeps waiting for a message and dispatches it to the suitabe method after filtering ''' - # get xml root of input - print("C: %s" % message) - in_root = ElementTree.fromstring(message) - # this example only replies to <iq/> requests if in_root.tag != '{jabber:client}iq' : return "" @@ -274,9 +272,14 @@ else : return "" - print("S: %s" % ElementTree.tostring(out_root)) + print('< %s' % ElementTree.tostring(in_root)) + print('> %s' % ElementTree.tostring(out_root)) return ElementTree.tostring(out_root) -#clientHandle just waits for any events from the client/entity -regcore=InBandRegistration() -regcore() + +client = concordance.sockets.Client() +client[host] = InBandRegistration(host) + + +while True : + concordance.step() Modified: trunk/concordance/src/__init__.py =================================================================== --- trunk/concordance/src/__init__.py 2009-03-04 06:25:26 UTC (rev 1547) +++ trunk/concordance/src/__init__.py 2009-03-04 08:04:14 UTC (rev 1548) @@ -25,5 +25,6 @@ from concordance import _core # Workaround for setuptools from concordance import services from concordance import sockets +step = _core.step #del(_core) # Clean up namespace _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn