Esempio n. 1
0
 def _create_content(self, title, type_name):
     assert title, 'Must have a title to create content' 
     newcontentid = normalize(title)
     container = self.aq_parent.aq_parent
     newcontentid = container.invokeFactory(type_name, id=newcontentid,
                                            title=title)
     return getattr(self.context, newcontentid)
Esempio n. 2
0
    def manageLinks(self, new_links):
        # this has been heavily optimized
        # @@ but asyncing backlinking would help

        scope = self.wfilter.scope
        dups = set(self.removeLinks(new_links))

        resolver = self.resolver
        norm = tuple()
        for link in new_links:
            normalled = normalize(link)
            norm += normalled,
            self.resolver.aggregate(link, normalled, scope)

        for link, normalled in zip(new_links, norm):
            match = self.getMatch(link,
                                  resolver.agg_brains,
                                  normalled=normalled)
            if not match:
                match = self.getMatch(link,
                                      resolver.agg_scoped_brains,
                                      normalled=normalled)
            if not match:
                continue
            if match.UID != MissingValue and match.UID in dups:
                continue
            self.manageLink(match, normalled)
Esempio n. 3
0
 def match(self, brain, getlink):
     """
     mmmm....turtle.
     @@ make efficient
     """
     link = getlink(brain.getId, getlink(normalize(brain.Title), None))
     if link:
         return True
Esempio n. 4
0
 def _create_content(self, title, type_name):
     assert title, 'Must have a title to create content'
     newcontentid = normalize(title)
     container = self.aq_parent.aq_parent
     newcontentid = container.invokeFactory(type_name,
                                            id=newcontentid,
                                            title=title)
     return getattr(self.context, newcontentid)
Esempio n. 5
0
 def match(self, brain, getlink):
     """
     mmmm....turtle.
     @@ make efficient
     """
     link = getlink(brain.getId,
                    getlink(normalize(brain.Title), None))
     if link:
         return True
Esempio n. 6
0
    def _create_content(self, title, type_name):
        assert title, 'Must have a title to create content' 
        id_=self.context.generateUniqueId(type_name)
        
        new_content = self.context.restrictedTraverse('portal_factory/%s/%s' % (type_name, id_))

        transaction_note('Initiated creation of %s with id %s in %s' % \
                         (new_content.getTypeInfo().getId(),
                          id_,
                          self.context.absolute_url()))
        new_content.setTitle(title)
        newcontentid = normalize(title)
        new_content.setId(newcontentid)
        return new_content
Esempio n. 7
0
    def _create_content(self, title, type_name):
        assert title, 'Must have a title to create content'
        id_ = self.context.generateUniqueId(type_name)

        new_content = self.context.restrictedTraverse('portal_factory/%s/%s' %
                                                      (type_name, id_))

        transaction_note('Initiated creation of %s with id %s in %s' % \
                         (new_content.getTypeInfo().getId(),
                          id_,
                          self.context.absolute_url()))
        new_content.setTitle(title)
        newcontentid = normalize(title)
        new_content.setId(newcontentid)
        return new_content
Esempio n. 8
0
    def manageLinks(self, new_links):
        # this has been heavily optimized
        # @@ but asyncing backlinking would help

        scope=self.wfilter.scope
        dups = set(self.removeLinks(new_links))

        resolver = self.resolver
        norm=tuple()
        for link in new_links:
            normalled=normalize(link)
            norm+=normalled,
            self.resolver.aggregate(link, normalled, scope)

        for link, normalled in zip(new_links, norm):
            match = self.getMatch(link, resolver.agg_brains, normalled=normalled)
            if not match:
                match = self.getMatch(link, resolver.agg_scoped_brains, normalled=normalled)
            if not match:
                continue
            if match.UID != MissingValue and match.UID in dups:
                continue
            self.manageLink(match, normalled)
Esempio n. 9
0
 def _preplinks(self, links=dict()):
     return links and dict([(normalize(link), link) for link in links]) \
                  or dict()
Esempio n. 10
0
 def _preplinks(self, links=dict()):
     return links and dict([(normalize(link), link) for link in links]) \
                  or dict()