2013-07-25 1 views
0

나는 내 머리를 벽에 치고, 잠을 못 자고있는/멍청한 상태에서 간과 한 매우 간단한 것을 말할 수 있기를 바랍니다.NDB 쿼리는 로컬 환경과 프로덕션 환경에서 서로 다른 결과를 제공합니다.

매우 간단하게 쿼리를 수행하고 반환 된 개체 유형이 내 로컬 컴퓨터에서 응용 프로그램을 배포하면 리턴되는 것보다 다릅니다.

match = MatchRealTimeStatsModel.queryMatch(ancestor_key)[0] 

위 로컬 컴퓨터에서 위의 MatchRealTimeStatsModel 개체가 생성됩니다. 위의 두 라인 고글 시스템에서 실행 때 나는하지만 다음받을

logging.info(match)  # outputs a MatchRealTimeStatsModel object 
logging.info(match.match) # outputs a dictionary from json data 

: 원인이 될 수있는 것과 같은

logging.info(match)  # outputs a dictionary from json data 
logging.info(match.match) # AttributeError: 'dict' object has no attribute 'match' 

어떤 제안 그래서 문제없이 줄에 다음을 실행할 수 있습니다 이? 데이터 저장소를 지우고 GAE 환경을 정리하기 위해 내가 생각할 수있는 모든 것을했습니다.

편집 # 1 : 추가 MatchRealTimeStatsModel 코드 : 아마도

ancestor_key = ndb.Key('MatchRealTimeStatsModel', matchUniqueUrl) 
match = MatchRealTimeStatsModel.queryMatch(ancestor_key)[0] 
+0

이 내용이 dict 인 경우 일치하는 [ 'match']가 작동해야합니다. –

+0

네, 그렇지만 테스트를 위해 로컬 컴퓨터에서 작동하지 않습니다. 정말 오히려 이것을 피하기 위해 if/else 문을 사용하지 않을 것입니다. – Regner

+0

'MatchRealTimeStatsModel.queryMatch'가 어떻게 구현되는지 보지 않고는 아무 말도하지 못합니다. –

답변

2

당신이 자극보다 로컬 코드의 다른 버전을 사용하고 있습니다 : 여기

class MatchRealTimeStatsModel(ndb.Model): 
    match = ndb.JsonProperty() 

    @classmethod 
    def queryMatch(cls, ancestor_key): 
     return cls.query(ancestor=ancestor_key).fetch() 

그리고 실제 전화입니까? 두 곳에서 소스 코드 복사본을 재설정하십시오.

관련 문제