pgcontents/query.py
def create_directory(db, user_id, api_path):
    """
    Create a directory.
    """
    name = from_api_dirname(api_path)
    if name == '/':
        parent_name = null()
        parent_user_id = null()
    else:
        # Convert '/foo/bar/buzz/' -> '/foo/bar/'
        parent_name = name[:name.rindex('/', 0, -1) + 1]
        parent_user_id = user_id

    db.execute(
        directories.insert().values(
            name=name,
            user_id=user_id,
            parent_name=parent_name,
            parent_user_id=parent_user_id,
        )
    )
def create_directory(db, user_id, api_path):
    name = from_api_dirname(api_path)
    if name == '/':
        parent_name = null()
        parent_user_id = null()
    else:
        # Convert '/foo/bar/buzz/' -> '/foo/bar/'
        parent_name = name[:name.rindex('/', 0, -1) + 1]
        parent_user_id = user_id

    db.execute(
        directories.insert().values(
            name=name,
            user_id=user_id,
            parent_name=parent_name,
            parent_user_id=parent_user_id,
        )
    )
def create_directory ( db , user_id , api_path ) : name = from_api_dirname ( api_path ) if name == '/' : parent_name = null ( ) parent_user_id = null ( ) else : # Convert '/foo/bar/buzz/' -> '/foo/bar/' parent_name = name [ : name . rindex ( '/' , 0 , - 1 ) + 1 ] parent_user_id = user_id db . execute ( directories . insert ( ) . values ( name = name , user_id = user_id , parent_name = parent_name , parent_user_id = parent_user_id , ) )
Create a directory.
Create a directory .