summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarius Gedminas <marius@gedmin.as>2013-02-07 16:02:52 +0000
committerMarius Gedminas <marius@gedmin.as>2013-02-07 16:02:52 +0000
commit72b0b46875ce227abb8b8386594e2e319c5a2319 (patch)
treeb6462933a1bcba1a67c611c2b864e58a9f774b7c /src
parentc9d43d25af5a5419ea84fa0c1c472bc5f5c2c169 (diff)
downloadzope-tal-72b0b46875ce227abb8b8386594e2e319c5a2319.tar.gz
Towards Py3K: use the in operator instead of has_key()
Diffstat (limited to 'src')
-rw-r--r--src/zope/tal/dummyengine.py8
-rw-r--r--src/zope/tal/talgenerator.py6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/zope/tal/dummyengine.py b/src/zope/tal/dummyengine.py
index 378502a..bde57a5 100644
--- a/src/zope/tal/dummyengine.py
+++ b/src/zope/tal/dummyengine.py
@@ -101,7 +101,7 @@ class DummyEngine(object):
if type == "not":
return not self.evaluate(expr)
if type == "exists":
- return self.locals.has_key(expr) or self.globals.has_key(expr)
+ return expr in self.locals or expr in self.globals
if type == "python":
try:
return eval(expr, self.globals, self.locals)
@@ -120,9 +120,9 @@ class DummyEngine(object):
# implementation; can be overridden
def evaluatePathOrVar(self, expr):
expr = expr.strip()
- if self.locals.has_key(expr):
+ if expr in self.locals:
return self.locals[expr]
- elif self.globals.has_key(expr):
+ elif expr in self.globals:
return self.globals[expr]
else:
raise TALExpressionError("unknown variable: %s" % repr(expr))
@@ -265,7 +265,7 @@ class DummyTranslationDomain(object):
msgids = {}
def appendMsgid(self, domain, data):
- if not self.msgids.has_key(domain):
+ if domain not in self.msgids:
self.msgids[domain] = []
self.msgids[domain].append(data)
diff --git a/src/zope/tal/talgenerator.py b/src/zope/tal/talgenerator.py
index 103f637..89517ed 100644
--- a/src/zope/tal/talgenerator.py
+++ b/src/zope/tal/talgenerator.py
@@ -346,7 +346,7 @@ class TALGenerator(object):
def emitDefineMacro(self, macroName):
program = self.popProgram()
macroName = macroName.strip()
- if self.macros.has_key(macroName):
+ if macroName in self.macros:
raise METALError("duplicate macro definition: %s" % repr(macroName),
self.position)
if not re.match('%s$' % NAME_RE, macroName):
@@ -381,7 +381,7 @@ class TALGenerator(object):
def emitFillSlot(self, slotName):
program = self.popProgram()
slotName = slotName.strip()
- if self.slots.has_key(slotName):
+ if slotName in self.slots:
raise METALError("duplicate fill-slot name: %s" % repr(slotName),
self.position)
if not re.match('%s$' % NAME_RE, slotName):
@@ -449,7 +449,7 @@ class TALGenerator(object):
newlist = []
for item in attrlist:
key = item[0]
- if repldict.has_key(key):
+ if key in repldict:
expr, xlat, msgid = repldict[key]
item = item[:2] + ("replace", expr, xlat, msgid)
del repldict[key]