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

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

 



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: pgpS4ifKDCjTd.pgp
Description: PGP signature

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux