def init_mails(): mails = { 'accept': { 'subject': 'Your booking at Ferdinand Motel has been ACCEPTED', 'body': load_file('/mail/bookingAcceptedClient.html'), 'description': 'the mail the client receives when a booking is accepted' }, 'deny': { 'subject': 'Your booking at Ferdinand Motel has NOT been ACCEPTED', 'body': load_file('/mail/bookingDeniedClient.html'), 'description': 'the mail the client receives when a booking is denied' }, 'new_client': { 'subject': 'You\'ve registered a booking at Ferdinand Motel', 'body': load_file('/mail/bookingNewClient.html'), 'description': 'the mail the client receives when a booking is created' }, 'new_admin': { 'subject': 'A new booking has been registered at Ferdinand Motel', 'body': load_file('/mail/bookingNewAdmin.html'), 'description': 'the mail the admin receives when a booking is created' } } for lang_id in prop.get_languages(): for mail_type in mails: PropModel(kkey='mail.' + mail_type + '.' + lang_id + '.body', value=mails[mail_type]['body'], description=lang_id + ' body ' + mails[mail_type]['description'])\ .put() PropModel(kkey='mail.' + mail_type + '.' + lang_id + '.subject', value=mails[mail_type]['subject'], description=lang_id + ' subject ' + mails[mail_type]['description'])\ .put()
def home(): lang_id = si18n.get_lang_id() is_admin = users.is_current_user_admin() qry = CategoryModel.all().filter("parent_category", None) if not is_admin: qry = qry.filter("visible", True) categories = [e.to_dict() for e in qry] prod = "Development" not in os.environ["SERVER_SOFTWARE"] return render_template( "/main.html", js_data={ "categories": categories, "languages": prop.get_languages(), "currency": currency.get_data(), "language": lang_id, "bookings": [], "si18n": si18n.translations_js, "is_admin": is_admin, "new_bookings_nr": BookingModel.get_number_of_new() if is_admin else 0, }, is_admin=is_admin, is_production=prod, logout_url=users.create_logout_url("/"), ) pass
def complete_uninitialized_fields(self, ddct): """ Initializes i18n fields for which no translations were found """ for lang_id in prop.get_languages(): if lang_id not in ddct["i18n"]: ddct["i18n"][lang_id] = {} for fld_name in self.__class__.i18d_fields: if fld_name not in ddct["i18n"][lang_id]: ddct["i18n"][lang_id][fld_name] = ""
def add_translations(entity): for lang_id in prop.get_languages(): lang_name = prop.get_languages()[lang_id] for field_name in entity.__class__.i18d_fields: I18n(field=field_name, value=lang_name + ' ' + field_name, lang_id=lang_id, foreign_entity=entity).put() pass