Browse Source

Add __str__-method to CountryList-class

develop
Jonathan Golder 6 years ago
parent
commit
3349c9f3d3
1 changed files with 18 additions and 1 deletions
  1. +18
    -1
      countrylist.py

+ 18
- 1
countrylist.py View File

@ -67,7 +67,7 @@ class CountryList():
# Check if page exits
if not self.page.exists():
return False
return None
# Initialise attributes
__attr = ( "wikicode", "entry", "chartein", "_chartein_raw",
@ -347,6 +347,23 @@ missing!" )
raise CountryListEntryError( "Template Parameter 'Interpret' is \
missing!" )
def __str__( self ):
"""
Returns str repression for Object
"""
if self.parsed:
return ("CountryList( Link = \"{link}\", Revid = \"{revid}\", " +
"Interpret = \"{interpret}\", Titel = \"{titel}\", " +
"Chartein = \"{chartein}\" )").format(
link=repr(self.wikilink),
revid=self.revid,
interpret=self.interpret,
titel=self.titel,
chartein=repr(self.chartein))
else:
return "CountryList( Link = \"{link}\" )".format(
link=repr(self.wikilink))
class CountryListError( Exception ):
"""


Loading…
Cancel
Save