Skip to content

Commit

Permalink
Refactor default country prefix (+47) into a global variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jherland committed Mar 12, 2011
1 parent 245e315 commit ffac3b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sms_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@

DbFilename = "sms.db" # On Nokia N900: /home/user/.rtcom-eventlogger/el-v1.db

CountryPrefix = "+47" # Default phone number country prefix

AnsiColors = {
"red": "\033[91m",
"green": "\033[92m",
Expand Down Expand Up @@ -223,10 +225,10 @@ def args (self):

def add (self, phonenum):
self.nums.append(phonenum)
if phonenum.startswith("+47"):
self.nums.append(phonenum[3:])
if phonenum.startswith(CountryPrefix):
self.nums.append(phonenum[len(CountryPrefix):])
else:
self.nums.append("+47" + phonenum)
self.nums.append(CountryPrefix + phonenum)


def main (args = []):
Expand Down

0 comments on commit ffac3b4

Please sign in to comment.