Permalink
Browse files

Fix for random duplication and/or omission of individual examples

  • Loading branch information...
1 parent b7fb271 commit c9fe931567566317b70c67bb1653f2757555be74 @RichardWallis RichardWallis committed Nov 4, 2016
Showing with 7 additions and 3 deletions.
  1. +7 −3 api.py
View
@@ -930,11 +930,14 @@ def __init__ (self, terms, original_html, microdata, rdfa, jsonld, egmeta, layer
self.egmeta['id'] = self.keyvalue
for term in terms:
+
if(EXAMPLESMAP.get(term, None) == None):
EXAMPLESMAP[term] = []
- EXAMPLESMAP.get(term).append(self)
+ if not self in EXAMPLESMAP.get(term):
+ EXAMPLESMAP.get(term).append(self)
- EXAMPLES.append(self)
+ if not self in EXAMPLES:
+ EXAMPLES.append(self)
def LoadNodeExamples(node, layers='core'):
"""Returns the examples (if any) for some Unit node."""
@@ -1178,9 +1181,10 @@ def load_examples_data(extensions):
log.info("Examples already loaded")
def read_examples(files, layer):
- parser = parsers.ParseExampleFile(None,layer=layer)
first = True
for f in files:
+ parser = parsers.ParseExampleFile(None,layer=layer)
+ #log.info("[%s] Reading: %s" % (getInstanceId(short=True),f))
if first:
#log.info("[%s] Loading examples from %s" % (getInstanceId(short=True),layer))
first = False

0 comments on commit c9fe931

Please sign in to comment.