Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fix one autoblanking bug

  • Loading branch information...
commit 141116a78c1b5051780722475028b1acedb10024 1 parent 70ad3f1
@batterseapower batterseapower authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 pinyin/anki/
5 pinyin/anki/
@@ -95,7 +95,10 @@ def onFocusLost(self, fact, field):
# Changed fields have their "generated" tag stripped. NB: ALWAYS update the fact (even if the
# field hasn't changed) because we might have changed ANOTHER field to e.g. blank it, and now
# by moving focus from the expression field we indicate that we want to fill it out.
- self.updatefact(fact,, fieldchanged and pinyin.factproxy.unmarkgeneratedfield(field.value) or None)
+ #
+ # NB: be careful with this ternary statement! It's perfectly OK for field.value to be "", and if
+ # that happens we CAN'T let fieldvalue in updatefact be None, or autoblanking gets broken.
+ self.updatefact(fact,, (fieldchanged and [pinyin.factproxy.unmarkgeneratedfield(field.value)] or [None])[0])
def updatefact(self, fact, fieldname, fieldvalue):
# Are we not in a Mandarin model?

0 comments on commit 141116a

Please sign in to comment.
Something went wrong with that request. Please try again.