diff -r eb04ac3a8327 -r 3f4bdea2abbf iro/anbieter/telnumber.py --- a/iro/anbieter/telnumber.py Wed Dec 21 22:07:48 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -#Copyright (C) 2009 Sandro Knauß - -#This program is free software; you can redistribute it and/or modify it under the terms -#of the GNU General Public License as published by the Free Software Foundation; -#either version 3 of the License, or any later version. -#This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; -#without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -#See the GNU General Public License for more details. - -#You should have received a copy of the GNU General Public License -#along with this program; if not, see . - -class anbieter: - default_conf = '' # override this -import re - -class NotATelNumber(Exception): - def __init__(self, number): - self.number= number - - def __str__(self): - return ("This is not a telefonnumber:", selfnumber) - -class telnumber: - re_telnum=re.compile(r'^\s*(\+)?([0-9\s\-/\(\)])+\s*$') - re_land=re.compile(r'^\s*(\+|00)(?P[1-9]{2})') - re_number=re.compile(r'[^0-9]') - std_land="49" - - def __init__(self,number=None): - if not(number is None): - self.createNumber(number) - - def createNumber(self, number): - - if not self.re_telnum.match(number): - raise NotATelNumber(number) - - - self.land=self.std_land - land=self.re_land.match(number) - - if not(land is None): - self.land=land.group("land") - number=number[land.end("land"):] - - number=self.re_number.sub('',number) - - if number[0]=="0": - number=number[1:] - - self.number = number - - def __eq__(self, y): - return ((self.number == y.number) and ( self.land == y.land)) - - def __ne__(self, y): - return not self.__eq__(y)