Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

[BUG]add_filter(order=0) not work #359

Open
gundam78 opened this issue Apr 23, 2015 · 0 comments
Open

[BUG]add_filter(order=0) not work #359

gundam78 opened this issue Apr 23, 2015 · 0 comments

Comments

@gundam78
Copy link

  # xmlstream.py:  class XMLStream
  1 def add_filter(self, mode, handler, order=None):
  2     if order:
  3         self.__filters[mode].insert(order, handler)
  4     else:
  5         self.__filters[mode].append(handler)

I want my filter to be called before all other filters. So, I use order=0, in order to make my filter insert into the head of the list. But because of line 2, if order (should be if order is None), it will just call line 5...

My tricky solution is give order a big negative number, like -1000.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant