changeset 465:ff9df01b048c

New home for registerfile() (Logical change 1.136)
author optonline.net!jeffpc
date Thu, 01 Jan 2004 21:18:32 +0000
parents ae0d91ff36bd
children 4bfb7f8f17a3
files av_utils.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/av_utils.py	Thu Jan 01 21:18:32 2004 +0000
+++ b/av_utils.py	Thu Jan 01 21:18:32 2004 +0000
@@ -25,6 +25,7 @@
 import re
 
 import av_debug
+import av_settings
 
 class Utils:
 	""" Class to hold all utilities data and more """
@@ -78,6 +79,16 @@
 		
 		returns string """
 		return text.replace("\\_","_")
-	
+
+	def registerfile(self,name,timeout=0xfefefefefe):
+		""" Adds a file to the database, which will be later deleted (after
+		timeout minutes
+		
+		does not return anything """
+		if (timeout==0xfefefefefe):
+			timeout = int(av_settings.getSetting(self.conn,"filelifespan"))
+		dbid = self.db.newid()
+		dbid.execute("INSERT INTO `files` (`id`, `file`, `created`, `destroyed`) VALUES (NULL, \"" + name + "\", " + str(self.conn.now()) + ", " + str(self.conn.now()+timeout*60) + ");")
+
 if __name__ == "__main__":
 	print "ERROR"