summaryrefslogtreecommitdiffstats
path: root/save_carefully.py
diff options
context:
space:
mode:
authorsubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-22 06:17:24 +0100
committersubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-22 06:17:24 +0100
commitb774c42333841d5b26cde5c69e79502d5a0373b1 (patch)
treea1a63101e6721380420c19d548f68339d459c7fc /save_carefully.py
parent3784eb97209c00da703036031fa5127197ccef38 (diff)
downloadtroggle-b774c42333841d5b26cde5c69e79502d5a0373b1.tar.gz
troggle-b774c42333841d5b26cde5c69e79502d5a0373b1.tar.bz2
troggle-b774c42333841d5b26cde5c69e79502d5a0373b1.zip
[svn] switched from dodgy manually writing to logfile to using python's logging module, which seems great
Diffstat (limited to 'save_carefully.py')
-rw-r--r--save_carefully.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/save_carefully.py b/save_carefully.py
index f72b4fa..ee7c0cc 100644
--- a/save_carefully.py
+++ b/save_carefully.py
@@ -1,4 +1,4 @@
-from settings import LOGFILE
+import logging
def save_carefully(objectType, lookupAttribs={}, nonLookupAttribs={}):
"""Looks up instance using lookupAttribs and carries out the following:
@@ -18,14 +18,12 @@ def save_carefully(objectType, lookupAttribs={}, nonLookupAttribs={}):
setattr(instance, k, v)
instance.save()
- if LOGFILE:
- if created:
- LOGFILE.write(unicode(instance)+u' was just added to the database for the first time. \n')
-
- if not created and instance.new_since_parsing:
- LOGFILE.write(unicode(instance)+" has been modified using Troggle, so the current script left it as is. \n")
+ if created:
+ logging.info(unicode(instance)+u' was just added to the database for the first time. \n')
+
+ if not created and instance.new_since_parsing:
+ logging.info(unicode(instance)+" has been modified using Troggle, so the current script left it as is. \n")
- if not created and not instance.new_since_parsing:
- LOGFILE.write(unicode(instance)+" existed in the database unchanged since last parse. It was overwritten by the current script. \n")
- LOGFILE.flush()
+ if not created and not instance.new_since_parsing:
+ logging.info(unicode(instance)+" existed in the database unchanged since last parse. It was overwritten by the current script. \n")
return (instance, created) \ No newline at end of file