Python
1
Вклад в тег
sub = Blueprint('sub', __name__, subdomain='<trademark>')
@sub.url_defaults
def add_trademark(endpoint, values):
values.setdefault('trademark', g.a_trademark)
@sub.url_value_preprocessor
def pull_trademark(endpoint, values):
g.a_trademark = values.pop('trademark')
query = City.query.filter(Company.url==g.a_trademark)
g.trademark = query.first_or_404()