當前位置: 首頁>>代碼示例>>Python>>正文


Python Point.put方法代碼示例

本文整理匯總了Python中model.Point.put方法的典型用法代碼示例。如果您正苦於以下問題:Python Point.put方法的具體用法?Python Point.put怎麽用?Python Point.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在model.Point的用法示例。


在下文中一共展示了Point.put方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: post

# 需要導入模塊: from model import Point [as 別名]
# 或者: from model.Point import put [as 別名]
	def post(self):
		
		point = Point()
		point.title = self.request.get('title')
		
		if self.request.get('path'):
			point.path = True
		else:
			point.path = False
		
		point.content = cgi.escape(self.request.get('content')).replace('\r\n','<br>').replace('\n','<br>');
		
		point.lat = float(self.request.get('lat'))
		point.lng = float(self.request.get('lng'))
		
		dt = self.request.get('visit')
		if dt:
			point.date = datetime.datetime.strptime(dt,"%Y-%m-%d")
		else:
			point.date = datetime.datetime.now()
			
		point.dateStr = point.date.strftime('%b %d, %Y')
		
		if self.request.get('image'):
			point.img = db.Blob(images.resize(self.request.get('image'),500,500))
		
		point.put()
		self.redirect('/admin')
開發者ID:jgblight,項目名稱:Intrepid-1.0,代碼行數:30,代碼來源:input.py

示例2: post

# 需要導入模塊: from model import Point [as 別名]
# 或者: from model.Point import put [as 別名]
 def post(self):
     user = users.get_current_user()
     if user == None:
         self.response.out.write()
     else:
         lat = float(self.request.get("lat"))
         lon = float(self.request.get("lon"))
         hash = geohash.encode(lat, lon)
         point = Point()
         point.geohash = hash
         point.owner = users.get_current_user()
         point.put()
         template_values = {"method": "post"}
         self.response.headers["Content-Type"] = "application/json"
         self.response.out.write('{result:"OK", geohash:"' + hash + '"}')
開發者ID:wangjun,項目名稱:geolocationsample,代碼行數:17,代碼來源:main.py

示例3: post

# 需要導入模塊: from model import Point [as 別名]
# 或者: from model.Point import put [as 別名]
 def post(self):
     a, d = self.request.get('author'), self.request.get('description')  # error: missing either key
     try:
         schedString = self.request.get('schedulestring')   # error: missing parameter
         jsonSched = simplejson.loads(schedString)          # error: bad json
     
         s = Schedule(auth = a, desc = d)
         s.put()                                            # error: some puts succeed while others fail
         for pt in jsonSched["points"]:                     # error: not an object, or no "points" key
             p = Point(sched = s, location = map(int, pt), phase = ['R', 'R'])  # error:  setting all phases to RR
             p.put()                                        # error: some puts succeed while others fail
     # schedule should be post-ed as json string
     # so parse the string into Schedule's and Point's, then save it 
     #   (check out previous versions of scheduler.py for examples of saving)
         self.response.out.write(simplejson.dumps({'success': 'Schedule was successfully saved!'})) # maybe add the schedule's id?
     except Exception, e:
         self.response.out.write(simplejson.dumps({'error': e.message}))
開發者ID:Colbert-Sesanker,項目名稱:Connjur-SE,代碼行數:19,代碼來源:handlers.py


注:本文中的model.Point.put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。