ladon-dev-team team mailing list archive
-
ladon-dev-team team
-
Mailing list archive
-
Message #00242
[Question #663838]: (Chinese (Simplified)) ladon used in django problem
A question was asked in a language (Chinese (Simplified)) spoken by
none of the registered ladon answer contacts.
https://answers.launchpad.net/ladon/+question/663838
I can't import django model in the "CSPResponseService" which is my ladon webservice,how can I import? how can I so
===========================================================
# -*- coding: utf-8 -*-
from ladon.server.wsgi import LadonWSGIApplication
import os
from django.utils.log import getLogger
os.environ['DJANGO_SETTINGS_MODULE'] = 'project_name.settings'
application = LadonWSGIApplication(
['appapi.views'],
[os.path.join(os.path.dirname(__file__), os.path.pardir)],
catalog_name='OPS APP API',
catalog_desc='This is the root of my cool webservice catalog'
===============================================================
==================================================
# -*- coding: utf-8 -*-
import os
import sys
import traceback
import datetime
from ladon.ladonizer import ladonize
from ladon.types.ladontype import LadonType
from ladon.compat import PORTABLE_STRING
from django.utils.log import getLogger
from video_upload.models import ShanDongVideoUpload
logger = getLogger( "default" )
reload(sys)
sys.setdefaultencoding("utf8")
class CSPResult(LadonType):
Result = int
ErrorDescription = PORTABLE_STRING
class CSPResponseService(object):
@ladonize(PORTABLE_STRING,PORTABLE_STRING,PORTABLE_STRING,int,PORTABLE_STRING,rtype=CSPResult)
def injectResponse(self,offerId, offerUriId, termUriId, code, reason):
res = CSPResult()
try:
obj = ShanDongVideoUpload.objects.get(movie_id=offerId)
obj.result_notify = code
obj.offer_uri_id = offerUriId
obj.term_uri_id = termUriId
obj.save()
except ShanDongVideoUpload.DoesNotExist, e:
res.Result = -1
res.ErrorDescription = "Offerid is not found in database"
return res
except Exception,e:
res.Result = -1
res.ErrorDescription = "other error"
return res
res.Result = 0
res.ErrorDescription = "success"
return res
====================================================================================
--
You received this question notification because your team Ladon
Developer is an answer contact for ladon.