示例#1
0
文件: copy.py 项目: allmywant/anno
 def getImage(self, request):
     result = GetImageResponse()
     item = FeedbackComment.get_by_id(request.anno_id)
     if item != None:
         result.image = item.image
 
     return result
示例#2
0
文件: copy.py 项目: allmywant/anno
 def getItems(self, request):
     result = []
     anno_item = None
     
     model = FeedbackComment.all()
     for item in model.order('updateTimestamp').run(offset=request.offset, limit=request.limit):
         anno_item = ItemMessage()
         anno_item.id = item.key().id()
         anno_item.anno_text = item.comment
         anno_item.x = float(item.x)
         anno_item.y = float(item.y)
         anno_item.app_name = item.app_name
         anno_item.anno_type = item.anno_type
         anno_item.app_version = item.app_version
         
         if item.direction == "0":
             anno_item.is_circle_on_top = True
         else:
             anno_item.is_circle_on_top = False
             
         if item.isMoved == "1":
             anno_item.is_moved = True
         else:
             anno_item.is_moved = False
                 
         anno_item.level = item.level
         anno_item.model = item.model
         anno_item.os_version = item.os_version
         anno_item.create_time = item.updateTimestamp 
         anno_item.user_id = item.user_id.user_name
         result.append(anno_item)
         
     return GetItemsResponse(anno_list=result)
示例#3
0
文件: test.py 项目: allmywant/anno
 def proceedRequest(self):
     item = {}
     for iter in range(20):
         item["screenshot_key"] =  "screenshot_key" + str(iter)
         item["comment"] =  "comment" + str(iter)
         item["x"] = "100"
         item["y"] = "200"
         item["direction"] = "direction" + str(iter)
         item["image"] = "image1" + str(iter)
         item["app_version"] = "app_version1" + str(iter)
         item["app_name"] = "app_name" + str(iter)
         item["isMoved"] = iter
         item["level"] = iter
         item["os_version"] = "os version1" + str(iter)
         item["anno_type"] = "type1" + str(iter)
         item["model"] = "model1" + str(iter)
         com = FeedbackComment(user = users.get_current_user(), userId = users.get_current_user().user_id())
         com.addNewComment(item)
             
示例#4
0
文件: copy.py 项目: allmywant/anno
 def getFlags(self, request):
     fc = FeedbackComment.get_by_id(request.anno_id)
     if fc is None:
         print "No followups for anno - " + str(request.anno_id)
         return ListResponse(flag_list=[])
     flags = Flags.all().filter("feedback_key = ", fc.key())
     results = []
     for flag in flags:
         result = VoteFlagResponse()
         result.created = flag.updateTimestamp
         result.creator = flag.user_id.user_name
         results.append(result)
     return ListResponse(flag_list=results)
示例#5
0
文件: copy.py 项目: allmywant/anno
 def getFollowups(self, request):
     fc = FeedbackComment.get_by_id(request.anno_id)
     if fc is None:
         print "No followups for anno - " + str(request.anno_id)
         return ListResponse(followup_list=[])
     followups = FollowUp.all().filter("Feedback_key = ", fc.key())
     results = []
     for followup in followups:
         result = FollowupResponse()
         result.created = followup.updateTimestamp
         result.creator = followup.user_id.user_name
         result.comment = followup.comment
         results.append(result)
     return ListResponse(followup_list=results)
示例#6
0
 def getAllItems(self, recOffset, recLimit):
     result = {}
     annos = []
     shortItem = {}
     
     model = FeedbackComment.all()
     for item in model.order('-updateTimestamp').run(offset=recOffset, limit=recLimit):
         shortItem["id"] = str(item.key())
         shortItem["annoText"] = item.comment
         shortItem["app"] = item.app_name
         shortItem["author"] = item.user_id.user_name
         annos.append(shortItem.copy())
     result["annos"] = annos
     
     return result
示例#7
0
    def get(self):
        """
        handle request for screenshot.

        sample: https://usersource-anno.appspot.com/screenshot?anno_id=5644572721938432
        """
        anno_id = self.request.get('anno_id')
        if anno_id is None or anno_id == '':
            self.response.set_status(400)
            self.response.out.write(u'anno_id parameter is required.')
        else:
            anno = FeedbackComment.get_by_id(long(anno_id))
            if anno is None:
                self.response.set_status(400)
                self.response.out.write('No anno entity with the id "%s" exists.' % anno_id)
            elif anno.image is None:
                self.response.set_status(404)
                self.response.out.write("This anno doesn't contain screenshot")
            else:
                self.response.out.write(anno.image)
示例#8
0
 def updateAppName(self, anno, name):
     com = FeedbackComment()
     return com.setAppName(anno, name)
示例#9
0
文件: sync.py 项目: allmywant/anno
 def getServerObjects(self, data):
     comment = FeedbackComment()
     return comment.getCommentsAfterDate(data[AnnoSync.JSON_TIMESTAMP])
示例#10
0
文件: sync.py 项目: allmywant/anno
 def updateData(self, data):
     comment = FeedbackComment()
     comment.createComment(data[AnnoSync.JSON_UPDATED_OBJECT])
     data[AnnoSync.JSON_UPDATED_OBJECT] = []
示例#11
0
文件: sync.py 项目: allmywant/anno
 def generateKeys(self, data):
     comment = FeedbackComment()
     data[AnnoSync.JSON_OBJECTS_KEYS] = comment.generateKeys(data[AnnoSync.JSON_KEYS_COUNT])