Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ create table comments (
body TEXT,
author VARCHAR(30),
FOREIGN KEY(post_id) REFERENCES posts(id)
);
);

Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
create table posts_and_comments (
id INTEGER PRIMARY KEY,
post_id INTEGER,
is_post BOOLEAN,
body TEXT,
old_post_id INTEGER,
parent_post_id INTEGER,
slug VARCHAR(30),
title VARCHAR(30),
title VARCHAR(255) NOT NULL,
body TEXT,
author VARCHAR(30)
)
);

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
insert into posts_and_comments(
old_post_id,
slug,
title,
body
) select id, slug, title, body from posts;
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
insert into posts_and_comments
(post_id,
is_post,
body,
author)
VALUES

select post_id,
0,
insert into posts_and_comments (
parent_post_id,
body,
author
from comments;
) select post_id, body, author from comments;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
drop table posts CASCADE;
drop table posts cascade;
Binary file modified examples/week_8/posts_and_comments/weblog.sqlite3
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/week_9/passwords_with_tests/passwords/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def signup():
try:
cursor.execute(query, (username, hashed))
connection.commit()
return {}
return {}, 404
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was probably the problem

except sqlite3.IntegrityError as e:
template = "An exception of type {0} occurred. Arguments:\n{1!r}"
message = template.format(type(e).__name__, e.args)
Expand Down