2014-09-21 5 views
0

그래서 난이 NDB의 datasore 클래스가 데이터 저장소에 문자열을 저장 종료 :세미 콜론

"class asd 
{ 
public void fun() 
{ 
    printf ("hello world!!!"); 

} 

} " 

:

class Messages(ndb.Model): 
    message = ndb.StringProperty() 
    emailid = ndb.StringProperty(indexed=True)  
    date = ndb.DateTimeProperty(auto_now_add=True) 

    @classmethod 
    def query_book(cls,key): 
    return cls.query(ancestor=key).order(-cls.date) 

을하고 나는 '메시지'StringProperty에 아래의 문자열을 저장하려고하면 세미콜론까지만 데이터 스토어에 저장됩니다. 세미콜론을 넣지 않으면 전체 문자열이 저장됩니다. 위의 문자열은 사용자가 입력해야 함을 언급해야합니다. 세미콜론과 다른 특수 문자는 어디에서나 나타날 수 있습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?? 미리 감사드립니다 ...

+0

나는 이것이 무엇인지 전혀 모르지만, 들썩 들썩 들린다. 행운을 빌어 요 – Veedrac

+0

고마워 ... 누군가가이 문제를 전에 풀어서 해결했다고 생각해. –

답변

1

개발자 및 프로덕션 환경에서 잘 작동합니다. 사용자 입력에서이 데이터를 얻었으므로 여기에서 문제를 찾으십시오. NDB는 이것으로 잘 작동합니다.

from google.appengine.ext import ndb 

class _Foo(ndb.Model): 
    message = ndb.StringProperty() 
    emailid = ndb.StringProperty(indexed=True)  
    date = ndb.DateTimeProperty(auto_now_add=True) 

    @classmethod 
    def query_book(cls,key): 
    return cls.query(ancestor=key).order(-cls.date) 

key = ndb.Key(_Foo, '1') 
message = """class asd 
{ 
public void fun() 
{ 
    printf ("hello world!!!"); 

} 

} """ 
f = _Foo(key=key) 

f.message = message 
f.put() 

assert key.get().message == message # no error here, means they are equal 
+0

당신 말이 맞아요. 내 HTTP POST 요청에 문제가 있습니다. 나는 완전한 데이터를 보내고있다. 하지만 세미콜론에 올라 오는 것만 같습니다. –

+0

적절한 HTTP 게시물 요청을 보내는 방법을 알아야합니다. :) 고마워요 !!! –