0

尝试插入数据存储时出现语法错误,在另一个项目中工作的完全相同的代码行

    B = db_Person(nafn='Alex')

这是其余的代码:

http://pastebin.com/bW37aUuT

4

1 回答 1

1
def post(self):
    q = db.Query(db_Person)

    message = "Innsetning tokst"

    in_kennitala = int(self.request.get('p_kennitala'))
    in_nafn = self.request.get('p_nafn')
    in_heimili = self.request.get('p_heimili')
    in_postnumer = self.request.get('p_postnumer')
    in_stadur = self.request.get('p_stadur')
    in_land = self.request.get('p_land')
    in_simi = int(self.request.get('p_simi'))
    in_gsm = int(self.request.get('p_gsm')    # <- missing right parenthesis

    B = db_Person(nafn='Alex')                # <- parser gets confused here
    B.put()

    template_values = {
            'message': message
    }

    template = jinja_environment.get_template('breyta.html')
    self.response.out.write(template.render(template_values))

 

这是固定代码:

def post(self):
    q = db.Query(db_Person)

    message = "Innsetning tokst"

    in_kennitala = int(self.request.get('p_kennitala'))
    in_nafn = self.request.get('p_nafn')
    in_heimili = self.request.get('p_heimili')
    in_postnumer = self.request.get('p_postnumer')
    in_stadur = self.request.get('p_stadur')
    in_land = self.request.get('p_land')
    in_simi = int(self.request.get('p_simi'))
    in_gsm = int(self.request.get('p_gsm'))

    B = db_Person(nafn='Alex')
    B.put()

    template_values = {
            'message': message
    }

    template = jinja_environment.get_template('breyta.html')
    self.response.out.write(template.render(template_values))
于 2013-03-02T17:02:59.310 回答