X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils.py;h=f9d40b0c466453913080827fb597bb89b5e44a94;hb=c1c7681bf43c58dd5cf34d1c1814a75ae594688b;hp=60efbb9b14832c4d734c80c3737e4e14aa62e7e6;hpb=20ef2ddf06d0c75fd3786fae338ccc3161868f7e;p=dak.git diff --git a/utils.py b/utils.py index 60efbb9b..f9d40b0c 100644 --- a/utils.py +++ b/utils.py @@ -1,6 +1,6 @@ # Utility functions # Copyright (C) 2000, 2001 James Troup -# $Id: utils.py,v 1.33 2001-09-26 03:49:16 troup Exp $ +# $Id: utils.py,v 1.34 2001-09-27 01:24:15 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -67,6 +67,10 @@ def open_file(filename, mode='r'): raise cant_open_exc, filename return f +def touch_file(filename): + fd = os.open(filename, os.O_RDONLY | os.O_CREAT); + os.close(fd); + ###################################################################################### # From reportbug @@ -361,8 +365,9 @@ def copy (src, dest, overwrite = 0): def where_am_i (): res = socket.gethostbyaddr(socket.gethostname()); - if DefaultCnf.get("Config::" + res[0] + "::DatbaseHostname"): - return DefaultCnf["Config::" + res[0] + "::DatabaseHostname"] + database_hostname = DefaultCnf.get("Config::" + res[0] + "::DatabaseHostname"); + if database_hostname: + return database_hostname; else: return res[0];