def add_page(title, content, menu): page = PageModel() page.title_ru = title page.title_en = get_translated(title) page.content_ru = content page.content_en = get_translated(content) page.fk_menu = menu page.put()
def request_to_model(model, request, prefix): if not model: return None for properie in model.properties(): db_type = model.properties()[properie] request_propertrie = prefix + "." + properie request_value = request.get(request_propertrie) if not request_value and "_" in properie: name = properie[:-3] lang = properie[-2:] if lang != LANG_CODE_DEFAULT and lang in CMS_LANGUAGES.keys(): """translate""" origin = request.get(prefix + "." + name + "_" + LANG_CODE_DEFAULT) request_value = get_translated(origin, LANG_CODE_DEFAULT, lang) if type(db_type) == db.IntegerProperty: if not request_value: request_value = 0; setattr(model, properie, int(request_value)) elif type(db_type) == db.BooleanProperty: if not request_value: request_value = False; setattr(model, properie, bool(request_value)) elif type(db_type) == db.DateTimeProperty: setattr(model, properie, datetime.datetime.utcnow()) elif type(db_type) == db.BlobProperty: if request_value: setattr(model, properie, db.Blob(request_value)) elif type(db_type) == db.ReferenceProperty: pass else: if hasattr(model, properie): setattr(model, properie, request_value) return model
return {"name":name, "value_ru":value1, "value_en":value2} donate_button = """<form style="display:inline" method=POST action="https://liqpay.com/?do=clickNbuy"> <input type=hidden name="preorder" value="dd3d0229c15543d935279f3febd403453ad2e740"> <input type=submit value="Donate 1.00$"> </form> <b>Z</b>272831992873<br/> <b>R</b>224951911391<br/> <b>U</b>234673813280<br/> <a href="http://www.foobnix.com/support?lang=%s">%s</a> """ default_properties = [ p("foobnix.header.slogan", "Foobnix простой и мощный плеер музыки для Linux", "Foobnix simple and powerful music player for Linux"), p("foobnix.title.slogan", "Хороший плеер для музыки и видео", "Good music and video player"), p("foobnix.footer.text", footer, get_translated(footer)), p("prop.wrong.text", "Неправильный текст", "Wrong Text"), p("prop.blog", "Блог", "Blog"), p("prop.comments", "Комментарии", "Comments"), p("prop.comment", "Комментарий", "Comment"), p("prop.twitter", "Твиттер", "Twitter"), p("prop.add.new.comment", "Добавить комментарий", "Add new comment"), p("prop.add", "Добавить", "Add"), p("prop.delete", "Удалить", "Delete"), p("prop.required", "Обязательное", "Required"), p("prop.wrong.text", "Неправильный текст", "Wrong Text"), p("prop.name", "Имя", "Name"), p("prop.site", "Сайт", "Site"), p("prop.donate", "Поддержите", "Support Us"), p("prop.top_right_text", '<a href="http://code.google.com/p/foobnix/issues/list">Баги</a> <a href="https://github.com/foobnix/foobnix">Исходники</a> <a href="https://translations.launchpad.net/foobnix">Переводы</a>', '<a href="http://code.google.com/p/foobnix/issues/list">Bugs</a> <a href="https://github.com/foobnix/foobnix">Sources</a> <a href="https://translations.launchpad.net/foobnix">Translations</a>'),