Skip to content

Commit

Permalink
encoding fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jkakavas committed Jan 5, 2014
1 parent 7ce5141 commit 01af554
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions creepy/CreepyMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def updateCurrentLocationDetails(self, index):
'''
location = self.locationsTableModel.locations[index.row()]
self.ui.currentTargetDetailsLocationValue.setText(location.shortName)
self.ui.currentTargetDetailsDateValue.setText(location.datetime.strftime('%a %b %d,%H:%M:%S %z'))
self.ui.currentTargetDetailsDateValue.setText(location.datetime.strftime('%Y-%m-%d %H:%M:%S %z'))
self.ui.currentTargetDetailsSourceValue.setText(location.plugin)
self.ui.currentTargetDetailsContextValue.setText(location.context)

Expand Down Expand Up @@ -548,8 +548,8 @@ def showPersonProjectWizard(self):
personProjectWizard.ProjectWizardSelectedTargetsTable = ProjectWizardSelectedTargetsTable([], self)
if personProjectWizard.exec_():
project = Project()
project.projectName = unicode(personProjectWizard.ui.personProjectNameValue.text(), 'utf-8')
project.projectKeywords = [keyword.strip() for keyword in unicode(personProjectWizard.ui.personProjectKeywordsValue.text(), 'utf-8').split(',')]
project.projectName = unicode(personProjectWizard.ui.personProjectNameValue.text().toUtf8(), 'utf-8')
project.projectKeywords = [keyword.strip() for keyword in unicode(personProjectWizard.ui.personProjectKeywordsValue.text().toUtf8(), 'utf-8').split(',')]
project.projectDescription = personProjectWizard.ui.personProjectDescriptionValue.toPlainText()
project.enabledPlugins = personProjectWizard.readSearchConfiguration()
project.dateCreated = datetime.datetime.now()
Expand Down
4 changes: 2 additions & 2 deletions creepy/plugins/flickr/flickr.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def getLocationsFromPhotos(self, photos):
if photo.attrib['latitude'] != '0':
loc = {}
loc['plugin'] = "flickr"
photo_link = 'http://www.flickr.com/photos/%s/%s' % (photo.attrib['owner'], photo.attrib['id'])
photo_link = unicode('http://www.flickr.com/photos/%s/%s' % (photo.attrib['owner'], photo.attrib['id']), 'utf-8')
title = photo.attrib['title']
#If the title is a string, make it unicode
if isinstance(title,str):
Expand Down Expand Up @@ -160,7 +160,7 @@ def returnLocations(self, target, search_params):

def constructContextInfoWindow(self, link, date):
html = unicode(self.options_string['infowindow_html'], 'utf-8')
return html.replace("@LINK@",link).replace("@DATE@",date.strftime("%a %b %d,%H:%M:%S %z")).replace("@PLUGIN@", u"flickr")
return html.replace("@LINK@",link).replace("@DATE@",date.strftime("%Y-%m-%d %H:%M:%S %z")).replace("@PLUGIN@", u"flickr")

def getLabelForKey(self, key):
'''
Expand Down
2 changes: 1 addition & 1 deletion creepy/plugins/instagram/instagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def showWarning(self, title, text):
def constructContextInfoWindow(self, photo):
html = unicode(self.options_string['infowindow_html'],'utf-8')
caption = photo.caption.text if photo.caption else unicode('No Caption', 'utf-8')
return html.replace("@TEXT@",caption).replace("@DATE@",photo.created_time.strftime("%a %b %d,%H:%M:%S %z")).replace("@PLUGIN@", u"instagram").replace("@LINK@", photo.link)
return html.replace("@TEXT@",caption).replace("@DATE@",photo.created_time.strftime("%Y-%m-%d %H:%M:%S %z")).replace("@PLUGIN@", u"instagram").replace("@LINK@", photo.link)


def getLabelForKey(self, key):
Expand Down
2 changes: 1 addition & 1 deletion creepy/plugins/twitter/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def constructContextInfoWindow(self, tweet):

html = unicode(self.options_string['infowindow_html'], 'utf-8')
#returned value also becomes unicode since tweet.text is unicode, and carries the encoding also
return html.replace("@TEXT@",tweet.text).replace("@DATE@",tweet.created_at.strftime("%a %b %d,%H:%M:%S %z")).replace("@PLUGIN@", u"twitter")
return html.replace("@TEXT@",tweet.text).replace("@DATE@",tweet.created_at.strftime("%Y-%m-%d %H:%M:%S %z")).replace("@PLUGIN@", u"twitter")

def getCenterOfPolygon(self, coord):
'''
Expand Down

0 comments on commit 01af554

Please sign in to comment.