Commit ed2a7c1b authored by Gaute Hope's avatar Gaute Hope
Browse files

The append and update code in at.py has been updated for the

* The append and update code in at.py has been updated for the POSIXLY_CORRECT formatted date/time format, and everything should be working again
* All code depending on the 'locale' module has been removed and it is no longer imported.

svn path=/trunk/; revision=1071
parent dd08f9b0
2008-02-06 Gaute Hope <eg@gaute.vetsj.com>
* The append and update code in at.py has been updated for the POSIXLY_CORRECT formatted date/time format, and everything should be working again
* All code depending on the 'locale' module has been removed and it is no longer imported.
2008-02-05 Gaute Hope <eg@gaute.vetsj.com>
* src/gnome-schedule.py, src/scheduleapplet.py: Changed POSIX_CORRECT to POSIXLY_CORRECT.
......
......@@ -100,16 +100,23 @@ class At:
if (output == True):
if len (line) > 1 and line[0] != '#':
m = self.atRecordRegex[3].match(line)
if m != None:
print m.groups ()
if m != None:
# Time
time = m.groups ()[4]
time = m.groups ()[4][:-3]
# Date
date= m.groups ()[5] + "-" + m.groups ()[2] + "-" + m.groups ()[3]
day = m.groups ()[3]
month = m.groups ()[2]
for monthname in self.months:
date = date.replace (monthname, self.months[monthname])
month = month.replace (monthname, self.months[monthname])
if int (day) < 10:
day = "0" + day
if int (month) < 10:
month = "0" + month
date = day + "." + month + "." + m.groups ()[5]
job_id = m.groups ()[0]
class_id = m.groups ()[6]
......@@ -203,8 +210,8 @@ class At:
# print "$" + runat + "$"
#regexp1 = re.compile("([0-9][0-9]):([0-9][0-9])\ ([0-9][0-9])\.([0-9][0-9])\.([0-9][0-9][0-9][0-9])")
#print "Testing: " + runat
regexp1 = re.compile ("([0-9][0-9]):([0-9][0-9])\ ([0-9][0-9][0-9][0-9])\-([0-9][0-9])\-([0-9][0-9])")
regexp2 = re.compile("([0-9][0-9]):([0-9][0-9])")
regexp1 = re.compile ("([0-9][0-9])([0-9][0-9])\ ([0-9][0-9])\.([0-9][0-9])\.([0-9][0-9][0-9][0-9])")
regexp2 = re.compile("([0-9][0-9])([0-9][0-9])")
regexp3 = re.compile("([0-9][0-9])\.([0-9][0-9])\.([0-9][0-9][0-9][0-9])")
runat_g1 = regexp1.match(runat)
......@@ -218,7 +225,7 @@ class At:
cminute = ctime[4]
if runat_g1:
(hour, minute, year, month, day) = runat_g1.groups()
(hour, minute, day, month, year) = runat_g1.groups()
hour = int(hour)
minute = int(minute)
year = int(year)
......@@ -324,7 +331,6 @@ class At:
def append (self, runat, command, title):
print "append"
tmpfile = tempfile.mkstemp ()
fd, path = tmpfile
tmp = os.fdopen(fd, 'w')
......@@ -338,20 +344,19 @@ class At:
if self.user != "root":
#changes the ownership
os.chown(path, self.uid, self.gid)
execute = config.getSubin() + " " + self.user + " -c \"" + config.getAtbin() + " " + runat + " -f " + path + " && exit\""
execute = config.getSubin() + " " + self.user + " -c \"" + config.getAtbin() + " -f " + path + " " + runat + " && exit\""
child_stdin, child_stdout, child_stderr = os.popen3(execute)
else:
execute = config.getAtbin() + " " + runat + " -f " + path
execute = config.getAtbin() + " -f " + path + " " + runat
child_stdin, child_stdout, child_stderr = os.popen3(execute)
else:
execute = config.getAtbin() + " " + runat + " -f " + path
execute = config.getAtbin() + " -f " + path + " " + runat
child_stdin, child_stdout, child_stderr = os.popen3(execute)
err = child_stderr.readlines ()
job_id = 0
for line in err:
print line
t = self.parse (line, False)
if t != False:
job_id = t
......@@ -393,13 +398,13 @@ class At:
if self.user != "root":
#changes the ownership
os.chown(path, self.uid, self.gid)
execute = config.getSubin() + " " + self.ParentClass.user + " -c \"" + config.getAtbin() + " " + runat + " -f " + path + " && exit\""
execute = config.getSubin() + " " + self.user + " -c \"" + config.getAtbin() + " -f " + path + " " + runat + " && exit\""
child_stdin, child_stdout, child_stderr = os.popen3(execute)
else:
execute = config.getAtbin() + " " + runat + " -f " + path
execute = config.getAtbin() + " -f " + path + " " + runat
child_stdin, child_stdout, child_stderr = os.popen3(execute)
else:
execute = config.getAtbin() + " " + runat + " -f " + path
execute = config.getAtbin() + " -f " + path + " " + runat
child_stdin, child_stdout, child_stderr = os.popen3(execute)
err = child_stderr.readlines ()
......
......@@ -206,7 +206,7 @@ class AtEditor:
#parse
(hour, minute, day, month, year) = self.__parse_time__(self.time, self.date)
self.runat = hour + ":" + minute + " " + year + "-" + month + "-" + day
self.runat = hour + minute + " " + day + "." + month + "." + year
self.spin_year.set_value (int (year))
self.spin_month.set_value (int (month))
self.spin_day.set_value (int (day))
......@@ -488,7 +488,7 @@ class AtEditor:
else:
day = str(day)
self.runat = hour + ":" + minute + " " + year + "-" + month + "-" + day
self.runat = hour + minute + " " + day + "." + month + "." + year
def popup_error_no_digit (self, field):
......@@ -510,7 +510,7 @@ class AtEditor:
hour = ctime[3]
minute = ctime[4]
self.runat = str(hour) + ":" + str(minute) + " " + str (year) + "-" + str (month) + "-" + str(day)
self.runat = str(hour) + str(minute) + " " + str(day) + "." + str(month) + "." + str (year)
self.spin_hour.set_value(int(hour))
self.spin_minute.set_value(int(minute))
......@@ -530,7 +530,9 @@ class AtEditor:
self.text_task_buffer.set_text(self.command)
def __parse_time__ (self, time, date):
regexp_date = re.compile("([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])")
print time
print date
regexp_date = re.compile("([0-9][0-9])\.([0-9][0-9])\.([0-9][0-9][0-9][0-9])")
regexp_time = re.compile("([0-9][0-9]):([0-9][0-9])")
time_g = regexp_time.match(time)
......@@ -539,7 +541,7 @@ class AtEditor:
date_g = regexp_date.match(date)
if date_g:
(year, month, day) = date_g.groups()
(day, month, year) = date_g.groups()
return hour, minute, day, month, year
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment