[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 1/4] Add logpicker into utils



On Mon, Sep 13, 2010 at 11:24:34AM +0200, Ales Kozumplik wrote:
> 
> this method name:
> >+    def _get_file(self, file):
> >+        self.get_files([file])
> >+
> and this method name:
> >+    def _get_files(self, files):
> >+        if self._used:
> >+            self._write_separator()
> >+        self._used = True
> >+
> >+        for filename in files:
> >+            self.logfile.write('%s:\n' % filename)
> >+            try:
> >+                f = open(filename, 'r')
> >+            except (IOError) as e:
> >+                self.logfile.write("Exception while opening: %s\n" % e)
> >+                continue
> >+
> >+            self.logfile.writelines(f)
> >+            f.close()
> are not too fortunate: the methods are not getting anything, have
> side effects and return None. Just '_write_file()' or similar?

Also, there is no need to have two methods here. Use one method and
check to see if you get a list, and if not make it a 1 element list.
Like this:


def _get_files(self, files):
    if not isinstance(files, list):
        files = [files]


Brian

-- 
Brian C. Lane / Anaconda Team
Port Orchard, WA (PST8PDT)

Attachment: pgp7IYSFHH38o.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]