Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(36)  |  Call(18)  |  Derive(0)  |  Import(18)
Create the directory structure if necessary. return 'True' if it was created
successfully and can be written into, 'False' otherwise.

        def create_dir(directory):
    """
    Create the directory structure if necessary. return 'True' if it was created
    successfully and can be written into, 'False' otherwise.
    """
    if directory.strip() == '':
        return False
    else:
        absDir = get_absolute_path(directory)
        try:
            os.makedirs(absDir)
        except OSError as e:
            if e.errno != EEXIST:
                LOG.error('Failed creating meta dir: %s', str(e))
                return False
        return os.access(absDir, os.W_OK)
        


src/t/u/turbulenz_local-1.1.4/turbulenz_local/models/apiv1/gameprofile.py   turbulenz_local(Download)
 
from turbulenz_local.models.userlist import get_user
from turbulenz_local.tools import get_absolute_path, create_dir
 
LOG = getLogger(__name__)
        # Create gameprofile folder and user folder on the game path
        path = join_path(path, game.slug)
        if not create_dir(path):
            error_msg = 'User GameProfile path \"%s\" could not be created.' % path
            LOG.error(error_msg)

src/t/u/turbulenz_local-1.1.4/turbulenz_local/models/apiv1/gamenotifications.py   turbulenz_local(Download)
# pylint: enable=F0401
 
from turbulenz_local.tools import get_absolute_path, create_dir
 
# pylint: disable=C0103
    path = join_path(path, slug, recipient, notification_type)
 
    if not create_dir(path):
        raise GameNotificationPathError('User GameNotification path \"%s\" could not be created.' % path)
 

src/t/u/turbulenz_local-1.1.4/turbulenz_local/models/apiv1/badges.py   turbulenz_local(Download)
# pylint: enable=F0401
 
from turbulenz_local.tools import get_absolute_path, create_dir
 
REQUIRED_BADGE_KEYS = ['key', 'title', 'description', 'points', 'shape']
                return
 
            if not create_dir(path):
                LOG.error('Game badges path \"%s\" could not be created.', path)
            self.userbadges_path = norm_path(join_path(get_absolute_path(path), self.game.slug) + '.yaml')

src/t/u/turbulenz_local-HEAD/turbulenz_local/models/apiv1/gameprofile.py   turbulenz_local(Download)
 
from turbulenz_local.models.userlist import get_user
from turbulenz_local.tools import get_absolute_path, create_dir
 
LOG = getLogger(__name__)
        # Create gameprofile folder and user folder on the game path
        path = join_path(path, game.slug)
        if not create_dir(path):
            error_msg = 'User GameProfile path \"%s\" could not be created.' % path
            LOG.error(error_msg)

src/t/u/turbulenz_local-1.1.4/turbulenz_local/models/apiv1/store.py   turbulenz_local(Download)
# pylint: enable=F0401
 
from turbulenz_local.tools import get_absolute_path, create_dir
from turbulenz_local.lib.validation import ValidationException
from turbulenz_local.lib.tools import create_id
        # Create store items folder and user folder on the game path
        path = join_path(path, self.game.slug)
        if not create_dir(path):
            raise StoreError('User store items path \"%s\" could not be created.' % path)
        self.path = get_absolute_path(path)

src/t/u/turbulenz_local-1.1.4/turbulenz_local/models/apiv1/datashare.py   turbulenz_local(Download)
# pylint: enable=F0401
 
from turbulenz_local.tools import get_absolute_path, create_dir
from turbulenz_local.lib.tools import create_id
from turbulenz_local.lib.exceptions import BadRequest, NotFound, Forbidden
        # Create datashare folder
        path = join_path(path, self.game.slug)
        if not create_dir(path):
            LOG.error('DataShare path \"%s\" could not be created.', path)
            raise IOError('DataShare path \"%s\" could not be created.' % path)

src/t/u/turbulenz_local-1.1.4/turbulenz_local/models/apiv1/userdata.py   turbulenz_local(Download)
from os.path import join as join_path
 
from turbulenz_local.tools import get_absolute_path, create_dir
 
LOG = logging.getLogger(__name__)
        # Create userdata folder and user folder on the game path
        path = join_path(path, self.game.slug, self.user.username)
        if not create_dir(path):
            raise UserDataPathError('User UserData path \"%s\" could not be created.' % path)
        self.path = get_absolute_path(path)

src/t/u/turbulenz_local-1.1.4/turbulenz_local/handlers/localv1/save.py   turbulenz_local(Download)
 
from turbulenz_local.models.gamelist import get_game_by_slug
from turbulenz_local.tools import get_absolute_path, create_dir
 
LOG = getLogger(__name__)
 
        file_dir = dirname(file_path)
        if not create_dir(file_dir):
            LOG.error('Failed to create directory at "%s"', file_dir)
            self.set_status(500)

src/t/u/turbulenz_local-HEAD/turbulenz_local/models/apiv1/gamenotifications.py   turbulenz_local(Download)
# pylint: enable=F0401
 
from turbulenz_local.tools import get_absolute_path, create_dir
 
# pylint: disable=C0103
    path = join_path(path, slug, recipient, notification_type)
 
    if not create_dir(path):
        raise GameNotificationPathError('User GameNotification path \"%s\" could not be created.' % path)
 

src/t/u/turbulenz_local-HEAD/turbulenz_local/models/apiv1/badges.py   turbulenz_local(Download)
# pylint: enable=F0401
 
from turbulenz_local.tools import get_absolute_path, create_dir
 
REQUIRED_BADGE_KEYS = ['key', 'title', 'description', 'points', 'shape']
                return
 
            if not create_dir(path):
                LOG.error('Game badges path \"%s\" could not be created.', path)
            self.userbadges_path = norm_path(join_path(get_absolute_path(path), self.game.slug) + '.yaml')

  1 | 2  Next