Ticket #905 (closed defect: fixed)
[WG] CSML default namespace handling bug
Reported by: | mggr | Owned by: | lawrence |
---|---|---|---|
Priority: | required | Milestone: | PROD Final |
Component: | ndg2 | Version: | |
Keywords: | Delivery | Cc: |
Description
In our current CSML, we have the namespaces explicit (ie. each element is specified with a namespace, with no default namespace). The xml handling code in models/xmlHandler2.py assumes that CSML is the default namespace in one part and blows up (since we don't have a default namespace). The rest of the code doesn't make this assumption, so it's probably just a minor bug.
This can be fixed by the following patch:
--- ows_server-0.0.0dev_r2996-py2.4.egg-orig/ows_server/models/xmlHandler2.py 2007-11-07 12:57:08.000000000 +0000 +++ ows_server-0.0.0dev_r2996-py2.4.egg/ows_server/models/xmlHandler2.py 2007-11-07 17:18:15.000000000 +0000 @@ -136,7 +136,8 @@ rightArrow=s.find('</span>') # this is just after the tag, where we do want the namespace list nslist={} for ns in self.realns: nslist[self.realns[ns]]=ns - r=' %s="%s"'%(span('xmlns','xmlAttrTyp'),span(nslist['default'],'xmlAttrVal')) + if 'default' in nslist: r=' %s="%s"'%(span('xmlns','xmlAttrTyp'),span(nslist['default'],'xmlAttrVal')) + else: r='' for ns in nslist: if ns<>'default': r+=' %s="%s"'%(span('xmlns:%s'%ns,'xmlAttrTyp'),span(nslist[ns],'xmlAttrVal')) return s[:rightArrow]+r+s[rightArrow:]
Change History
comment:1 Changed 13 years ago by lawrence
- Status changed from new to closed
- Resolution set to wontfix
comment:2 Changed 13 years ago by mggr
- Status changed from closed to reopened
- Resolution wontfix deleted
Issue still exists (and still needs patching for PML records) - just got hit by ~1000 72kb server error emails caused by googlebot ;)
The code has moved into the ndgUtils egg but hasn't changed. The egg makes it more messy to do a local patch, it's not an obvious problem when it breaks and it's been a while, so I'm committing the fix above to subversion. Hope that's ok.
comment:3 Changed 13 years ago by mggr
- Status changed from reopened to closed
- Resolution set to fixed
comment:4 Changed 13 years ago by mggr
- Status changed from closed to reopened
- Resolution fixed deleted
Except I'm not :/
mggr@pmpc889:~/local_scratch/ndgsvn/ndgUtils<1035>svn ci Sending xmlHandler2.py Transmitting file data .svn: Commit failed (details follow): svn: Can't create directory '/ndgsvn/db/transactions/3896-1.txn': Permission denied svn: Your commit message was left in a temporary file: svn: '/home/scratch/mggr/ndgsvn/ndgUtils/svn-commit.tmp'
Looks like I'm in the wrong usergroup now (in cvsusers but not in ndgsvn group). On the other hand, my user id should probably be deleted anyway ;)
Anyone else willing to do this for me?
I'm going to completely refactor this when we have the new element tree which handles namespaces more elegantly ...