ZSI Notes
Revision as of 10:21, 23 May 2008 by PeterHarding (talk | contribs)
alphabetical order of 'self.attribute_typecode_dict'
This should be irrelevant, although order is important for canonicalization for an entirely different matter.
I think you could retain your ordering by replacing the underlying dict with your own dict subclass that maintains a list too.
Topic._attrs = OrderDict()
Something like Collection, although obviously this is a bit old.
from ZSI.wstools.Utility import Collection class Collection(UserDict): """Helper class for maintaining ordered named collections.""" default = lambda self,k: k.name def __init__(self, parent, key=None): UserDict.__init__(self) self.parent = weakref.ref(parent) self.list = [] self._func = key or self.default def __getitem__(self, key): if type(key) is type(1): return self.list[key] return self.data[key] def __setitem__(self, key, item): item.parent = weakref.ref(self) self.list.append(item) self.data[key] = item def keys(self): return map(lambda i: self._func(i), self.list) def items(self): return map(lambda i: (self._func(i), i), self.list) def values(self): return self.list
Upgrade to ZSI-2.1a and this package is no longer required. -josh On May 14, 2008, at 4:02 PM, freeav8r wrote: > Hi all: > > I’m new to ZSI and apache and I’m having > difficulty getting my first ZSI web service up and > running. > > I installed apache with no problems and also installed > mod_python. I ran the mod_python “hello world” > test by changing the httpd.conf file with the > following entry: > > <Directory "C:/Program Files/Apache Software > Foundation/Apache2.2/htdocs/test"> > AddHandler mod_python .py > PythonHandler mptest > PythonDebug On > </Directory> > > The “Hello world” worked fine. > > I tried the mod_python example (2.1.3) found here: > http://pywebsvcs.sourceforge.net/zsi.html > > Because of the apache config entry above, I created > the following to files with the below names: > > ========== mptest.py ========= > from ZSI import dispatch > from mod_python import apache > > import MyHandler > mod = __import__('encodings.utf_8', globals(), > locals(), '*') > mod = __import__('encodings.utf_16_be', globals(), > locals(), '*') > > def handler(req): > dispatch.AsHandler(modules=(MyHandler,), > request=req) > return apache.OK > ========== end mptest.py ======= > > =========MyHandler.py ======== > def hello(): > return "Hello, world" > > def echo(*args): > return args > > def average(*args): > sum = 0 > for i in args: sum += i > return sum / len(args) > ========= end MyHandler.py ======== > > When I request the mptest.py file I get the following > error: > > > File "C:\Program > Files\Python25\Lib\site-packages\ZSI\parse.py", line > 54, in __init__ > from xml.dom.ext.reader import PyExpat > > ImportError: No module named ext.reader > > I'm running python 2.5 and the lastest stable versions > of apache, mod_python, and ZSI. > > > Any ideas? > > -freeav8r