On Thu, 22 May 2008, Bill Janssen wrote:
I'm trying to figure out an issue here which sounds sort of similar. I've got a class in UpLib: class UpLibQueryParser (PythonMultiFieldQueryParser): in one of the methods (getFieldQuery), it needs to reparse the input, so I create a new instance of my class: newparser = self.__class__(self.fields, self.getAnalyzer()) and then cast it to a QueryParser so that I can call "parse()" on it: qp = QueryParser.cast_(newparser) But I get an exception at this point: File "/local/share/UpLib-1.7.4/code/uplib/indexing.py", line 320, in getFieldQuery qp = QueryParser.cast_(newparser) TypeError: <UpLibQueryParser: [EMAIL PROTECTED]> Above, I'm using "self.__class__" because I also create subclasses of this class, and I want an instance of the most specific subclass created.
How about using type(self)(...) instead ? Andi.. _______________________________________________ pylucene-dev mailing list pylucene-dev@osafoundation.org http://lists.osafoundation.org/mailman/listinfo/pylucene-dev