def add_prefix(self):

        p = Prefix()

        # Sanitize input parameters
        if 'vrf' in request.params:
            try:
                if request.params['vrf'] is None or len(request.params['vrf']) == 0:
                    p.vrf = None
                else:
                    p.vrf = VRF.get(int(request.params['vrf']))
            except ValueError:
                return json.dumps({'error': 1, 'message': "Invalid VRF ID '%s'" % request.params['vrf']})
            except NipapError, e:
                return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})

        if 'description' in request.params:
            if request.params['description'].strip() != '':
                p.description = request.params['description'].strip()

        if 'expires' in request.params:
            if request.params['expires'].strip() != '':
                p.expires = request.params['expires'].strip(' "')

        if 'comment' in request.params:
            if request.params['comment'].strip() != '':
                p.comment = request.params['comment'].strip()

        if 'node' in request.params:
            if request.params['node'].strip() != '':
                p.node = request.params['node'].strip()

        if 'status' in request.params:
            p.status = request.params['status'].strip()

        if 'type' in request.params:
            p.type = request.params['type'].strip()

        if 'pool' in request.params:
            if request.params['pool'].strip() != '':
                try:
                    p.pool = Pool.get(int(request.params['pool']))
                except NipapError, e:
                    return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})

        if 'country' in request.params:
            if request.params['country'].strip() != '':
                p.country = request.params['country'].strip()

        if 'order_id' in request.params:
            if request.params['order_id'].strip() != '':
                p.order_id = request.params['order_id'].strip()

        if 'customer_id' in request.params:
            if request.params['customer_id'].strip() != '':
                p.customer_id = request.params['customer_id'].strip()

        if 'alarm_priority' in request.params:
            p.alarm_priority = request.params['alarm_priority'].strip()

        if 'monitor' in request.params:
            if request.params['monitor'] == 'true':
                p.monitor = True
            else:
                p.monitor = False

        if 'vlan' in request.params:
            if request.params['vlan'].strip() != '':
                p.vlan = request.params['vlan']

        if 'tags' in request.params:
            p.tags = json.loads(request.params['tags'])

        if 'avps' in request.params:
            p.avps = json.loads(request.params['avps'])

        # arguments
        args = {}
        if 'from_prefix[]' in request.params:
            args['from-prefix'] = request.params.getall('from_prefix[]')
        if 'from_pool' in request.params:
            try:
                args['from-pool'] = Pool.get(int(request.params['from_pool']))
            except NipapError, e:
                return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})
        if 'family' in request.params:
            args['family'] = request.params['family']
        if 'prefix_length' in request.params:
            args['prefix_length'] = request.params['prefix_length']

        # manual allocation?
        if args == {}:
            if 'prefix' in request.params:
                p.prefix = request.params['prefix']

        try:
            p.save(args)
        except NipapError, e:
            return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})

        return json.dumps(p, cls=NipapJSONEncoder)
return path as expected by PyGIT
dataset/ETHPy150Open SpriteLink/NIPAP/nipap-www/nipapwww/controllers/xhr.py/XhrController.add_prefix--crossover with--dataset/ETHPy150Open hvr/trac-git-plugin/tracext/git/git_fs.py/GitNode.__git_path