Example #1
0
	def put_station(self, id, shortname, name, link, type, full, thumb):
		station = Station(
			key_name = id,
			shortname = shortname,
			name = name,
			link = link,
			type = type,
			full = full,
			thumb = thumb,
			online = False,
			active = datetime.utcnow(),
		)
		station.put()
		logging.info("Station put in datastore")
		
		memcache.set(self._memcache_station_id, station)
		logging.info("Station put in memcache")
		
		# Put station in proxy
		self._station = station
		
		# Increment admin counter of stations
		admin_proxy = AdminApi()
		admin_proxy.increment_stations_counter()
		logging.info("Counter of stations incremented")
		
		# Mail admins
		self.mail()
Example #2
0
	def put_user(self, uid, first_name, last_name, email):
		user = User(
			key_name = uid,
			first_name = first_name,
			last_name = last_name,
			email = email,
			stations = self.stations,
		)
		user.put()
		logging.info("User put in datastore")

		# Put the user in the proxy
		self._user = user
		
		# Increment admin counter of users
		admin_proxy = AdminApi()
		admin_proxy.increment_users_counter()
		logging.info("Counter of users incremented")
		
		# Mail new user to admins
		self.mail()
		
		return self._user