Ejemplo n.º 1
0
	def get_source(key):
		pointer = SourcePointer.get_pointer(key)
		if pointer:
			source_collection = UserSources.get_user_source_collection(pointer.owner)
			source = UserSource.get_by_id(pointer.sourceId, source_collection)
			return source
		else:
			return None
Ejemplo n.º 2
0
 def get_source(key):
     pointer = SourcePointer.get_pointer(key)
     if pointer:
         source_collection = UserSources.get_user_source_collection(
             pointer.owner)
         source = UserSource.get_by_id(pointer.sourceId, source_collection)
         return source
     else:
         return None
Ejemplo n.º 3
0
	def get_source(self):
		# Helper function to get the source object from the URL.
		input = web.input(id=None)
		collection = UserSources.get_user_source_collection(users.get_current_user())
		if input.id:
			# Load source by ID.
			source = UserSource.get_by_id(long(input.id), collection)
			if not source:
				# It does not exist.
				raise web.notfound()

			# Check that the source belongs to the logged in user.
			if source.owner.user_id() != users.get_current_user().user_id():
				# It's not theirs. 404.
				raise web.notfound()

			return source
		else:
			# New source.
			source = UserSource.factory(collection)
			return source
Ejemplo n.º 4
0
    def get_source(self):
        # Helper function to get the source object from the URL.
        input = web.input(id=None)
        collection = UserSources.get_user_source_collection(
            users.get_current_user())
        if input.id:
            # Load source by ID.
            source = UserSource.get_by_id(long(input.id), collection)
            if not source:
                # It does not exist.
                raise web.notfound()

            # Check that the source belongs to the logged in user.
            if source.owner.user_id() != users.get_current_user().user_id():
                # It's not theirs. 404.
                raise web.notfound()

            return source
        else:
            # New source.
            source = UserSource.factory(collection)
            return source
Ejemplo n.º 5
0
 def get_sources(self):
     return UserSource.get_by_id(self.sources, self)
Ejemplo n.º 6
0
	def get_sources(self):
		return UserSource.get_by_id(self.sources, self)