From: James Troup Date: Thu, 27 Sep 2001 01:24:15 +0000 (+0000) Subject: add touch_file() and fix where_am_i to work. X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=8db87c142a2f0816360df7302b6a1177f318b00f;p=dak.git add touch_file() and fix where_am_i to work. --- 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];