From 9c8702133b92279a8e63fbe7de1b236895373c2f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 29 Nov 2019 13:07:20 +0000 Subject: [PATCH] Tidying --- daemon.py | 95 +++++++++++-------------------------------------------- 1 file changed, 19 insertions(+), 76 deletions(-) diff --git a/daemon.py b/daemon.py index e548f10a..3d80fe26 100644 --- a/daemon.py +++ b/daemon.py @@ -4979,82 +4979,25 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,14) - pageNumber=self._receiveNewPost(authorized,'newpost',self.path) - if pageNumber: - nickname=self.path.split('/users/')[1] - if '/' in nickname: - nickname=nickname.split('/')[0] - self._redirect_headers(self.server.httpPrefix+'://'+self.server.domainFull+ \ - '/users/'+nickname+ \ - '/'+self.server.defaultTimeline+ \ - '?page='+str(pageNumber),cookie) - self.server.POSTbusy=False - return - pageNumber=self._receiveNewPost(authorized,'newunlisted',self.path) - if pageNumber: - nickname=self.path.split('/users/')[1] - if '/' in nickname: - nickname=nickname.split('/')[0] - self._redirect_headers(self.server.httpPrefix+'://'+self.server.domainFull+ \ - '/users/'+nickname+ \ - '/'+self.server.defaultTimeline+ \ - '?page='+str(pageNumber),cookie) - self.server.POSTbusy=False - return - pageNumber=self._receiveNewPost(authorized,'newfollowers',self.path) - if pageNumber: - nickname=self.path.split('/users/')[1] - if '/' in nickname: - nickname=nickname.split('/')[0] - self._redirect_headers(self.server.httpPrefix+'://'+self.server.domainFull+ \ - '/users/'+nickname+ \ - '/'+self.server.defaultTimeline+ \ - '?page='+str(pageNumber),cookie) - self.server.POSTbusy=False - return - pageNumber=self._receiveNewPost(authorized,'newdm',self.path) - if pageNumber: - nickname=self.path.split('/users/')[1] - if '/' in nickname: - nickname=nickname.split('/')[0] - self._redirect_headers(self.server.httpPrefix+'://'+self.server.domainFull+ \ - '/users/'+nickname+ \ - '/'+self.server.defaultTimeline+ \ - '?page='+str(pageNumber),cookie) - self.server.POSTbusy=False - return - pageNumber=self._receiveNewPost(authorized,'newreport',self.path) - if pageNumber: - nickname=self.path.split('/users/')[1] - if '/' in nickname: - nickname=nickname.split('/')[0] - self._redirect_headers(self.server.httpPrefix+'://'+self.server.domainFull+ \ - '/users/'+nickname+ \ - '/'+self.server.defaultTimeline+ \ - '?page='+str(pageNumber),cookie) - self.server.POSTbusy=False - return - pageNumber=self._receiveNewPost(authorized,'newshare',self.path) - if pageNumber: - nickname=self.path.split('/users/')[1] - if '/' in nickname: - nickname=nickname.split('/')[0] - self._redirect_headers(self.server.httpPrefix+'://'+self.server.domainFull+ \ - '/users/'+nickname+ \ - '/shares?page='+str(pageNumber),cookie) - self.server.POSTbusy=False - return - pageNumber=self._receiveNewPost(authorized,'newquestion',self.path) - if pageNumber: - nickname=self.path.split('/users/')[1] - if '/' in nickname: - nickname=nickname.split('/')[0] - self._redirect_headers(self.server.httpPrefix+'://'+self.server.domainFull+ \ - '/users/'+nickname+ \ - '/'+self.server.defaultTimeline+ \ - '?page='+str(pageNumber),cookie) - self.server.POSTbusy=False - return + # receive different types of post created by htmlNewPost + postTypes=["newpost","newunlisted","newfollowers","newdm","newreport","newshare"] + for currPostType in postTypes: + if currPostType!='newshare': + postRedirect=self.server.defaultTimeline + else: + postRedirect='shares' + + pageNumber=self._receiveNewPost(authorized,currPostType,self.path) + if pageNumber: + nickname=self.path.split('/users/')[1] + if '/' in nickname: + nickname=nickname.split('/')[0] + self._redirect_headers(self.server.httpPrefix+'://'+self.server.domainFull+ \ + '/users/'+nickname+ \ + '/'+postRedirect+ \ + '?page='+str(pageNumber),cookie) + self.server.POSTbusy=False + return self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,15)