Не запускается в фласке паттерн адаптер
вот код:
from flask import Flask
app = Flask (__name__)
@app.route ('/')
class Uah (object):
def __init__(self, currency):
self._currency = currency
def payUah(self):
return '%s в гривнах' % self._name
class Dollar (object):
def __init__(self, currency):
self._currency = currency
def payDollar(self):
return '%s в другой валюте' % self._name
class DollarsAdapter (Uah):
def __init__(self, currency):
super (DollarsAdapter, self).__init__ (currency=currency)
self._forCur = Dollar (currency=currency)
def dollars(self):
num1, num2 = int (Uah), int (28)
answer = num1 * num2
return answer
def payUah(self):
return self.dollars.payDollar ( )
@app.route ("/adapter")
def testAdapter():
uah = Uah ("Оплата:")
print (uah.payUah ( ))
uah = DollarsAdapter ("Оплата:")
print (uah.payUah ( ))
if __name__ == "__main__":
app.run ( )
вот код:
from flask import Flask
app = Flask (__name__)
@app.route ('/')
class Uah (object):
def __init__(self, currency):
self._currency = currency
def payUah(self):
return '%s в гривнах' % self._name
class Dollar (object):
def __init__(self, currency):
self._currency = currency
def payDollar(self):
return '%s в другой валюте' % self._name
class DollarsAdapter (Uah):
def __init__(self, currency):
super (DollarsAdapter, self).__init__ (currency=currency)
self._forCur = Dollar (currency=currency)
def dollars(self):
num1, num2 = int (Uah), int (28)
answer = num1 * num2
return answer
def payUah(self):
return self.dollars.payDollar ( )
@app.route ("/adapter")
def testAdapter():
uah = Uah ("Оплата:")
print (uah.payUah ( ))
uah = DollarsAdapter ("Оплата:")
print (uah.payUah ( ))
if __name__ == "__main__":
app.run ( )