user searches and conversation refactored

This commit is contained in:
Manuel Cortez 2015-03-28 05:58:57 -06:00
parent 2a83440c44
commit ffeccbb3b6
2 changed files with 7 additions and 7 deletions

View File

@ -613,10 +613,10 @@ class searchPeopleBufferController(peopleBufferController):
log.debug("starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type)) log.debug("starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs)) log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
log.debug("Function: %s" % (self.function,)) log.debug("Function: %s" % (self.function,))
try: # try:
val = self.session.call_paged(self.function, *self.args, **self.kwargs) val = self.session.call_paged(self.function, *self.args, **self.kwargs)
except: # except:
return # return
number_of_items = self.session.order_cursored_buffer(self.name, val) number_of_items = self.session.order_cursored_buffer(self.name, val)
log.debug("Number of items retrieved: %d" % (number_of_items,)) log.debug("Number of items retrieved: %d" % (number_of_items,))
self.put_items_on_list(number_of_items) self.put_items_on_list(number_of_items)
@ -713,8 +713,8 @@ class conversationBufferController(searchBufferController):
if tweet["in_reply_to_status_id"] == None: if tweet["in_reply_to_status_id"] == None:
self.kwargs["since_id"] = tweet["id"] self.kwargs["since_id"] = tweet["id"]
self.ids.append(tweet["id"]) self.ids.append(tweet["id"])
val2 = self.session.call_paged(self.function, *self.args, **self.kwargs) val2 = self.session.search(self.name, *self.args, **self.kwargs)
for i in val2["statuses"]: for i in val2:
if i["in_reply_to_status_id"] in self.ids: if i["in_reply_to_status_id"] in self.ids:
self.statuses.append(i) self.statuses.append(i)
self.ids.append(i["id"]) self.ids.append(i["id"])

View File

@ -382,7 +382,7 @@ class Controller(object):
log.error("A buffer for the %s search term is already created. You can't create a duplicate buffer." % (term,)) log.error("A buffer for the %s search term is already created. You can't create a duplicate buffer." % (term,))
return return
elif dlg.get("users") == True: elif dlg.get("users") == True:
search = buffersController.searchPeopleBufferController(self.view.nb, "search_users", "%s-searchUser" % (term,), buffer.session, buffer.session.db["user_name"], bufferType=None, q=term, count=buffer.session.settings["general"]["max_tweets_per_call"]) search = buffersController.searchPeopleBufferController(self.view.nb, "search_users", "%s-searchUser" % (term,), buffer.session, buffer.session.db["user_name"], bufferType=None, q=term)
self.buffers.append(search) self.buffers.append(search)
search.start_stream() search.start_stream()
self.view.insert_buffer(search.buffer, name=_(u"Search for {}".format(term)), pos=self.view.search("searches", buffer.session.db["user_name"])) self.view.insert_buffer(search.buffer, name=_(u"Search for {}".format(term)), pos=self.view.search("searches", buffer.session.db["user_name"]))