当前位置: 首页>>代码示例>>Python>>正文


Python account.Account类代码示例

本文整理汇总了Python中storyengine.model.account.Account的典型用法代码示例。如果您正苦于以下问题:Python Account类的具体用法?Python Account怎么用?Python Account使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Account类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

	def post(self):
		if False == (USER_AGENT in self.request.headers["User-Agent"]):
			self.response.out.write(json.dumps({'success':False}))
			return

		self.response.headers['Content-Type'] = 'application/json'
		facebookid = self.request.get('facebookid')
		account = Account.get_by_facebookid(facebookid)
		params = {}
		params['money'] = self.request.get('money')
		params['candy'] = self.request.get('candy')
		params['score'] = self.request.get('score')
		params['maxscore'] = self.request.get('maxscore')
		params['id'] = self.request.get('id')
		logging.info('coin[%d] candy[%d] score[%d] max[%d]',
				int(params['money']),
				int(params['candy']),
				int(params['score']),
				int(params['maxscore']))
		ret = Account.api_submit(params,account)
#		params['cost'] = self.request.get('candy')
#		params['itemcost'] = self.request.get('money')
#		params['receipt_type'] = 'play'
#		Receipt.new(params,account)
		self.response.headers['Content-Type'] = 'application/json'
		self.response.out.write(json.dumps(ret))
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:26,代码来源:account.py

示例2: post

	def post(self):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		testcode = self.request.get('testcode')
		assert(testcode)
		d = json.loads(testcode)
		assert(d)
		det = Account.api_gift(d['coin'],d['candy'],account)
		self.redirect(self.request.url + 'input?result='+str(det))
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:9,代码来源:apitest.py

示例3: post

	def post(self): #logout
		accountid = self.session.get('accountid')
		account_ = Account.get_by_accountid(accountid)
		towhom_ = None
		try:
			towhom_ = Account.get_by_accountid(int(towhomID))
		except:
			towhom_ = None
		params = {}
		params['dataID'] = self.request.get('dataID')
		params['cost'] = self.request.get('cost')
		params['receipt_type'] = self.request.get('receipt_type')

		Receipt.new(params,account_,towhom_)
		self.redirect('/'+accountid+'/')
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:15,代码来源:receipt.py

示例4: get

	def get(self):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		if None is accountid:
			context = {'static_path': STATIC_PATH,
			'APP_TITLE' : APP_TITLE,
			'err_msg':"You should login"}
			self.render_to_response('err_page.html',context)
			return
		keytodel = self.request.get('del')
		stories = Story.all()
		stories.order('-created')
		storylist = []
		for story in stories:
			story.keyname = str(story.key().id())
			storylist.append(story)
		storysortedlist = sorted(storylist, key=lambda p: p.index)
		context = {'static_path': STATIC_PATH,
			'APP_TITLE' : APP_TITLE,
			'stories':storysortedlist,
			'keytodel':keytodel,
			'size':len(storylist)}
		self.render_to_response('story_index.html',context)
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:25,代码来源:story.py

示例5: get

	def get(self):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		mode = self.request.get('mode')
		keytodel = self.request.get('del')
		if 'all' == mode:
			pages = Page.all().order('-created')
		else:
			pages = Page.all().order('-created').fetch(limit=5)
		pagelist = []
		Next = namedtuple("Next", "pageid contentid")
		for page in pages:
			page.keyname = str(page.key().id())
			if page.contents.count() > 0: #content at foremost 
				page.content = page.contents[0].content
				page.content.keyid = page.content.key().id()
			childlist = []
			for l in page.childs:
				if l.child_page.contents.count() > 0:
					n = Next(l.child_page.key().id(), l.child_page.contents[0].content.key().id())
					childlist.append(n)
			page.childlist = childlist
			pagelist.append(page)
		context = {'static_path': STATIC_PATH,
			'APP_TITLE' : APP_TITLE,
			'pages':pagelist,
			'keytodel':keytodel,
			'size':len(pagelist)}
		self.render_to_response('page_index.html',context)
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:31,代码来源:page.py

示例6: get

	def get(self):
		result = self.request.get('result')
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		f_data = {
			'testcode':
			'{"id":"5","lang":"ko","tostudy":"en"}'
		}
		s_form = APIForm(f_data)

		cinput = "/app/content/%d?lang=%s&tostudy=%s"
		coutput = """success={success=True,
		id=%s(key_id),index=%d,version=%d,visible=%d,
		expiration_date=%d,
		lang=%s,name=%s,description=%s,
		price=%d,
		part=%s,
		tran={
			lang=%s,name=%s,description=%s,
		},
		}
		error={success=False,error='the reason of error',
		id=%s(key_id),
		}
		"""
		context = {'static_path': STATIC_PATH,
			'input':cinput,
			'output':coutput,
			'result':result,
			'form':s_form}
		self.render_to_response('apitest_index.html',context)
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:33,代码来源:apitest.py

示例7: post

	def post(self,pageid):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return

		contentlist = []
		contentid = self.request.get('contentid')
		nameen = self.request.get('nameen')
		nameko = self.request.get('nameko')

		if "" != contentid:
			i = Content.get_by_id(int(contentid))
			i.keyid = i.key().id()
			contentlist.append(i)
		elif "" != nameen:
			result = Content.all().filter("nameen =",nameen)
			for i in result :
				i.keyid = i.key().id()
				contentlist.append(i)
		elif "" != nameko:
			result = Content.all().filter("nameko =",nameko)
			for i in result :
				i.keyid = i.key().id()
				contentlist.append(i)

		context = {'static_path': STATIC_PATH,
			'APP_TITLE' : APP_TITLE,
			'contents':contentlist,
			'pageid':pageid,
		}
		self.render_to_response('page_content_search.html',context)
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:32,代码来源:page.py

示例8: test_category_new

def test_category_new():
	facebookid = "[email protected]"
	account = Account.get_by_facebookid(facebookid)
	key_name = "TOEIC"
	category = Category.new(key_name,account)
	assert None != category
	return
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:7,代码来源:test_category.py

示例9: get

	def get(self,contentid):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		content = Content.get_by_id(int(contentid))
		content.delete()
		self.redirect('/content')
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:8,代码来源:content.py

示例10: test_story_new

def test_story_new():
	facebookid = "[email protected]"
	account = Account.get_by_facebookid(facebookid)
	assert account
	story = Story.new(account)
	story.put()
	assert story
	return story
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:8,代码来源:test_story.py

示例11: get

	def get(self):
		if False == (USER_AGENT in self.request.headers["User-Agent"]):
			self.response.out.write(json.dumps({'success':False}))
			return

		facebookid = self.request.get('facebookid')
		ret = Account.api_read(facebookid)
		self.response.headers['Content-Type'] = 'application/json'
		self.response.out.write(json.dumps(ret))
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:9,代码来源:account.py

示例12: get

	def get(self,categoryid):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		lang = self.request.get('lang')
		category = Category.getter(categoryid)
		category.support_tostudy_del(lang)
		category.put()
		self.redirect('/category/'+categoryid)
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:10,代码来源:category.py

示例13: get

	def get(self):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return

		s_form = ReceiptInfoForm(None)
		context = {'static_path': STATIC_PATH,
			'form':s_form}
		self.render_to_response('form.html',context)
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:10,代码来源:receipt.py

示例14: post

	def post(self,keyid): #logout
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		story_ = Story.get_by_id(int(keyid))
		page = Page.new(account,story_)
		pageid = int(self.request.get('pageid'))
		pageToImport = Page.get_by_id(int(pageid))
		for link in pageToImport.contents:
			PageContentLink.new(page,link.content)
		self.redirect('/story/'+keyid)
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:10,代码来源:story.py

示例15: post

	def post(self,category_name): 
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return

		storyid = self.request.get('storyid')
		category = Category.getter(category_name)
		story = Story.get_by_id(int(storyid))
		CategoryStoryLink.new(category,story)
		self.redirect('/category/'+category_name)
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:11,代码来源:category.py


注:本文中的storyengine.model.account.Account类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。