Rename command objects by inserting an underscore between the version part
[pykickstart.git] / pykickstart / commands / timezone.py
blobc2bb8410cdb5a92a997888439c90c4b527429093
2 # Chris Lumens <clumens@redhat.com>
4 # Copyright 2005, 2006, 2007 Red Hat, Inc.
6 # This software may be freely redistributed under the terms of the GNU
7 # general public license.
9 # You should have received a copy of the GNU General Public License
10 # along with this program; if not, write to the Free Software
11 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13 from pykickstart.base import *
14 from pykickstart.errors import *
15 from pykickstart.options import *
17 from rhpl.translate import _
18 import rhpl.translate as translate
20 translate.textdomain("pykickstart")
22 class FC3_Timezone(KickstartCommand):
23 def __init__(self, writePriority=0, isUtc=False, timezone=""):
24 KickstartCommand.__init__(self, writePriority)
25 self.isUtc = isUtc
26 self.timezone = timezone
28 def __str__(self):
29 if self.timezone != "":
30 if self.isUtc:
31 utc = "--isUtc"
32 else:
33 utc = ""
35 return "# System timezone\ntimezone %s %s\n" %(utc, self.timezone)
36 else:
37 return ""
39 def parse(self, args):
40 op = KSOptionParser(lineno=self.lineno)
41 op.add_option("--utc", "--isUtc", dest="isUtc", action="store_true", default=False)
43 (opts, extra) = op.parse_args(args=args)
44 self._setToSelf(op, opts)
46 if len(extra) != 1:
47 raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("A single argument is expected for the %s command") % "timezone")
49 self.timezone = extra[0]