aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuri Takhteyev <yuri@freewisdom.org>2008-12-04 10:25:33 -0800
committerYuri Takhteyev <yuri@freewisdom.org>2008-12-04 10:25:33 -0800
commit50783a6600c21801edee16b2f523292e82cbcf9f (patch)
tree4f1b9b810b2c2860a3b9fbf4f9fa878cfc573507
parentd952587e33fcebb8f3807a863f2bdd50b86b5b23 (diff)
downloadmarkdown-50783a6600c21801edee16b2f523292e82cbcf9f.tar.gz
markdown-50783a6600c21801edee16b2f523292e82cbcf9f.tar.bz2
markdown-50783a6600c21801edee16b2f523292e82cbcf9f.zip
Getting rid of has_key for compatibility with python3k.
-rw-r--r--markdown/__init__.py2
-rw-r--r--markdown/extensions/toc.py4
-rw-r--r--markdown/inlinepatterns.py2
-rw-r--r--markdown/treeprocessors.py2
4 files changed, 5 insertions, 5 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py
index f03cea3..4939dca 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -404,7 +404,7 @@ class Extension:
def getConfig(self, key):
""" Return a setting for the given key or an empty string. """
- if self.config.has_key(key):
+ if key in self.config:
return self.config[key][0]
else:
return ""
diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py
index 60fe430..3e6e075 100644
--- a/markdown/extensions/toc.py
+++ b/markdown/extensions/toc.py
@@ -37,7 +37,7 @@ class TocTreeprocessor(markdown.treeprocessors.Treeprocessor):
# Get a list of id attributes
used_ids = []
for c in doc.getiterator():
- if c.attrib.has_key("id"):
+ if "id" in c.attrib:
used_ids.append(c.attrib["id"])
for (p, c) in self.iterparent(doc):
@@ -75,7 +75,7 @@ class TocTreeprocessor(markdown.treeprocessors.Treeprocessor):
level = tag_level
# Do not override pre-existing ids
- if not c.attrib.has_key("id"):
+ if not "id" in c.attrib:
id = self.config["slugify"][0](c.text)
if id in used_ids:
ctr = 1
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index 66d3063..5030170 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -301,7 +301,7 @@ class ReferencePattern(LinkPattern):
# we'll use "google" as the id
id = m.group(2).lower()
- if not self.markdown.references.has_key(id): # ignore undefined refs
+ if not id in self.markdown.references: # ignore undefined refs
return None
href, title = self.markdown.references[id]
diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py
index 0ea0de2..1dc612a 100644
--- a/markdown/treeprocessors.py
+++ b/markdown/treeprocessors.py
@@ -161,7 +161,7 @@ class InlineProcessor(Treeprocessor):
if index != -1:
id, phEndIndex = self.__findPlaceholder(data, index)
- if self.stashed_nodes.has_key(id):
+ if id in self.stashed_nodes:
node = self.stashed_nodes.get(id)
if index > 0: