pgcontents/pgmanager.py
def _get_directory(self, path, content, format):
        """
        Get a directory from the database.
        """
        with self.engine.begin() as db:
            try:
                record = get_directory(
                    db, self.user_id, path, content
                )
            except NoSuchDirectory:
                if self.file_exists(path):
                    # TODO: It's awkward/expensive to have to check this to
                    # return a 400 instead of 404. Consider just 404ing.
                    self.do_400("Wrong type: %s" % path)
                else:
                    self.no_such_entity(path)

        return self._directory_model_from_db(record, content)
def _get_directory(self, path, content, format):
        with self.engine.begin() as db:
            try:
                record = get_directory(
                    db, self.user_id, path, content
                )
            except NoSuchDirectory:
                if self.file_exists(path):
                    # TODO: It's awkward/expensive to have to check this to
                    # return a 400 instead of 404. Consider just 404ing.
                    self.do_400("Wrong type: %s" % path)
                else:
                    self.no_such_entity(path)

        return self._directory_model_from_db(record, content)
def _get_directory ( self , path , content , format ) : with self . engine . begin ( ) as db : try : record = get_directory ( db , self . user_id , path , content ) except NoSuchDirectory : if self . file_exists ( path ) : # TODO: It's awkward/expensive to have to check this to # return a 400 instead of 404. Consider just 404ing. self . do_400 ( "Wrong type: %s" % path ) else : self . no_such_entity ( path ) return self . _directory_model_from_db ( record , content )
Get a directory from the database.
Get a directory from the database .