예제 #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
예제 #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
예제 #3
0
파일: index.py 프로젝트: firehot/notifry
	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
예제 #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
예제 #5
0
 def get_sources(self):
     return UserSource.get_by_id(self.sources, self)
예제 #6
0
	def get_sources(self):
		return UserSource.get_by_id(self.sources, self)