From e396b01348126c1b8d5c3a93cb90bc309046f8e7 Mon Sep 17 00:00:00 2001 From: Choom Date: Wed, 25 Jan 2023 23:10:33 -0300 Subject: Cambiando datos archivados a int --- cgi/manage.py | 33 ++++++++++++++++++++++----------- cgi/templates/txt_archive.html | 6 +++--- 2 files changed, 25 insertions(+), 14 deletions(-) (limited to 'cgi') diff --git a/cgi/manage.py b/cgi/manage.py index cd1a215..5634a49 100644 --- a/cgi/manage.py +++ b/cgi/manage.py @@ -1398,8 +1398,6 @@ def manage(self, path_split): if not administrator: return - return - board = setBoard(path_split[3]) threads = FetchAll('SELECT * FROM archive WHERE boardid = %s ORDER BY timestamp DESC' % board['id']) @@ -1416,7 +1414,20 @@ def manage(self, path_split): with open(fname) as f: thread = json.load(f) - #thread['posts'] = [dict(list(zip(thread['keys'], row))) for row in thread['posts']] + thread['posts'] = [dict(list(zip(thread['keys'], row))) for row in thread['posts']] + + thread.pop('omitted', None) + thread.pop('omitted_img', None) + + #for post in thread['posts']: + # #if post['IS_DELETED'] > 0: + # # #vaciar campos si está borrado + # # post['name'] = 'muerto' + # # post['tripcode'] = '' + # # post['email'] = '' + # # post['message'] = '...' + # # post['timestamp_formatted'] = 'nunca' + # # post['posterid'] = '' #if 'posterid' not in thread['keys']: # for post in thread['posts']: @@ -1428,20 +1439,20 @@ def manage(self, path_split): # post['posterid'] = '' # # thread['keys'].append('posterid') - + # #if 'message' not in thread: # thread['message'] = thread['posts'][0]['message'] # thread['keys'].append('message') - #thread['posts'] = [[row[key] for key in thread['keys']] for row in thread['posts']] + thread['posts'] = [[row[key] for key in thread['keys']] for row in thread['posts']] - ##raise UserError(thread) + raise UserError(thread) - #try: - # with open(fname, "w") as f: - # json.dump(thread, f, indent=0) - #except: - # raise UserError("Can't edit") + try: + with open(fname, "w") as f: + json.dump(thread, f, indent=0) + except: + raise UserError("Can't edit") thread['posts'] = [dict(list(zip(thread['keys'], row))) for row in thread['posts']] diff --git a/cgi/templates/txt_archive.html b/cgi/templates/txt_archive.html index fe7f8c6..bdac2ca 100644 --- a/cgi/templates/txt_archive.html +++ b/cgi/templates/txt_archive.html @@ -15,10 +15,10 @@ - - + + - + -- cgit v1.2.1-18-gbd029