forked from expo/troggle
replace assert() with message logging
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import string
|
||||
import os
|
||||
import datetime
|
||||
import logging
|
||||
import re
|
||||
import json
|
||||
from subprocess import call
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import string
|
||||
import os
|
||||
import datetime
|
||||
import logging
|
||||
import re
|
||||
import resource
|
||||
from subprocess import call
|
||||
@@ -51,7 +50,7 @@ class DataIssue(TroggleModel):
|
||||
This is a use of the NOTIFICATION pattern:
|
||||
https://martinfowler.com/eaaDev/Notification.html
|
||||
|
||||
And we need to use it to replace all assertions in the code too:
|
||||
We have replaced all assertions in the code with messages and local fix-ups or skips:
|
||||
https://martinfowler.com/articles/replaceThrowWithNotification.html
|
||||
"""
|
||||
date = models.DateTimeField(auto_now_add=True, blank=True)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import sys
|
||||
import re
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.shortcuts import render
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import string
|
||||
import os
|
||||
import datetime
|
||||
import logging
|
||||
import re
|
||||
import resource
|
||||
import random
|
||||
import logging
|
||||
from subprocess import call
|
||||
|
||||
from urllib.parse import urljoin
|
||||
@@ -41,12 +41,12 @@ TROG = {
|
||||
|
||||
# This is module-level executable. This is a Bad Thing. Especially when it touches the file system.
|
||||
try:
|
||||
logging.basicConfig(level=logging.DEBUG,
|
||||
filename=settings.LOGFILE,
|
||||
filemode='w')
|
||||
logging.basicConfig(level=logging.DEBUG,
|
||||
filename=settings.LOGFILE,
|
||||
filemode='w')
|
||||
except:
|
||||
# Opening of file for writing is going to fail currently, so decide it doesn't matter for now
|
||||
pass
|
||||
# Opening of file for writing is going to fail currently, so decide it doesn't matter for now
|
||||
pass
|
||||
|
||||
def get_process_memory():
|
||||
usage=resource.getrusage(resource.RUSAGE_SELF)
|
||||
|
||||
Reference in New Issue
Block a user