Browse Source

Fix some bugs with deleting

Getty Ritter 4 years ago
parent
commit
2f57a50a42
3 changed files with 7 additions and 5 deletions
  1. 1 1
      lc/app.py
  2. 5 3
      lc/web.py
  3. 1 1
      stubs/peewee.py

+ 1 - 1
lc/app.py

@@ -155,7 +155,7 @@ class GetLink(Endpoint):
 
     def api_delete(self, user: str, link: str):
         u = self.require_authentication(user)
-        u.get_link(int(link)).delete().execute()
+        u.get_link(int(link)).delete_instance()
         return self.api_ok(u.base_url())
 
     def html(self, user: str, link: str):

+ 5 - 3
lc/web.py

@@ -122,9 +122,11 @@ class Endpoint:
         try:
             return self.html(*args, **kwargs)
         except e.LCException as exn:
-            page = render(
-                "main", title="error", content=f"shit's fucked yo: {exn}", user=None,
-            )
+            page = render("main", v.Page(
+                title="error",
+                content=f"shit's fucked yo: {exn}",
+                user=self.user,
+            ))
             return (page, exn.http_code())
         except e.LCRedirect as exn:
             return flask.redirect(exn.to_path())

+ 1 - 1
stubs/peewee.py

@@ -33,7 +33,7 @@ class Model:
     def save(self):
         pass
 
-    def delete(self) -> Any:
+    def delete_instance(self) -> Any:
         pass