Ejemplo n.º 1
0
 def testCreate(self):
     ns = Namespace(u'test/test')
     ns.create(u'fomtest description')
     self.assertEqual(self.last, ('POST', u'/namespaces/test', {
         'name': u'test',
         'description': u'fomtest description'
     }, None, None))
Ejemplo n.º 2
0
 def testCreate(self):
     ns = Namespace(u'test/test')
     ns.create(u'fomtest description')
     self.assertEqual(self.last, (
         'POST',
         u'/namespaces/test',
         {'name': u'test',
          'description': u'fomtest description'},
         None,
         None))
Ejemplo n.º 3
0
def create_tags():
    ns = Namespace(u'test/medical')
    ns.create(u'Medical tags')
    ns.create_tag(u'date_of_birth', u'Date of birth', True)
    ns.create_tag(u'age', u'Decimal age', True)
    ns.create_tag(u'height', u'Height', True)
    ns.create_tag(u'weight', u'Weight', True)
    ns.create_tag(u'bmi', u'Body Mass Index', True)
    ns.create_tag(u'date', u'Date', True)
    ns.create_tag(u'sex', u'Sex', True)
    ns.create_tag(u'pubertal_stage', u'Pubertal stage')
Ejemplo n.º 4
0
def make_namespace(path, name, desc):
    """
    Given a path, name and description will attempt to create and return a new
    namespace.

    path - the path to the new namespace

    name - the name of the dataset that's causing this namespace to be created
    (used when setting the description of the new namespace)

    desc - the description of the dataset that's causing the namespace to be
    create (used when setting the description of the new namespace)
    """
    try:
        logger.info('Checking namespace %r' % path)
        ns_head, ns_tail = os.path.split(path)
        result = Namespace(path)
        result.create(NAMESPACE_DESC % (ns_tail, name, desc))
        logger.info('Done')
    except Fluid412Error:
        # 412 simply means the namespace already exists
        result = Namespace(path)
        logger.info('%r already existed' % result.path)
    return result
Ejemplo n.º 5
0
def make_namespace(path, name, desc):
    """
    Given a path, name and description will attempt to create and return a new
    namespace.

    path - the path to the new namespace

    name - the name of the dataset that's causing this namespace to be created
    (used when setting the description of the new namespace)

    desc - the description of the dataset that's causing the namespace to be
    create (used when setting the description of the new namespace)
    """
    try:
        logger.info('Checking namespace %r' % path)
        ns_head, ns_tail = os.path.split(path)
        result = Namespace(path)
        result.create(NAMESPACE_DESC % (ns_tail, name, desc))
        logger.info('Done')
    except Fluid412Error:
        # 412 simply means the namespace already exists
        result = Namespace(path)
        logger.info('%r already existed' % result.path)
    return result