def create_active_item(oc): task, handler = SyncManager.get_current() if not task: return # Format values remaining = format_remaining(task.statistics.seconds_remaining) progress = format_percentage(task.statistics.progress) # Title title = '%s - Status' % normalize(handler.title) if progress: title += ' (%s)' % progress # Summary summary = task.statistics.message or 'Working' if remaining: summary += ', ~%s second%s remaining' % (remaining, plural(remaining)) # Create items oc.add(DirectoryObject( key=Callback(SyncMenu, refresh=timestamp()), title=pad_title(title), summary=summary + ' (click to refresh)' )) oc.add(DirectoryObject( key=Callback(Cancel), title=pad_title('%s - Cancel' % normalize(handler.title)) ))
def send_idea_notifications(sender, comment, request, **kwargs): # If installed in collab try: from core.notifications.models import Notification from core.notifications.email import EmailInfo from core.helpers import normalize idea = comment.content_object title = u"%s %s commented on %s" % (normalize(comment.user.first_name), normalize(comment.user.last_name), idea.title) for user in idea.members: if user != comment.user: email_info = EmailInfo( subject = title, text_template = 'idea/email/new_comment.txt', html_template = 'idea/email/new_comment.html', to_address = user.email, ) Notification.set_notification(comment.user, comment.user, "commented", idea, user, title, idea.url(), email_info) except ImportError: pass
def send_idea_notifications(sender, comment, request, **kwargs): # If installed in collab try: from core.notifications.models import Notification from core.notifications.email import EmailInfo from core.helpers import normalize idea = comment.content_object if comment.is_anonymous: title = u'Someone commented on "%s"' % idea.title text_template = 'new_comment_anonymous.txt' html_template = 'new_comment_anonymous.html' else: title = u'%s %s comented on "%s"' % (normalize( comment.user.first_name), normalize( comment.user.last_name), idea.title) text_template = 'new_comment.txt' html_template = 'new_comment.html' for user in idea.members: if user != comment.user: email_info = EmailInfo( subject=title, text_template='idea/email/%s' % text_template, html_template='idea/email/%s' % html_template, to_address=user.email, ) Notification.set_notification(comment.user, comment.user, "commented", idea, user, title, idea.url(), email_info) except ImportError: pass
def __init__(self, url): self.version = None self.capacity = 0 self.usage = -1 self.active = True self.set_url(normalize(url)) self.headers = { "Accept" : "*/*" }
def __init__(self, url): self.version = None self.capacity = 0 self.usage = -1 self.note = 5 self.active = True self.set_url(normalize(url)) self.headers = {"Accept": "*/*"}