Exemplo n.º 1
0
 def onePattern(self, pattern):
     found = False
     for item in self.original:
         try:
             oldFound = found
             found = inevow.IQ(item).onePattern(pattern)
             if oldFound:
                 raise stan.TooManyNodes('pattern', pattern)
         except stan.NodeNotFound:
             continue
     if not found:
         raise stan.NodeNotFound('pattern', pattern)
     return found
Exemplo n.º 2
0
 def onePattern(self, pattern):
     node = None
     for item in self.original:
         try:
             newNode = inevow.IQ(item).onePattern(pattern)
         except stan.NodeNotFound:
             continue
         else:
             if node is None:
                 node = newNode
             else:
                 raise stan.TooManyNodes('pattern', pattern)
     if node is None:
         raise stan.NodeNotFound('pattern', pattern)
     return node
Exemplo n.º 3
0
    def _locatePatterns(self, pattern, default, loop=True):
        produced = []
        for item in self.original:
            try:
                for x in inevow.IQ(stan.Tag("")[item])._locatePatterns(
                        pattern, None, loop=False):
                    produced.append(x)
                    yield x.clone(deep=False, clearPattern=True)
            except stan.NodeNotFound:
                continue

        if produced:
            while True:
                for x in produced:
                    yield x.clone(deep=False, clearPattern=True)

        if default is None:
            raise stan.NodeNotFound("pattern", pattern)
        if hasattr(default, 'clone'):
            while True:
                yield default.clone(deep=False)
        else:
            while True:
                yield default
Exemplo n.º 4
0
 def onePattern(self, pattern):
     raise stan.NodeNotFound('pattern', pattern)
Exemplo n.º 5
0
 def patternGenerator(self, pattern, default=None):
     raise stan.NodeNotFound('pattern', pattern)