def initialize_sanitized_properties(
    context, resource_type, resource_name, properties):
  properties = properties.split(',')
  properties = dict([(p.strip(), '<script>foo</script>') for p in properties])
  print properties
  handle_named_example_resource(
      context, resource_type, resource_name, **properties)
Beispiel #2
0
def initialize_sanitized_properties(
    context, resource_type, resource_name, properties):
  properties = properties.split(',')
  properties = dict([
      (p.strip(), '<script>foo{}</script>'.format(resource_type))
      for p in properties
      ])
  handle_named_example_resource(
      context, resource_type, resource_name, **properties)
Beispiel #3
0
def post_collection_of_resources(context):
    """Iterate over a table where the first two columns are `type` and `name`.
  Successive columns are for properties to be set on the resource before
  posting it to the relevant collection.
  """
    for row in context.table:
        resource_type = row[0]
        name = row[1]
        properties = dict([(heading, row[heading]) for heading in row.headings[2:]])
        handle_named_example_resource(context, resource_type, name, **properties)
        handle_post_named_example(context, name)
        handle_get_example_resource(context, name)
Beispiel #4
0
def post_collection_of_resources(context):
    """Iterate over a table where the first two columns are `type` and `name`.
  Successive columns are for properties to be set on the resource before
  posting it to the relevant collection.
  """
    for row in context.table:
        resource_type = row[0]
        name = row[1]
        properties = dict([(heading, row[heading])
                           for heading in row.headings[2:]])
        handle_named_example_resource(context, resource_type, name,
                                      **properties)
        handle_post_named_example(context, name)
        handle_get_example_resource(context, name)
Beispiel #5
0
def create_category(context, name, category_type):
    handle_named_example_resource(context,
                                  'Category',
                                  name,
                                  type=category_type)
Beispiel #6
0
def create_option(context, name, role):
    handle_named_example_resource(context, 'Option', name, role=role)
Beispiel #7
0
def named_example_resource(context, resource_type, example_name, **kwargs):
    handle_named_example_resource(context, resource_type, example_name,
                                  **kwargs)
Beispiel #8
0
def named_example_from_json(context, resource_type, example_name):
    text = handle_template_text(context, context.text)
    json_obj = json.loads(text)
    handle_named_example_resource(context, resource_type, example_name,
                                  **json_obj)
Beispiel #9
0
def create_option(context, name, role):
    handle_named_example_resource(context, "Option", name, role=role)
Beispiel #10
0
def create_role_from_json(context, role_name):
    json_obj = json.loads(context.text)
    handle_named_example_resource(context, Role, role_name, **json_obj)
Beispiel #11
0
def named_example_resource(context, resource_type, example_name, **kwargs):
  handle_named_example_resource(context, resource_type, example_name, **kwargs)
Beispiel #12
0
def named_example_from_json(context, resource_type, example_name):
  text = handle_template_text(context, context.text)
  json_obj = json.loads(text)
  handle_named_example_resource(
      context, resource_type, example_name, **json_obj)
def create_category(context, name, scope):
  handle_named_example_resource(context, 'Category', name, scope_id=int(scope))
Beispiel #14
0
def create_role_from_json(context, role_name):
  json_obj = json.loads(context.text)
  handle_named_example_resource(context, Role, role_name, **json_obj)