def __init__(self): #Arguments for logging args = sys.argv[1:] otherargs = logging_startup(args) # otherargs has commandspecific args logging.debug('hello from sync.py') confdir = findconffolder() conf = ConfigParser.ConfigParser() conf.read(join(confdir, 'config')) url = conf.get('resources', 'url') restful_factory = RestfulFactory(url) self.SimplifiedSubject = restful_factory.make( "/examiner/restfulsimplifiedsubject/") self.SimplifiedPeriod = restful_factory.make( "/examiner/restfulsimplifiedperiod/") self.SimplifiedAssignment = restful_factory.make( "/examiner/restfulsimplifiedassignment/") self.SimplifiedAssignmentGroup = restful_factory.make( "/examiner/restfulsimplifiedassignmentgroup/") self.SimplifiedDelivery = restful_factory.make( "/examiner/restfulsimplifieddelivery/") self.SimplifiedDeadline = restful_factory.make( "/examiner/restfulsimplifieddeadline/") self.SimplifiedStaticFeedback = restful_factory.make( "/examiner/restfulsimplifiedstaticfeedback/") self.SimplifiedFileMeta = restful_factory.make( "/examiner/restfulsimplifiedfilemeta/") self.root_dir = dirname(confdir) + sep self.metadata = {}
def __init__(self): #Arguments for logging args = sys.argv[1:] otherargs = logging_startup(args) # otherargs has commandspecific args logging.debug('hello from sync.py') confdir = findconffolder() conf = ConfigParser.ConfigParser() conf.read(join(confdir, 'config')) url = conf.get('resources', 'url') restful_factory = RestfulFactory(url) self.SimplifiedSubject = restful_factory.make("/examiner/restfulsimplifiedsubject/") self.SimplifiedPeriod = restful_factory.make("/examiner/restfulsimplifiedperiod/") self.SimplifiedAssignment = restful_factory.make("/examiner/restfulsimplifiedassignment/") self.SimplifiedAssignmentGroup = restful_factory.make("/examiner/restfulsimplifiedassignmentgroup/") self.SimplifiedDelivery = restful_factory.make("/examiner/restfulsimplifieddelivery/") self.SimplifiedDeadline = restful_factory.make("/examiner/restfulsimplifieddeadline/") self.SimplifiedStaticFeedback = restful_factory.make("/examiner/restfulsimplifiedstaticfeedback/") self.SimplifiedFileMeta = restful_factory.make("/examiner/restfulsimplifiedfilemeta/") self.root_dir = dirname(confdir) + sep self.metadata = {}
#!/usr/bin/env python import sys import os import logging import ConfigParser from os.path import join from devilryclient.utils import logging_startup args = sys.argv[1:] otherargs = logging_startup(args) # otherargs has commandspecific args if len(otherargs) < 2: logging.warning('Not enough input arguments!') logging.warning('Usage: init url filename') sys.exit(0) url = otherargs[0] #TODO check that url is gyldig devilry url name = otherargs[1] Config = ConfigParser.ConfigParser() dirpath = join(os.getcwd(), name) devdirpath = join(dirpath, '.devilry') try: os.mkdir(dirpath) os.mkdir(devdirpath) cfgfile = open(join(devdirpath, 'config'), 'w') except OSError: