Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 144611
Collapse All | Expand All

(-)ccal-0.6.py (-6 / +23 lines)
Lines 81-86 Link Here
81
import calendar
81
import calendar
82
import datetime
82
import datetime
83
import os
83
import os
84
# tempfile is used as a variable name a lot.
85
from tempfile import mkstemp
84
import sys
86
import sys
85
import httplib, urllib, pickle, urllib2
87
import httplib, urllib, pickle, urllib2
86
import ConfigParser
88
import ConfigParser
Lines 846-856 Link Here
846
			except:
848
			except:
847
				pass
849
				pass
848
850
849
			os.system(self.editor+" "+self.temppath+"/"+temptime)
851
			# this is safer. should be used everywhere.
850
			tempfile=open(self.temppath+"/"+temptime)
852
			(fd, tempfilename) = mkstemp(".entry","ccal")
851
			tempstring=tempfile.read()
853
			os.close(fd)
852
			templines=tempstring.split("\n")
854
			# open editor
853
			entry=templines[0]
855
			os.system(" ".join((self.editor,tempfilename)))
856
			# get the new entry (due to mkstemp file gets created anyway,
857
			# but still better to "try")
858
			try:
859
				tempfile=open(tempfilename)
860
				tempstring=tempfile.read()
861
				templines=tempstring.splitlines()
862
				entry=templines[0]
863
				fullentry=templines[1:]
864
			except:
865
				if tempfile:
866
					tempfile.close()
867
				entry=""
868
			
869
			# cleanup temp file
870
			os.unlink(tempfilename)
854
			
871
			
855
			#re-initialise stuff as vim seems to mess it up
872
			#re-initialise stuff as vim seems to mess it up
856
			self.scr=curses.initscr()
873
			self.scr=curses.initscr()
Lines 868-879 Link Here
868
				self.handleException(e)
885
				self.handleException(e)
869
			#refresh
886
			#refresh
870
			self.scr.refresh()
887
			self.scr.refresh()
871
			fullentry=templines[1:]
872
		
888
		
873
		try:
889
		try:
874
			curses.curs_set(0)
890
			curses.curs_set(0)
875
		except:
891
		except:
876
			pass
892
			pass
893
			
877
		if entry!="":
894
		if entry!="":
878
			self._cal.addItem(ccalItem(entry,fullentry=fullentry))
895
			self._cal.addItem(ccalItem(entry,fullentry=fullentry))
879
		curses.noecho()
896
		curses.noecho()

Return to bug 144611