def __call__(self, handler): markup = u'<ul>\n' for item in self.items: markup += item(handler) markup += u'</ul>\n' return markup mainmenu = Menu() def home(handler): if not handler.user: return dict(visible=True, active=True, url="/") else: return dict(visible=False, active=False, url="/") mainmenu.add(_("home"), home) def login(handler): if not handler.user: return dict(visible=True, active=False, url=users.create_login_url("/")) return dict(visible=False, active=False, url='') mainmenu.add(_('login'), login) def dashboard(handler): import tweetengine.handlers if not handler.user or not handler.current_account and \ not isinstance(handler, tweetengine.handlers.SettingsHandler): return dict(visible=False, active=False, url='') active = isinstance(handler, tweetengine.handlers.DashboardHandler)
from tweetengine.i18n import _ mailbody = _('invitemail', u"""You have been invited to tweet as ${account_username} on Tweet Engine! Tweet Engine is a system for collaborative tweeting with shared accounts. To accept your invitation, click on the link below. ${url}""")
raise NotImplementedError() class GoogleUserAccount(UserAccount): user = db.UserProperty(required=True) def get_username(self): return self.user.email() ROLE_ANYONE = 0 ROLE_USER = 1 ROLE_ADMINISTRATOR = 2 ROLES = [ (ROLE_ANYONE, _("Anyone")), (ROLE_USER, _("User")), (ROLE_ADMINISTRATOR, _("Administrator")) ] ROLE_IDS = [id for id,name in ROLES] class TwitterAccount(db.Model): oauth_token = db.TextProperty(required=True) oauth_secret = db.TextProperty(required=True) name = db.TextProperty() picture = db.TextProperty() # Permission levels suggest_tweets = db.IntegerProperty(required=True, choices=ROLE_IDS, default=ROLE_ANYONE)