reassign 468601 python-4suite-xml
thanks
Hi,
ok, so for the record, this is the runtime error I get when appying
Matthias' patch (i.e. a quick port to python-4suite-xml, see
http://people.ubuntu.com/~doko/tmp/gcal.debdiff if still around):
Traceback (most recent call last):
File "/usr/lib/opensync/google-cal-helper", line 452, in ?
sys.exit(main(sys.argv))
File "/usr/lib/opensync/google-cal-helper", line 444, in main
return fn(argv)
File "/usr/lib/opensync/google-cal-helper", line 332, in oper_get_all
e = GCalEntry(atom=xe)
File "/usr/lib/opensync/google-cal-helper", line 187, in __init__
self.parseAtom(atom)
File "/usr/lib/opensync/google-cal-helper", line 196, in parseAtom
self.editUri = self.elementValue('atom:[EMAIL PROTECTED]"edit"]/@href')
File "/usr/lib/opensync/google-cal-helper", line 293, in elementValue
nodes = self.query(name)
File "/usr/lib/opensync/google-cal-helper", line 304, in query
return XPath.Evaluate(expr, context=ctx)
File "/usr/lib/python2.4/site-packages/Ft/Xml/XPath/Util.py", line 188, in
Evaluate
retval = XPathParser.new().parse(expr).evaluate(con)
File
"/usr/lib/python2.4/site-packages/Ft/Xml/XPath/ParsedRelativeLocationPath.py",
line 18, in evaluate
nodeset = self._left.select(context)
File "/usr/lib/python2.4/site-packages/Ft/Xml/XPath/ParsedStep.py", line 30,
in evaluate
node_set = self._predicates.filter(node_set, context, reverse)
File "/usr/lib/python2.4/site-packages/Ft/Xml/XPath/ParsedPredicateList.py",
line 43, in filter
res = pred.evaluate(context)
File "/usr/lib/python2.4/site-packages/Ft/Xml/XPath/ParsedExpr.py", line 721,
in evaluate
left = self._left.evaluate(context)
File "/usr/lib/python2.4/site-packages/Ft/Xml/XPath/ParsedStep.py", line 28,
in evaluate
(node_set, reverse) = self._axis.select(context, self._nodeTest.match)
File "/usr/lib/python2.4/site-packages/Ft/Xml/XPath/ParsedAxisSpecifier.py",
line 94, in select
result = [ attr for attr in context.node.xpathAttributes
AttributeError: Element instance has no attribute 'xpathAttributes'
If I print out what is being parsed/frobbed, I get this with python-xml:
atom:title/text()
atom:id/text()
atom:[EMAIL PROTECTED]"edit"]/@href
atom:[EMAIL PROTECTED]"text"]/text()
gd:recurrence/text()
gd:when/@startTime
gd:when/@endTime
gd:eventStatus/@value
gd:where/@valueString
xs to osync: 2008-03-17T08:30:00.000+01:00 => 20080317T083000
xs to osync: 2008-03-17T09:30:00.000+01:00 => 20080317T093000
atom:title/text()
atom:id/text()
atom:[EMAIL PROTECTED]"edit"]/@href
atom:[EMAIL PROTECTED]"text"]/text()
gd:recurrence/text()
gd:when/@startTime
gd:when/@endTime
gd:eventStatus/@value
gd:where/@valueString
When I do the same with python-4suite-xml, I get:
Member 2 of type file-sync just sent all changes
atom:title/text()
atom:id/text()
atom:[EMAIL PROTECTED]"edit"]/@href
and then the traceback. Could it be that python-4suite-xml chokes on
the parenthesis? Indeed, if I replace the 4suite code of class
ParsedAttributeAxisSpecifier's select method with what was in
python-xml, it works fine, thus reassigning to python-4suite-xml. If
the above input is out of spec or bogus or wrong (I wouldn't know),
please assign back.
This is the code I changed (file Ft/Xml/XPath/ParsedAxisSpecifier.py):
class ParsedAttributeAxisSpecifier(AxisSpecifier):
principalType = Node.ATTRIBUTE_NODE
#def select(self, context, nodeTest):
#"""Select all of the attributes from the context node"""
#result = [ attr for attr in context.node.xpathAttributes
# if nodeTest(context, attr, self.principalType) ]
#return (result, 0)
def select(self, context, nodeTest):
"""Select all of the attributes from the context node"""
attrs = context.node.attributes
rt = filter(lambda attr, test=nodeTest, context=context,
pt=self.principalType:
test(context, attr, pt),
attrs and attrs.values() or [])
return (rt, 0)
Michael
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]