예제 #1
0
 def get(self):
     to = self.get_argument("to")
     receiver = Member.getObjectByObjectId(to)
     if receiver:
         self.render('accounts/messaging_form.html', member=receiver)
     else:
         self.write_error(500)
예제 #2
0
파일: page.py 프로젝트: ergatea/gitpub2
 def post(self):
     mid = self.get_argument("mid")
     do = self.get_argument("do")
     member = Member.getObjectByObjectId(mid)
     if do == "accept":
         Member.accpetFriendRequest(self.current_user, member)
         _do = "suspend"
         label = self._t("Accept friend request")
     elif do == "refuse":
         Member.refuseFriendRequest(self.current_user, member)
         _do = "refuse"
         label = None
     else:
         self.finishedMsg(status="error", info="Action not found")
     self.finishedMsg(status="success", info="execute friends operation", do=_do, label=label)
예제 #3
0
파일: page.py 프로젝트: ergatea/gitpub2
 def post(self):
     mid = self.get_argument("mid")
     do = self.get_argument("do")
     member = Member.getObjectByObjectId(mid)
     if do == "add":
         Member.appendToFocusing(self.current_user, member)
         Member.appendToFocused(member, self.current_user)
         _do = "remove"
         label = self._t("Remove focusing")
     elif do == "remove":
         Member.removeFromFocusing(self.current_user, member)
         Member.removeFromFocused(member, self.current_user)
         _do = "add"
         label = self._t("Add focusing")
     else:
         self.finishedMsg(status="error", info="Action not found")
     self.finishedMsg(status="success", info="Add to focusing success", do=_do, label=label)
예제 #4
0
파일: admin.py 프로젝트: ergatea/gitpub2
 def post(self):
     data = json.loads(self.request.body)
     member = Member.getObjectByObjectId(data["data-id"])
     if member:
         member.has_fetcher = data["status"]
         member.save()
         member.reload()
         if member.has_fetcher == "enabled":
             import socket  
             sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  
             sock.connect(("127.0.0.1", 5000))  
             print "Send start fetch weibo task"
             sock.send(json.dumps({'task':'single', 'port':'weibo', 'operation':'start', 'username':member.username}))
             sock.close()
         self.finishedMsg(status="success", info="change job to %s" %data["status"])
     else:
         self.finishedMsg(status="error", info="object not found")
예제 #5
0
    def post(self):
        receiver_id = self.get_argument("receiver_id")
        title = self.get_argument("title")
        content = self.get_argument("content")

        receiver = Member.getObjectByObjectId(receiver_id)

        messaging = self.current_user.send_messaging(
            receiver,
            title=title,
            content=content,
            created=datetime.now()
        )

        self.finishedMsg(
            status="success", 
            info="send message successful", 
            next="%s/accounts/messaging/view/%s" %(self.prefix_url, messaging.mid))
예제 #6
0
    def post(self, prev_id):
        receiver_id = self.get_argument("receiver_id")
        title = self.get_argument("title")
        content = self.get_argument("content")

        receiver = Member.getObjectByObjectId(receiver_id)
        previous_messaging = Messaging.getObjectByObjectId(prev_id)

        if receiver and previous_messaging:
            messaging = self.current_user.send_messaging(
                receiver,
                title=title,
                content=content,
                previous=previous_messaging,
                created=datetime.now()
            )
            self.finishedMsg(
                status="success", 
                info="send message successful", 
                next="%s/accounts/messaging/view/%s" %(self.prefix_url, messaging.mid))
        else:
            self.finishedMsg(status="error", info="reply message error")   
예제 #7
0
파일: page.py 프로젝트: ergatea/gitpub2
 def get(self, mid):
     member = Member.getObjectByObjectId(mid)
     if member:
         self.render("page/profile.html", member=member)
     else:
         raise HTTPError(404, "member not found")