ooiservices/app/redmine/routes.py
def update_redmine_ticket():
    '''
    Update a specific redmine ticket.
    '''
    data = request.data
    if not data:
        return Response(response='{"error":"Invalid request"}', status=400, mimetype="application/json")

    # Save the request as a dictionary
    dataDict = json.loads(data)

    # Check the required field (resource_id)
    if 'resource_id' not in dataDict:
        return Response(response='{"error":"Invalid request: resource_id not defined"}',
                        status=400, mimetype="application/json")

    update_fields = ['project_id', 'subject', 'due_date', 'description', 'priority_id',
                     'assigned_to_id', 'start_date', 'estimated_hours', 'status_id', 'notes',
                     'tracker_id', 'parent_issue_id', 'done_ratio']
    # Get all the update fields from the request
    fields = dict()
    for field in update_fields:
        if field in dataDict:
            fields[field] = dataDict[field]

    # Log into Redmine
    redmine = redmine_login()

    # Get the issue, update all fields except the issue resource id
    issue = redmine.issue.get(dataDict['resource_id'])
    for key, value in fields.iteritems():
        if 'resource_id' != key:
            setattr(issue, key, value)
    issue.save()

    return data, 201

    Update a specific redmine ticket.
    
Update a specific redmine ticket.
Update a specific redmine ticket .
def update_redmine_ticket():
    data = request.data
    if not data:
        return Response(response='{"error":"Invalid request"}', status=400, mimetype="application/json")
    dataDict = json.loads(data)
    if 'resource_id' not in dataDict:
        return Response(response='{"error":"Invalid request: resource_id not defined"}',
                        status=400, mimetype="application/json")
    update_fields = ['project_id', 'subject', 'due_date', 'description', 'priority_id',
                     'assigned_to_id', 'start_date', 'estimated_hours', 'status_id', 'notes',
                     'tracker_id', 'parent_issue_id', 'done_ratio']
    fields = dict()
    for field in update_fields:
        if field in dataDict:
            fields[field] = dataDict[field]
    redmine = redmine_login()
    issue = redmine.issue.get(dataDict['resource_id'])
    for key, value in fields.iteritems():
        if 'resource_id' != key:
            setattr(issue, key, value)
    issue.save()
    return data, 201
def update_redmine_ticket ( ) : data = request . data if not data : return Response ( response = '{"error":"Invalid request"}' , status = 400 , mimetype = "application/json" ) dataDict = json . loads ( data ) if 'resource_id' not in dataDict : return Response ( response = '{"error":"Invalid request: resource_id not defined"}' , status = 400 , mimetype = "application/json" ) update_fields = [ 'project_id' , 'subject' , 'due_date' , 'description' , 'priority_id' , 'assigned_to_id' , 'start_date' , 'estimated_hours' , 'status_id' , 'notes' , 'tracker_id' , 'parent_issue_id' , 'done_ratio' ] fields = dict ( ) for field in update_fields : if field in dataDict : fields [ field ] = dataDict [ field ] redmine = redmine_login ( ) issue = redmine . issue . get ( dataDict [ 'resource_id' ] ) for key , value in fields . iteritems ( ) : if 'resource_id' != key : setattr ( issue , key , value ) issue . save ( ) return data , 201
Update a specific redmine ticket.
Update a specific redmine ticket .
'''
    Update a specific redmine ticket.
    ''' # Save the request as a dictionary # Check the required field (resource_id) # Get all the update fields from the request # Log into Redmine # Get the issue, update all fields except the issue resource id