コード例 #1
0
ファイル: matthew.py プロジェクト: gregmccoy/canadianize
 def links(self):
     replaces = readCSV('data/links_{}.csv'.format(self.country), '|')
     for row in replaces:
         if self.content.find(row[0]) != -1:
             print('* Replacing "' + row[0] + '" with "' + row[1] + '" *')
             self.content = self.content.replace(row[0], row[1])
     return 0
コード例 #2
0
ファイル: matthew.py プロジェクト: gregmccoy/canadianize
 def links(self):
     replaces = readCSV('data/links_{}.csv'.format(self.country), '|')
     for row in replaces:
         if self.content.find(row[0]) != -1:
             self.notifications.append('* Replacing "' + row[0] +
                                       '" with "' + row[1] + '" *')
             self.content = self.content.replace(row[0], row[1])
コード例 #3
0
ファイル: matthew.py プロジェクト: gregmccoy/canadianize
    def __init__(self, content=None, raw=None, input_type="email", verbose=False):
        self.ignores= {"color=":"^CSS_COLOR^", '"center"':"^CSS_CENTER_1^", "'center'":"^CSS_CENTER_2^", "mygfa.org":"^MYGFA^"}
        self.content = content
        self.raw = raw
        self.input_type = input_type
        self.debug = verbose
        self.country = readConf("country")

        replaces = readCSV('data/replace_{}.csv'.format(self.country), '|')
        self.replaces = replaces

        tz = pytz.timezone('Canada/Eastern')
        now = pytz.utc.localize(datetime.utcnow())
        self.is_dst = now.astimezone(tz).dst() != timedelta(0)
コード例 #4
0
ファイル: matthew.py プロジェクト: gregmccoy/canadianize
    def __init__(self,
                 content=None,
                 raw=None,
                 input_type="email",
                 verbose=False,
                 source_code=None,
                 country=None):
        self.ignores = {
            "color=": "^CSS_COLOR^",
            '"center"': "^CSS_CENTER_1^",
            "'center'": "^CSS_CENTER_2^",
            "mygfa.org": "^MYGFA^",
            "<center>": "^CENTER_TAG^",
            "&nbsp;": "^NBSP^",
            "&zwnj;": "^ZWNJ^",
            "&ndash;": "^NDASH^",
            "gfa.org.nz": "^GFANZ^"
        }

        self.content = content
        self.raw = raw
        self.input_type = input_type
        self.debug = verbose
        self.notifications = []

        if not country:
            if self.input_type == "qt":
                self.country = "CA"
            else:
                self.country = readConf("country")
        else:
            self.country = country

        self.source_code = source_code

        replaces = readCSV('data/replace_{}.csv'.format(self.country), '|')
        self.replaces = replaces

        tz = pytz.timezone('Canada/Eastern')
        now = pytz.utc.localize(datetime.utcnow())
        self.is_dst = now.astimezone(tz).dst() != timedelta(0)