コード例 #1
0
ファイル: control_polygon.py プロジェクト: lavrovdv/diplom
    def get(self):
        aut = Authorisation(self)
        if aut.checkCookieUser():
            name = self.request.get('name')
            description = self.request.get('description')
            polygon = self.request.get('polygon')
            list = polygon.split('|')
            list = list[:-1]
            latList = []
            lngList = []

            for i in range(len(list)):
                if  i % 2:
                    lngList.append(float(list[i]))
                else:
                    latList.append(float(list[i]))
    #
            area = Area()
            area.name = name
            area.description = description
            area.latList = latList
            area.lngList = lngList
            area.user = aut.getUserKey()
#            area.name = "name12"
#            area.description = "desc12"
#            area.latList = [29.8025179058,-70.1806640625,29.8025179058,-70.1806640625]
#            area.lngList = [27.1764691319,-104.282226563,27.1764691319,-104.282226563]
#            area.user = aut.getUserKey()
            area.put()
        else:
            requestString = '{"Error":"error"}'
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write(requestString)
コード例 #2
0
ファイル: area.py プロジェクト: takatoshiono/chin-ma-ya.org
    def post(self):
        id = self.request.get('id')
        area = Area.all().filter('id = ', id).get()

        op = ''
        if area:
            op = 'updated'
            area.name = self.request.get('name')
            area.url = self.request.get('url')
        else:
            op = 'created'
            area = Area(id = int(id),
                        name = self.request.get('name'),
                        url = self.request.get('url'),
                        )
        area.put()
        self.response.out.write('%s %s.' % (self.request.get('name'), op))