Adding a CMS to Your Pyramid Web App Transcripts
Chapter: Markdown: A better format than HTML
Lecture: Oops, we broke our edit moving to DB

Login or purchase this course to watch this video and the rest of the course contents.
0:00 now really, really quick. There's one thing we have to address that when we moved from our fake data over to the database, we didn't quite get right.
0:08 Look, if we go over to this page here and we try to edit it, it's gonna be great. We could just edit the page, right? Yeah, not so much.
0:16 Well, what is the problem? The problem is this four here and says air binding parameter zero. Probably an unsupported type.
0:25 And it's where page idea is equal to something. Look at our Pedro, quick. So our pages here, the i d. Is an integer.
0:34 Now we're comparing that over here when we go to our view model and we say get page by i d and we're passing over the page i d And it's supposed to be an integer great.
0:44 And then we do this like so however what you'll see right here This this is actually coming back as a string and Python PyCharm just wasn't able to see this mismatch.
0:55 If I tell it explicit what it is, it can say. Oh, no, no, no. You actually can't do that. I don't know what you're thinking.
1:00 If I put into your not doesn't. It doesn't know. So we need to convert this to an integer, which is problem.
1:07 So let's say it and let's just put minus one or something. So in case there is no value, we're not going to get something that will crash.
1:14 Trying to be converted to an integer It just come back is minus one, which never exists. All right, let's just try that again.
1:22 Oh, no, There's still one more problem. Let's go. Actually, check this out. We made another mistake here. Where pays ideas equal to I de nu Nu Nu.
1:32 This is not the function that has nothing to do. This I d. Here we go. Let's try this. My good. Now. Yes. Alright. Sorry about that.
1:40 We got this working and consider just skipping over that and fixing it. But the same time, I do want to let you know if you run into that problem.
1:47 What? What It was. Let's just make sure that we can also edit a redirect. Yeah, it looks like fine without oh, notice of the page that it are.
1:55 Redirect. Yep. Looks like we can edit the redirect. No problem. Okay, great. Well, it looks like our admin is now working once again.


Talk Python's Mastodon Michael Kennedy's Mastodon