当前位置: 首页>>代码示例>>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;未经允许,请勿转载。