Skip to content

Commit dcad7b7

Browse files
authored
Merge pull request #86 from the-it/bugfix/attribut_data_not_needed_anymore
remove the property .data
2 parents 0454bab + 31ef0ad commit dcad7b7

File tree

1 file changed

+6
-6
lines changed
  • flask-connexion-rest-part-2/version_1

1 file changed

+6
-6
lines changed

flask-connexion-rest-part-2/version_1/people.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def read_all():
2020

2121
# Serialize the data for the response
2222
person_schema = PersonSchema(many=True)
23-
data = person_schema.dump(people).data
23+
data = person_schema.dump(people)
2424
return data
2525

2626

@@ -40,7 +40,7 @@ def read_one(person_id):
4040

4141
# Serialize the data for the response
4242
person_schema = PersonSchema()
43-
data = person_schema.dump(person).data
43+
data = person_schema.dump(person)
4444
return data
4545

4646
# Otherwise, nope, didn't find that person
@@ -73,14 +73,14 @@ def create(person):
7373

7474
# Create a person instance using the schema and the passed in person
7575
schema = PersonSchema()
76-
new_person = schema.load(person, session=db.session).data
76+
new_person = schema.load(person, session=db.session)
7777

7878
# Add the person to the database
7979
db.session.add(new_person)
8080
db.session.commit()
8181

8282
# Serialize and return the newly created person in the response
83-
data = schema.dump(new_person).data
83+
data = schema.dump(new_person)
8484

8585
return data, 201
8686

@@ -142,7 +142,7 @@ def update(person_id, person):
142142

143143
# turn the passed in person into a db object
144144
schema = PersonSchema()
145-
update = schema.load(person, session=db.session).data
145+
update = schema.load(person, session=db.session)
146146

147147
# Set the id to the person we want to update
148148
update.person_id = update_person.person_id
@@ -152,7 +152,7 @@ def update(person_id, person):
152152
db.session.commit()
153153

154154
# return updated person in the response
155-
data = schema.dump(update_person).data
155+
data = schema.dump(update_person)
156156

157157
return data, 200
158158

0 commit comments

Comments
 (0)