Exemple #1
0
    def batch_lookups(self):
        super(SolrLinkUploader, self).batch_lookups()
        author_ids = [
            thing.author_id for thing in self.things
            if hasattr(thing, 'author_id')
        ]
        try:
            self.accounts = Account._byID(author_ids,
                                          data=True,
                                          return_dict=True)
        except NotFound:
            if self.use_safe_get:
                self.accounts = safe_get(Account._byID,
                                         author_ids,
                                         data=True,
                                         return_dict=True)
            else:
                raise

        sr_ids = [
            thing.sr_id for thing in self.things if hasattr(thing, 'sr_id')
        ]
        try:
            self.srs = Subreddit._byID(sr_ids, data=True, return_dict=True)
        except NotFound:
            if self.use_safe_get:
                self.srs = safe_get(Subreddit._byID,
                                    sr_ids,
                                    data=True,
                                    return_dict=True)
            else:
                raise
Exemple #2
0
 def batch_lookups(self):
     try:
         self.things = Thing._by_fullname(self.fullnames, data=True, return_dict=False)
     except NotFound:
         if self.use_safe_get:
             self.things = safe_get(Thing._by_fullname, self.fullnames, data=True, return_dict=False)
         else:
             raise
Exemple #3
0
    def batch_lookups(self):
        super(LinkUploader, self).batch_lookups()
        author_ids = [thing.author_id for thing in self.things if hasattr(thing, "author_id")]
        try:
            self.accounts = Account._byID(author_ids, data=True, return_dict=True)
        except NotFound:
            if self.use_safe_get:
                self.accounts = safe_get(Account._byID, author_ids, data=True, return_dict=True)
            else:
                raise

        sr_ids = [thing.sr_id for thing in self.things if hasattr(thing, "sr_id")]
        try:
            self.srs = Subreddit._byID(sr_ids, data=True, return_dict=True)
        except NotFound:
            if self.use_safe_get:
                self.srs = safe_get(Subreddit._byID, sr_ids, data=True, return_dict=True)
            else:
                raise
Exemple #4
0
 def batch_lookups(self):                                                                                            
     try:                                                                                                            
         self.things = Thing._by_fullname(self.fullnames, data=True,                                                 
                                          return_dict=False)                                                         
     except NotFound:                                                                                                
         if self.use_safe_get:                                                                                       
             self.things = safe_get(Thing._by_fullname, self.fullnames,                                              
                                    data=True, return_dict=False)                                                    
         else:                                                                                                       
             raise