diff --git a/fanficfare/adapters/adapter_adastrafanficcom.py b/fanficfare/adapters/adapter_adastrafanficcom.py index c6bf44a0..62d0addc 100644 --- a/fanficfare/adapters/adapter_adastrafanficcom.py +++ b/fanficfare/adapters/adapter_adastrafanficcom.py @@ -137,7 +137,7 @@ class AdAstraFanficComSiteAdapter(BaseSiteAdapter): ## Everything until the next span class='label' svalue = '' while value and not defaultGetattr(value,'class') == 'label': - svalue += str(value) + svalue += unicode(value) value = value.nextSibling # sometimes poorly formated desc (
w/o
) leads # to all labels being included. diff --git a/fanficfare/adapters/adapter_ashwindersycophanthexcom.py b/fanficfare/adapters/adapter_ashwindersycophanthexcom.py index 96017c99..59424705 100644 --- a/fanficfare/adapters/adapter_ashwindersycophanthexcom.py +++ b/fanficfare/adapters/adapter_ashwindersycophanthexcom.py @@ -194,7 +194,7 @@ class AshwinderSycophantHexComAdapter(BaseSiteAdapter): val = val.nextSibling val = val.nextSibling while not defaultGetattr(val) == 'table': - svalue += str(val) + svalue += unicode(val) val = val.nextSibling self.setDescription(url,svalue) diff --git a/fanficfare/adapters/adapter_bdsmgeschichten.py b/fanficfare/adapters/adapter_bdsmgeschichten.py index ca0d5ffc..e58c7958 100644 --- a/fanficfare/adapters/adapter_bdsmgeschichten.py +++ b/fanficfare/adapters/adapter_bdsmgeschichten.py @@ -265,7 +265,7 @@ class BdsmGeschichtenAdapter(BaseSiteAdapter): nextLinkMatch = _REGEX_TRAILING_DIGIT.match(nextLink) if nextLinkMatch is not None: curChap = nextLinkMatch.group(1) - nextLink = re.sub(_REGEX_TRAILING_DIGIT, str(int(curChap) + 1), nextLink) + nextLink = re.sub(_REGEX_TRAILING_DIGIT, unicode(int(curChap) + 1), nextLink) else: break try: @@ -289,7 +289,7 @@ class BdsmGeschichtenAdapter(BaseSiteAdapter): curMax = self.maxChapter + step lastHit = True while True: - nextChapterUrl = re.sub(_REGEX_TRAILING_DIGIT, str(curMax), self.url) + nextChapterUrl = re.sub(_REGEX_TRAILING_DIGIT, unicode(curMax), self.url) if nextChapterUrl == self.url: logger.debug("Unable to guess next chapter because URL doesn't end in numbers") break; @@ -316,8 +316,8 @@ class BdsmGeschichtenAdapter(BaseSiteAdapter): logger.debug(curMax) for i in xrange(1, self.maxChapter): - nextChapterUrl = re.sub(_REGEX_TRAILING_DIGIT, str(i), self.url) - nextChapterTitle = re.sub("1", str(i), title1) + nextChapterUrl = re.sub(_REGEX_TRAILING_DIGIT, unicode(i), self.url) + nextChapterTitle = re.sub("1", unicode(i), title1) self.chapterUrls.append((nextChapterTitle, nextChapterUrl)) def getChapterText(self, url): diff --git a/fanficfare/adapters/adapter_bloodtiesfancom.py b/fanficfare/adapters/adapter_bloodtiesfancom.py index 03c63d2e..fda87953 100644 --- a/fanficfare/adapters/adapter_bloodtiesfancom.py +++ b/fanficfare/adapters/adapter_bloodtiesfancom.py @@ -244,7 +244,7 @@ class BloodTiesFansComAdapter(BaseSiteAdapter): # XXX ## Everything until the next strong tag. svalue = "" while not isinstance(value,bs.Tag) or value.name != 'strong': - svalue += str(value) + svalue += unicode(value) value = value.nextSibling self.setDescription(url,svalue) #self.story.setMetadata('description',stripHTML(svalue)) diff --git a/fanficfare/adapters/adapter_chaossycophanthexcom.py b/fanficfare/adapters/adapter_chaossycophanthexcom.py index 2fb7e4d8..e4234d8a 100644 --- a/fanficfare/adapters/adapter_chaossycophanthexcom.py +++ b/fanficfare/adapters/adapter_chaossycophanthexcom.py @@ -156,7 +156,7 @@ class ChaosSycophantHexComAdapter(BaseSiteAdapter): val = value value = value.previousSibling while not defaultGetattr(val,'class') == 'label': - svalue += str(val) + svalue += unicode(val) val = val.nextSibling self.setDescription(url,svalue) diff --git a/fanficfare/adapters/adapter_destinysgatewaycom.py b/fanficfare/adapters/adapter_destinysgatewaycom.py index c25a8887..7e964546 100644 --- a/fanficfare/adapters/adapter_destinysgatewaycom.py +++ b/fanficfare/adapters/adapter_destinysgatewaycom.py @@ -167,7 +167,7 @@ class DestinysGatewayComAdapter(BaseSiteAdapter): ## Everything until the next span class='label' svalue = "" while not defaultGetattr(value,'class') == 'label': - svalue += str(value) + svalue += unicode(value) value = value.nextSibling self.setDescription(url,svalue) #self.story.setMetadata('description',stripHTML(svalue)) diff --git a/fanficfare/adapters/adapter_dracoandginnycom.py b/fanficfare/adapters/adapter_dracoandginnycom.py index 157ca73e..5323573c 100644 --- a/fanficfare/adapters/adapter_dracoandginnycom.py +++ b/fanficfare/adapters/adapter_dracoandginnycom.py @@ -217,7 +217,7 @@ class DracoAndGinnyComAdapter(BaseSiteAdapter): ## Everything until the next span class='label' svalue = "" while not defaultGetattr(value,'class') == 'label': - svalue += str(value) + svalue += unicode(value) value = value.nextSibling self.setDescription(url,svalue) diff --git a/fanficfare/adapters/adapter_dramioneorg.py b/fanficfare/adapters/adapter_dramioneorg.py index 4018a997..0785b36d 100644 --- a/fanficfare/adapters/adapter_dramioneorg.py +++ b/fanficfare/adapters/adapter_dramioneorg.py @@ -230,7 +230,7 @@ class DramioneOrgAdapter(BaseSiteAdapter): ## Everything until the next strong tag. svalue = "" while not isinstance(value,bs.Tag) or value.name != 'strong': - svalue += str(value) + svalue += unicode(value) value = value.nextSibling self.setDescription(url,svalue) diff --git a/fanficfare/adapters/adapter_efictionestelielde.py b/fanficfare/adapters/adapter_efictionestelielde.py index 2784efad..9431b9bb 100644 --- a/fanficfare/adapters/adapter_efictionestelielde.py +++ b/fanficfare/adapters/adapter_efictionestelielde.py @@ -147,8 +147,8 @@ class EfictionEstelielDeAdapter(BaseSiteAdapter): if 'Summary' in label: ## Everything until the next span class='label' svalue = "" - while 'Rating' not in str(value): - svalue += str(value) + while 'Rating' not in unicode(value): + svalue += unicode(value) value = value.nextSibling self.setDescription(url,svalue) #self.story.setMetadata('description',stripHTML(svalue)) diff --git a/fanficfare/adapters/adapter_erosnsapphosycophanthexcom.py b/fanficfare/adapters/adapter_erosnsapphosycophanthexcom.py index f125d7be..5a430f0b 100644 --- a/fanficfare/adapters/adapter_erosnsapphosycophanthexcom.py +++ b/fanficfare/adapters/adapter_erosnsapphosycophanthexcom.py @@ -172,7 +172,7 @@ class ErosnSapphoSycophantHexComAdapter(BaseSiteAdapter): val = value value = value.previousSibling while not defaultGetattr(val,'class') == 'label': - svalue += str(val) + svalue += unicode(val) val = val.nextSibling self.setDescription(url,svalue) diff --git a/fanficfare/adapters/adapter_fanficcastletvnet.py b/fanficfare/adapters/adapter_fanficcastletvnet.py index 1c43980b..13e3e767 100644 --- a/fanficfare/adapters/adapter_fanficcastletvnet.py +++ b/fanficfare/adapters/adapter_fanficcastletvnet.py @@ -228,7 +228,7 @@ class FanficCastleTVNetAdapter(BaseSiteAdapter): # XXX ## Everything until the next span class='label' svalue = "" while not defaultGetattr(value,'class') == 'label': - svalue += str(value) + svalue += unicode(value) value = value.nextSibling self.setDescription(url,svalue) #self.story.setMetadata('description',stripHTML(svalue)) diff --git a/fanficfare/adapters/adapter_ficbooknet.py b/fanficfare/adapters/adapter_ficbooknet.py index 8413bc67..4e30d7c2 100644 --- a/fanficfare/adapters/adapter_ficbooknet.py +++ b/fanficfare/adapters/adapter_ficbooknet.py @@ -165,7 +165,7 @@ class FicBookNetAdapter(BaseSiteAdapter): i=0 for part in pr: i=i+len(stripHTML(part).split(' ')) - self.story.setMetadata('numWords', str(i)) + self.story.setMetadata('numWords', unicode(i)) i=0 fandoms = table.findAll('a', href=re.compile(r'/fanfiction/\w+')) diff --git a/fanficfare/adapters/adapter_ficwadcom.py b/fanficfare/adapters/adapter_ficwadcom.py index 5bb9b1b8..11387a9e 100644 --- a/fanficfare/adapters/adapter_ficwadcom.py +++ b/fanficfare/adapters/adapter_ficwadcom.py @@ -159,7 +159,7 @@ class FicwadComSiteAdapter(BaseSiteAdapter): ## perhaps not the most efficient way to parse this, using ## regexps for each rather than something more complex, but ## IMO, it's more readable and amenable to change. - metastr = stripHTML(str(metap)).replace('\n',' ').replace('\t',' ').replace(u'\u00a0',' ') + metastr = stripHTML(unicode(metap)).replace('\n',' ').replace('\t',' ').replace(u'\u00a0',' ') m = re.match(r".*?Rating: (.+?) -.*?",metastr) if m: diff --git a/fanficfare/adapters/adapter_finestoriescom.py b/fanficfare/adapters/adapter_finestoriescom.py index 20fabbae..222763a4 100644 --- a/fanficfare/adapters/adapter_finestoriescom.py +++ b/fanficfare/adapters/adapter_finestoriescom.py @@ -160,7 +160,7 @@ class FineStoriesComAdapter(BaseSiteAdapter): skip=0 i=0 while i == 0: - asoup = bs.BeautifulSoup(self._fetchUrl(self.story.getMetadata('authorUrl')+"&skip="+str(skip))) + asoup = bs.BeautifulSoup(self._fetchUrl(self.story.getMetadata('authorUrl')+"&skip="+unicode(skip))) a = asoup.findAll('td', {'class' : 'lc2'}) for lc2 in a: diff --git a/fanficfare/adapters/adapter_harrypotterfanfictioncom.py b/fanficfare/adapters/adapter_harrypotterfanfictioncom.py index f7d6ca9e..a2daa938 100644 --- a/fanficfare/adapters/adapter_harrypotterfanfictioncom.py +++ b/fanficfare/adapters/adapter_harrypotterfanfictioncom.py @@ -113,7 +113,7 @@ class HarryPotterFanFictionComSiteAdapter(BaseSiteAdapter): tdstr = tr.findAll('td')[2].string if tdstr and tdstr.isdigit(): words+=int(tdstr) - self.story.setMetadata('numWords',str(words)) + self.story.setMetadata('numWords',unicode(words)) # Find the chapters: tablelist = soup.find('table',{'class':'text'}) @@ -135,7 +135,7 @@ class HarryPotterFanFictionComSiteAdapter(BaseSiteAdapter): #for center in soup.findAll('center'): table = soup.find('table',{'class':'storymaininfo'}) if table: - metastr = stripHTML(str(table)).replace('\n',' ').replace('\t',' ') + metastr = stripHTML(unicode(table)).replace('\n',' ').replace('\t',' ') # Rating: 12+ Story Reviews: 3 # Chapters: 3 # Characters: Andromeda, Ted, Bellatrix, R. Lestrange, Lucius, Narcissa, OC diff --git a/fanficfare/adapters/adapter_hlfictionnet.py b/fanficfare/adapters/adapter_hlfictionnet.py index 62be6407..0d05315d 100644 --- a/fanficfare/adapters/adapter_hlfictionnet.py +++ b/fanficfare/adapters/adapter_hlfictionnet.py @@ -147,7 +147,7 @@ class HLFictionNetAdapter(BaseSiteAdapter): ## Everything until the next span class='label' svalue = "" while not defaultGetattr(value,'class') == 'classification': - svalue += str(value) + svalue += unicode(value) value = value.nextSibling self.setDescription(url,svalue) #self.story.setMetadata('description',stripHTML(svalue)) diff --git a/fanficfare/adapters/adapter_iketernalnet.py b/fanficfare/adapters/adapter_iketernalnet.py index 7a06a933..fa6e0a69 100644 --- a/fanficfare/adapters/adapter_iketernalnet.py +++ b/fanficfare/adapters/adapter_iketernalnet.py @@ -222,7 +222,7 @@ class IkEternalNetAdapter(BaseSiteAdapter): ## Everything until the next span class='label' svalue = "" while not defaultGetattr(value,'class') == 'label': - svalue += str(value) + svalue += unicode(value) value = value.nextSibling self.setDescription(url,svalue) #self.story.setMetadata('description',stripHTML(svalue)) diff --git a/fanficfare/adapters/adapter_imagineeficcom.py b/fanficfare/adapters/adapter_imagineeficcom.py index 24ab2647..a4c1bb6a 100644 --- a/fanficfare/adapters/adapter_imagineeficcom.py +++ b/fanficfare/adapters/adapter_imagineeficcom.py @@ -207,7 +207,7 @@ class ImagineEFicComAdapter(BaseSiteAdapter): ## Everything until the next span class='label' svalue = "" while not defaultGetattr(value,'class') == 'label': - svalue += str(value) + svalue += unicode(value) value = value.nextSibling self.setDescription(url,svalue) #self.story.setMetadata('description',stripHTML(svalue)) diff --git a/fanficfare/adapters/adapter_ksarchivecom.py b/fanficfare/adapters/adapter_ksarchivecom.py index fe24b8b6..8e0e9f2e 100644 --- a/fanficfare/adapters/adapter_ksarchivecom.py +++ b/fanficfare/adapters/adapter_ksarchivecom.py @@ -195,7 +195,7 @@ class KSArchiveComAdapter(BaseSiteAdapter): # XXX ## Everything until the next span class='label' svalue = "" while not defaultGetattr(value,'class') == 'label': - svalue += str(value) + svalue += unicode(value) # poor HTML(unclosed for one) can cause run on
# over the next label.
if '' in svalue:
diff --git a/fanficfare/adapters/adapter_literotica.py b/fanficfare/adapters/adapter_literotica.py
index dc61af95..19696ad1 100644
--- a/fanficfare/adapters/adapter_literotica.py
+++ b/fanficfare/adapters/adapter_literotica.py
@@ -237,12 +237,12 @@ class LiteroticaSiteAdapter(BaseSiteAdapter):
# find num pages
pgs = int(soup1.find("span", "b-pager-caption-t r-d45").string.split(' ')[0])
- logger.debug("pages: "+str(pgs))
+ logger.debug("pages: "+unicode(pgs))
# get all the pages
for i in xrange(2, pgs+1):
try:
- logger.debug("fetching page "+str(i))
+ logger.debug("fetching page "+unicode(i))
time.sleep(0.5)
data2 = self._fetchUrl(url, {'page': i})
# brute force approach to replace the wrapping tag. If
diff --git a/fanficfare/adapters/adapter_lumossycophanthexcom.py b/fanficfare/adapters/adapter_lumossycophanthexcom.py
index e8b58198..23fb16e9 100644
--- a/fanficfare/adapters/adapter_lumossycophanthexcom.py
+++ b/fanficfare/adapters/adapter_lumossycophanthexcom.py
@@ -156,7 +156,7 @@ class LumosSycophantHexComAdapter(BaseSiteAdapter):
val = value
value = value.previousSibling
while not defaultGetattr(val,'class') == 'label':
- svalue += str(val)
+ svalue += unicode(val)
val = val.nextSibling
self.setDescription(url,svalue)
diff --git a/fanficfare/adapters/adapter_masseffect2in.py b/fanficfare/adapters/adapter_masseffect2in.py
index e2b77cb3..62609fe4 100644
--- a/fanficfare/adapters/adapter_masseffect2in.py
+++ b/fanficfare/adapters/adapter_masseffect2in.py
@@ -218,7 +218,7 @@ class MassEffect2InAdapter(BaseSiteAdapter):
self.story.setMetadata('status', 'In Progress' if storyInProgress else 'Completed')
self.story.setMetadata('datePublished', datePublished)
self.story.setMetadata('dateUpdated', dateUpdated)
- self.story.setMetadata('numWords', str(wordCount))
+ self.story.setMetadata('numWords', unicode(wordCount))
self.story.setMetadata('numChapters', chapterCount)
# Site-specific metadata.
diff --git a/fanficfare/adapters/adapter_merlinficdtwinscouk.py b/fanficfare/adapters/adapter_merlinficdtwinscouk.py
index f428bed5..16a919a0 100644
--- a/fanficfare/adapters/adapter_merlinficdtwinscouk.py
+++ b/fanficfare/adapters/adapter_merlinficdtwinscouk.py
@@ -206,7 +206,7 @@ class MerlinFicDtwinsCoUk(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_midnightwhispersca.py b/fanficfare/adapters/adapter_midnightwhispersca.py
index 5720e93f..566208c9 100644
--- a/fanficfare/adapters/adapter_midnightwhispersca.py
+++ b/fanficfare/adapters/adapter_midnightwhispersca.py
@@ -190,7 +190,7 @@ class MidnightwhispersCaAdapter(BaseSiteAdapter): # XXX
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_mugglenetcom.py b/fanficfare/adapters/adapter_mugglenetcom.py
index f7c15bea..d8a1197f 100644
--- a/fanficfare/adapters/adapter_mugglenetcom.py
+++ b/fanficfare/adapters/adapter_mugglenetcom.py
@@ -240,7 +240,7 @@ class MuggleNetComAdapter(BaseSiteAdapter): # XXX
# ## Everything until the next span class='label'
# svalue = ""
# while not defaultGetattr(value,'class') == 'label':
- # svalue += str(value)
+ # svalue += unicode(value)
# value = value.nextSibling
# self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_nfacommunitycom.py b/fanficfare/adapters/adapter_nfacommunitycom.py
index 3ccf0fa2..4444e878 100644
--- a/fanficfare/adapters/adapter_nfacommunitycom.py
+++ b/fanficfare/adapters/adapter_nfacommunitycom.py
@@ -194,7 +194,7 @@ class NfaCommunityComAdapter(BaseSiteAdapter): # XXX
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_occlumencysycophanthexcom.py b/fanficfare/adapters/adapter_occlumencysycophanthexcom.py
index 0b518113..e7af8bf2 100644
--- a/fanficfare/adapters/adapter_occlumencysycophanthexcom.py
+++ b/fanficfare/adapters/adapter_occlumencysycophanthexcom.py
@@ -196,7 +196,7 @@ class OcclumencySycophantHexComAdapter(BaseSiteAdapter):
val = val.nextSibling
val = val.nextSibling
while not defaultGetattr(val) == 'table':
- svalue += str(val)
+ svalue += unicode(val)
val = val.nextSibling
self.setDescription(url,svalue)
diff --git a/fanficfare/adapters/adapter_onedirectionfanfictioncom.py b/fanficfare/adapters/adapter_onedirectionfanfictioncom.py
index 2c34a28f..0d6ae45d 100644
--- a/fanficfare/adapters/adapter_onedirectionfanfictioncom.py
+++ b/fanficfare/adapters/adapter_onedirectionfanfictioncom.py
@@ -194,7 +194,7 @@ class OneDirectionFanfictionComAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while value and not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
diff --git a/fanficfare/adapters/adapter_pommedesangcom.py b/fanficfare/adapters/adapter_pommedesangcom.py
index 3e131e2c..30963915 100644
--- a/fanficfare/adapters/adapter_pommedesangcom.py
+++ b/fanficfare/adapters/adapter_pommedesangcom.py
@@ -218,7 +218,7 @@ class PommeDeSangComAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_ponyfictionarchivenet.py b/fanficfare/adapters/adapter_ponyfictionarchivenet.py
index c7e2c595..785878af 100644
--- a/fanficfare/adapters/adapter_ponyfictionarchivenet.py
+++ b/fanficfare/adapters/adapter_ponyfictionarchivenet.py
@@ -181,7 +181,7 @@ class PonyFictionArchiveNetAdapter(BaseSiteAdapter):
value = section.nextSibling
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
diff --git a/fanficfare/adapters/adapter_portkeyorg.py b/fanficfare/adapters/adapter_portkeyorg.py
index 8dbad81d..549a8f09 100644
--- a/fanficfare/adapters/adapter_portkeyorg.py
+++ b/fanficfare/adapters/adapter_portkeyorg.py
@@ -202,7 +202,7 @@ class PortkeyOrgAdapter(BaseSiteAdapter): # XXX
svalue = ""
value = labelspan.nextSibling
while not defaultGetattr(value,'class') == 'dark-small-bold':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
for genre in svalue.split("/"):
diff --git a/fanficfare/adapters/adapter_potionsandsnitches.py b/fanficfare/adapters/adapter_potionsandsnitches.py
index 990c17b3..6cc89d73 100644
--- a/fanficfare/adapters/adapter_potionsandsnitches.py
+++ b/fanficfare/adapters/adapter_potionsandsnitches.py
@@ -123,7 +123,7 @@ class PotionsAndSnitchesOrgSiteAdapter(BaseSiteAdapter):
## Everything until the next div class='listbox'
svalue = ""
while not defaultGetattr(value,'class') == 'listbox':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_potterficscom.py b/fanficfare/adapters/adapter_potterficscom.py
index fece2700..4df6d451 100644
--- a/fanficfare/adapters/adapter_potterficscom.py
+++ b/fanficfare/adapters/adapter_potterficscom.py
@@ -245,7 +245,7 @@ class PotterFicsComAdapter(BaseSiteAdapter):
chnum = 0
for li in list:
chnum += 1
- chTitle = str(chnum) + '. ' + li.a.b.string.strip()
+ chTitle = unicode(chnum) + '. ' + li.a.b.string.strip()
chURL = makeAbsoluteURL(li.a['href'])
chapters.append((chTitle,chURL))
#Get reviews, add to total
@@ -263,7 +263,7 @@ class PotterFicsComAdapter(BaseSiteAdapter):
mb = list.parent
#get the div before that, will either be the description, or the google ad bar
mb = mb.findPreviousSibling('div')
- if 'google_ad_client' in str(mb):
+ if 'google_ad_client' in unicode(mb):
#couldn't find description, leaving it blank
pass
else:
diff --git a/fanficfare/adapters/adapter_potterheadsanonymouscom.py b/fanficfare/adapters/adapter_potterheadsanonymouscom.py
index 707d2d7c..0e66d901 100644
--- a/fanficfare/adapters/adapter_potterheadsanonymouscom.py
+++ b/fanficfare/adapters/adapter_potterheadsanonymouscom.py
@@ -217,7 +217,7 @@ class PotterHeadsAnonymousComAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_pretendercentrecom.py b/fanficfare/adapters/adapter_pretendercentrecom.py
index 23c3cdfa..a5dce385 100644
--- a/fanficfare/adapters/adapter_pretendercentrecom.py
+++ b/fanficfare/adapters/adapter_pretendercentrecom.py
@@ -171,7 +171,7 @@ class PretenderCenterComAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_psychficcom.py b/fanficfare/adapters/adapter_psychficcom.py
index 07eb0542..3a4c5013 100644
--- a/fanficfare/adapters/adapter_psychficcom.py
+++ b/fanficfare/adapters/adapter_psychficcom.py
@@ -166,7 +166,7 @@ class PsychFicComAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_qafficcom.py b/fanficfare/adapters/adapter_qafficcom.py
index 1b7b3b10..4837f91b 100644
--- a/fanficfare/adapters/adapter_qafficcom.py
+++ b/fanficfare/adapters/adapter_qafficcom.py
@@ -179,7 +179,7 @@ class QafFicComAdapter(BaseSiteAdapter):
svalue = ""
while not defaultGetattr(value,'class') == 'classification' and value != None:
if "Featured Stories" not in value:
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_samdeanarchivenu.py b/fanficfare/adapters/adapter_samdeanarchivenu.py
index 08837224..9624b34f 100644
--- a/fanficfare/adapters/adapter_samdeanarchivenu.py
+++ b/fanficfare/adapters/adapter_samdeanarchivenu.py
@@ -151,7 +151,7 @@ class SamDeanArchiveNuAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'classification':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_scarheadnet.py b/fanficfare/adapters/adapter_scarheadnet.py
index 977b0269..9c05c8cb 100644
--- a/fanficfare/adapters/adapter_scarheadnet.py
+++ b/fanficfare/adapters/adapter_scarheadnet.py
@@ -251,10 +251,10 @@ class ScarHeadNetAdapter(BaseSiteAdapter):
svalue = ""
while i == 0:
try:
- b = str(a)
+ b = unicode(a)
svalue += b.split('Summary: ')[1]
except:
- svalue += str(a)
+ svalue += unicode(a)
if a.nextSibling != None:
a = a.nextSibling
else:
diff --git a/fanficfare/adapters/adapter_scarvesandcoffeenet.py b/fanficfare/adapters/adapter_scarvesandcoffeenet.py
index 306914e1..b1f3e77c 100644
--- a/fanficfare/adapters/adapter_scarvesandcoffeenet.py
+++ b/fanficfare/adapters/adapter_scarvesandcoffeenet.py
@@ -175,7 +175,7 @@ class ScarvesAndCoffeeNetAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_sg1heliopoliscom.py b/fanficfare/adapters/adapter_sg1heliopoliscom.py
index d7bb5c55..98edf6b7 100644
--- a/fanficfare/adapters/adapter_sg1heliopoliscom.py
+++ b/fanficfare/adapters/adapter_sg1heliopoliscom.py
@@ -176,7 +176,7 @@ class SG1HeliopolisComAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_sinfuldesireorg.py b/fanficfare/adapters/adapter_sinfuldesireorg.py
index f926220f..92ec1295 100644
--- a/fanficfare/adapters/adapter_sinfuldesireorg.py
+++ b/fanficfare/adapters/adapter_sinfuldesireorg.py
@@ -166,7 +166,7 @@ class SinfulDesireOrgAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_squidgeorgpeja.py b/fanficfare/adapters/adapter_squidgeorgpeja.py
index 0704ef12..ec86e1bb 100644
--- a/fanficfare/adapters/adapter_squidgeorgpeja.py
+++ b/fanficfare/adapters/adapter_squidgeorgpeja.py
@@ -158,7 +158,7 @@ class SquidgeOrgPejaAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'classification':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_storiesonlinenet.py b/fanficfare/adapters/adapter_storiesonlinenet.py
index ee342539..689797db 100644
--- a/fanficfare/adapters/adapter_storiesonlinenet.py
+++ b/fanficfare/adapters/adapter_storiesonlinenet.py
@@ -178,7 +178,7 @@ class StoriesOnlineNetAdapter(BaseSiteAdapter):
page=0
i=0
while i == 0:
- asoup = self.make_soup(self._fetchUrl(self.story.getList('authorUrl')[0]+"/"+str(page)))
+ asoup = self.make_soup(self._fetchUrl(self.story.getList('authorUrl')[0]+"/"+unicode(page)))
a = asoup.findAll('td', {'class' : 'lc2'})
for lc2 in a:
diff --git a/fanficfare/adapters/adapter_tenhawkpresentscom.py b/fanficfare/adapters/adapter_tenhawkpresentscom.py
index 98fb1477..d33c7a47 100644
--- a/fanficfare/adapters/adapter_tenhawkpresentscom.py
+++ b/fanficfare/adapters/adapter_tenhawkpresentscom.py
@@ -172,7 +172,7 @@ class TenhawkPresentsComSiteAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_thealphagatecom.py b/fanficfare/adapters/adapter_thealphagatecom.py
index ddeb8286..e0627334 100644
--- a/fanficfare/adapters/adapter_thealphagatecom.py
+++ b/fanficfare/adapters/adapter_thealphagatecom.py
@@ -135,7 +135,7 @@ class TheAlphaGateComAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_themasquenet.py b/fanficfare/adapters/adapter_themasquenet.py
index 3895f51b..fc4d4a2e 100644
--- a/fanficfare/adapters/adapter_themasquenet.py
+++ b/fanficfare/adapters/adapter_themasquenet.py
@@ -215,7 +215,7 @@ class TheMasqueNetAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_thepetulantpoetesscom.py b/fanficfare/adapters/adapter_thepetulantpoetesscom.py
index d7e9c719..6e91c834 100644
--- a/fanficfare/adapters/adapter_thepetulantpoetesscom.py
+++ b/fanficfare/adapters/adapter_thepetulantpoetesscom.py
@@ -161,7 +161,7 @@ class ThePetulantPoetessComAdapter(BaseSiteAdapter):
index = 1
found = 0
while found == 0:
- asoup = bs.BeautifulSoup(self._fetchUrl(self.story.getMetadata('authorUrl')+"&page="+str(index)))
+ asoup = bs.BeautifulSoup(self._fetchUrl(self.story.getMetadata('authorUrl')+"&page="+unicode(index)))
for info in asoup.findAll('td', {'class' : 'highlightcolor1'}):
a = info.find('a', href=re.compile(r'viewstory.php\?sid='+self.story.getMetadata('storyId')+"$"))
diff --git a/fanficfare/adapters/adapter_tolkienfanfiction.py b/fanficfare/adapters/adapter_tolkienfanfiction.py
index 10d24233..81b35260 100644
--- a/fanficfare/adapters/adapter_tolkienfanfiction.py
+++ b/fanficfare/adapters/adapter_tolkienfanfiction.py
@@ -193,7 +193,7 @@ class TolkienFanfictionAdapter(BaseSiteAdapter):
self.story.addToList('characters', character)
logger.debug("Characters: %s" % self.story.getMetadata('characters'))
- logger.debug('Title as `str`: ' + str(title))
+ logger.debug('Title as `str`: ' + unicode(title))
# For publication date we need to search
try:
queryString = urllib.urlencode((
diff --git a/fanficfare/adapters/adapter_trekiverseorg.py b/fanficfare/adapters/adapter_trekiverseorg.py
index 8381fbe6..92a5cd17 100644
--- a/fanficfare/adapters/adapter_trekiverseorg.py
+++ b/fanficfare/adapters/adapter_trekiverseorg.py
@@ -217,7 +217,7 @@ class TrekiverseOrgAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ''
while value and not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
# sometimes poorly formated desc ( w/o for one) can cause run on
# over the next label.
if '' in svalue:
diff --git a/fanficfare/adapters/adapter_twilightednet.py b/fanficfare/adapters/adapter_twilightednet.py
index 7746aac4..c1141eea 100644
--- a/fanficfare/adapters/adapter_twilightednet.py
+++ b/fanficfare/adapters/adapter_twilightednet.py
@@ -162,7 +162,7 @@ class TwilightedNetSiteAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
diff --git a/fanficfare/adapters/adapter_walkingtheplankorg.py b/fanficfare/adapters/adapter_walkingtheplankorg.py
index d03ad454..d184635a 100644
--- a/fanficfare/adapters/adapter_walkingtheplankorg.py
+++ b/fanficfare/adapters/adapter_walkingtheplankorg.py
@@ -150,7 +150,7 @@ class WalkingThePlankOrgAdapter(BaseSiteAdapter):
## Everything until the next span class='label'
svalue = ""
while not defaultGetattr(value,'class') == 'label':
- svalue += str(value)
+ svalue += unicode(value)
value = value.nextSibling
self.setDescription(url,svalue)
#self.story.setMetadata('description',stripHTML(svalue))
diff --git a/fanficfare/adapters/adapter_wolverineandroguecom.py b/fanficfare/adapters/adapter_wolverineandroguecom.py
index 93f56c53..709be41b 100644
--- a/fanficfare/adapters/adapter_wolverineandroguecom.py
+++ b/fanficfare/adapters/adapter_wolverineandroguecom.py
@@ -131,8 +131,8 @@ class WolverineAndRogueComAdapter(BaseSiteAdapter):
while value != None:
val = value
value = value.previousSibling
- while "Categories" not in str(val):
- svalue += str(val)
+ while "Categories" not in unicode(val):
+ svalue += unicode(val)
val = val.nextSibling
self.setDescription(url,svalue)
diff --git a/fanficfare/adapters/base_efiction_adapter.py b/fanficfare/adapters/base_efiction_adapter.py
index 8dd42207..7a1ea8a8 100644
--- a/fanficfare/adapters/base_efiction_adapter.py
+++ b/fanficfare/adapters/base_efiction_adapter.py
@@ -338,7 +338,7 @@ class BaseEfictionAdapter(BaseSiteAdapter):
errorDiv = soup.find("div", "errortext")
self.triedLoggingIn = True
else:
- raise exceptions.FailedToLogin(self.url, str(errorDiv))
+ raise exceptions.FailedToLogin(self.url, unicode(errorDiv))
else:
warningLink = errorDiv.find("a")
if warningLink is not None and ( \
@@ -354,9 +354,9 @@ class BaseEfictionAdapter(BaseSiteAdapter):
errorDiv = soup.find("div", "errortext")
self.triedAcceptWarnings = True
else:
- raise exception.FailedToDownload(self.url, str(errorDiv))
+ raise exception.FailedToDownload(self.url, unicode(errorDiv))
else:
- raise exception.FailedToDownload(self.url, str(errorDiv))
+ raise exception.FailedToDownload(self.url, unicode(errorDiv))
# title and author
pagetitleDiv = soup.find("div", {"id": "pagetitle"})
@@ -382,7 +382,7 @@ class BaseEfictionAdapter(BaseSiteAdapter):
if (type(nextEl) is bs.Tag):
valueStr += nextEl.prettify()
else:
- valueStr += str(nextEl)
+ valueStr += unicode(nextEl)
nextEl = nextEl.nextSibling
key = labelSpan.text.strip()
diff --git a/fanficfare/html.py b/fanficfare/html.py
index 22fb40af..e9b5e02b 100644
--- a/fanficfare/html.py
+++ b/fanficfare/html.py
@@ -69,7 +69,7 @@ class HtmlProcessor:
'''Replace tags with HTML-ified text.'''
pres = self._soup.findAll('pre')
for pre in pres:
- pre.replaceWith(self._FixPreContents(str(pre.contents[0])))
+ pre.replaceWith(self._FixPreContents(unicode(pre.contents[0])))
def _FixPreContents(self, text):
if self.unfill:
diff --git a/fanficfare/story.py b/fanficfare/story.py
index d5e6c56e..74221754 100644
--- a/fanficfare/story.py
+++ b/fanficfare/story.py
@@ -77,7 +77,7 @@ try:
if removetrans and img.has_transparent_pixels():
canvas = Image()
- canvas.create_canvas(int(img.size[0]), int(img.size[1]), str(background))
+ canvas.create_canvas(int(img.size[0]), int(img.size[1]), unicode(background))
canvas.compose(img)
img = canvas
export = True
@@ -1096,7 +1096,7 @@ class Story(Configurable):
return retlist
def __str__(self):
- return "Metadata: " +str(self.metadata)
+ return "Metadata: " +unicode(self.metadata)
def commaGroups(s):
groups = []
diff --git a/fanficfare/translit.py b/fanficfare/translit.py
index 0c113de8..0efdc010 100644
--- a/fanficfare/translit.py
+++ b/fanficfare/translit.py
@@ -1,4 +1,4 @@
-#-*-coding:utf-8-*-
+#-*-coding:utf-8-*-
# Code taken from http://python.su/forum/viewtopic.php?pid=66946
import unicodedata
def is_syllable(letter):
@@ -10,11 +10,11 @@ def is_consonant(letter):
return not is_syllable(letter)
def romanize(letter):
try:
- str(letter)
+ unicode(letter)
except UnicodeEncodeError:
pass
else:
- return str(letter)
+ return unicode(letter)
unid = unicodedata.name(letter)
exceptions = {"NUMERO SIGN": "No", "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK": "\"", "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK": "\"", "DASH": "-"}
for name_contains in exceptions:
@@ -54,4 +54,4 @@ def translit(text):
#bolgh.: Ah, chudna b'lgharska ziem'o, polyushkvay ts'ftyashchi zhita.
#sierb.: Nieuriednie notshnie damie dosadjivalie su Dzhieku K.
if __name__=="__main__":
- main()
\ No newline at end of file
+ main()
diff --git a/fanficfare/writers/writer_epub.py b/fanficfare/writers/writer_epub.py
index 6a75fd49..3a54ff7e 100644
--- a/fanficfare/writers/writer_epub.py
+++ b/fanficfare/writers/writer_epub.py
@@ -578,7 +578,7 @@ div { margin: 0pt; padding: 0pt; }
if title :
navPoint = newTag(tocncxdom,"navPoint",
attrs={'id':id,
- 'playOrder':str(index)})
+ 'playOrder':unicode(index)})
tocnavMap.appendChild(navPoint)
navLabel = newTag(tocncxdom,"navLabel")
navPoint.appendChild(navLabel)
diff --git a/webservice/main.py b/webservice/main.py
index 60e33333..1cc7893c 100644
--- a/webservice/main.py
+++ b/webservice/main.py
@@ -153,7 +153,7 @@ class EditConfigServer(UserConfigServer):
self.redirect("/?error=configsaved")
except Exception, e:
logging.info("Saved Config Failed:%s"%e)
- self.redirect("/?error=custom&errtext=%s"%urlEscape(str(e)))
+ self.redirect("/?error=custom&errtext=%s"%urlEscape(unicode(e)))
else: # not update, assume display for edit
if uconfig is not None and uconfig.config:
config = uconfig.config
@@ -309,7 +309,7 @@ class RecentFilesServer(webapp2.RequestHandler):
for fic in fics:
if fic.completed and fic.format == 'epub':
- fic.escaped_url = urlEscape(self.request.host_url+"/file/"+fic.name+"."+fic.format+"?id="+str(fic.key())+"&fake=file."+fic.format)
+ fic.escaped_url = urlEscape(self.request.host_url+"/file/"+fic.name+"."+fic.format+"?id="+unicode(fic.key())+"&fake=file."+fic.format)
template_values = dict(fics = fics, nickname = user.nickname())
path = os.path.join(os.path.dirname(__file__), 'recent.html')
@@ -391,7 +391,7 @@ class FanfictionDownloader(UserConfigServer):
try:
configuration = self.getUserConfig(user,url,format)
except Exception, e:
- self.redirect("/?error=custom&errtext=%s"%urlEscape("There's an error in your User Configuration: "+str(e)))
+ self.redirect("/?error=custom&errtext=%s"%urlEscape("There's an error in your User Configuration: "+unicode(e)))
return
adapter = adapters.getAdapter(configuration,url)
@@ -425,7 +425,7 @@ class FanfictionDownloader(UserConfigServer):
taskqueue.add(url='/fdowntask',
queue_name="download",
- params={'id':str(download.key()),
+ params={'id':unicode(download.key()),
'format':format,
'url':download.url,
'login':login,
@@ -433,7 +433,7 @@ class FanfictionDownloader(UserConfigServer):
'user':user.email(),
'is_adult':is_adult})
- logging.info("enqueued download key: " + str(download.key()))
+ logging.info("enqueued download key: " + unicode(download.key()))
except (exceptions.FailedToLogin,exceptions.AdultCheckRequired), e:
download.failure = unicode(e)
@@ -467,7 +467,7 @@ class FanfictionDownloader(UserConfigServer):
download.failure = unicode(e)
download.put()
- self.redirect('/status?id='+str(download.key()))
+ self.redirect('/status?id='+unicode(download.key()))
return