Example #1
0
	def update(self, id):
		query = ''

		value = {'id': id}

		acceptedFields = ['title']

		for i in acceptedFields:
			if i in request.params: 
				value[i] = request.params[i]
				query += "SET "+i+" = :"+i
		if len(query) == 0:
			return error('no data sent (accepted fields: '+(','.join(acceptedFields))+')')

		db = database.connect()
		query = "UPDATE albums "+query+" WHERE id = :id"

		cur = db.execute(query, value)
		db.commit()
		db.close()
		return success()
Example #2
0
    def update(self, id):
        query = ''

        value = {'id': id}

        acceptedFields = ['title']

        for i in acceptedFields:
            if i in request.params:
                value[i] = request.params[i]
                query += "SET " + i + " = :" + i
        if len(query) == 0:
            return error('no data sent (accepted fields: ' +
                         (','.join(acceptedFields)) + ')')

        db = database.connect()
        query = "UPDATE albums " + query + " WHERE id = :id"

        cur = db.execute(query, value)
        db.commit()
        db.close()
        return success()
Example #3
0
def albumsPhotosPost(id):
	if not 'photo_id' in request.params:
		return error(msg='the param \'photo_id\' is missing')
	return Album().add_photo(id, request.params['photo_id'])
Example #4
0
def albumsPhotosPost(id):
    if not 'photo_id' in request.params:
        return error(msg='the param \'photo_id\' is missing')
    return Album().add_photo(id, request.params['photo_id'])