Exemple #1
0
	def addCapsule(
			openingDate=None,
			closingDate=None,
			lat=None,
			lng=None,
			tll=0, 
			anonymous=True, 
			encrypt=False, 
			user=None,
			content=None,
			password=None
		):
		"""
		Add a new capsule
		Create a new capsule and assign it to current user ( owner )
		content is uniencoded
		in : all the defining capsule parameters
		out : TSCid if ok, None otherwise
		"""
		L.info("addCapsule called")
		L.debug({
			'openingDate' : openingDate, 
			'closingDate' : closingDate, 
			'lat' : lat,
			'lng' : lng, 
			'ttl' : tll,
			'anonymous' : anonymous,
			'encrypt' : encrypt,
			'user' : user,
			'content' : content, 
			'pwd len' : len(password) if password is not None else -1
		})
		try:
			tsc = \
				TimespaceCapsule(
					openingDate = openingDate,
					closingDate = closingDate,
					content = content,
					positionLat = lat,
					positionLng = lng,
					positionTll = tll,
					anonymous = anonymous,
					owner = user,
					encrypt = encrypt,
					password = password 
				)
			tsc.put()
		except Exception as e:
			L.warning("Got exception!")
			L.exception(e)
			return None
		else:
			L.info("Capsule created")
			return tsc.TSCid
Exemple #2
0
    def addCapsule(openingDate=None,
                   closingDate=None,
                   lat=None,
                   lng=None,
                   tll=0,
                   anonymous=True,
                   encrypt=False,
                   user=None,
                   content=None,
                   password=None):
        """
		Add a new capsule
		Create a new capsule and assign it to current user ( owner )
		content is uniencoded
		in : all the defining capsule parameters
		out : TSCid if ok, None otherwise
		"""
        L.info("addCapsule called")
        L.debug({
            'openingDate': openingDate,
            'closingDate': closingDate,
            'lat': lat,
            'lng': lng,
            'ttl': tll,
            'anonymous': anonymous,
            'encrypt': encrypt,
            'user': user,
            'content': content,
            'pwd len': len(password) if password is not None else -1
        })
        try:
            tsc = \
             TimespaceCapsule(
              openingDate = openingDate,
              closingDate = closingDate,
              content = content,
              positionLat = lat,
              positionLng = lng,
              positionTll = tll,
              anonymous = anonymous,
              owner = user,
              encrypt = encrypt,
              password = password
             )
            tsc.put()
        except Exception as e:
            L.warning("Got exception!")
            L.exception(e)
            return None
        else:
            L.info("Capsule created")
            return tsc.TSCid