當前位置: 首頁>>代碼示例>>Python>>正文


Python OPMLExporter.process方法代碼示例

本文整理匯總了Python中apps.feed_import.models.OPMLExporter.process方法的典型用法代碼示例。如果您正苦於以下問題:Python OPMLExporter.process方法的具體用法?Python OPMLExporter.process怎麽用?Python OPMLExporter.process使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在apps.feed_import.models.OPMLExporter的用法示例。


在下文中一共展示了OPMLExporter.process方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: send_opml_export_email

# 需要導入模塊: from apps.feed_import.models import OPMLExporter [as 別名]
# 或者: from apps.feed_import.models.OPMLExporter import process [as 別名]
    def send_opml_export_email(self):
        if not self.user.email:
            return
        
        MSentEmail.objects.get_or_create(receiver_user_id=self.user.pk,
                                         email_type='opml_export')
        
        exporter = OPMLExporter(self.user)
        opml     = exporter.process()

        params = {
            'feed_count': UserSubscription.objects.filter(user=self.user).count(),
        }
        user    = self.user
        text    = render_to_string('mail/email_opml_export.txt', params)
        html    = render_to_string('mail/email_opml_export.xhtml', params)
        subject = "Backup OPML file of your NewsBlur sites"
        filename= 'NewsBlur Subscriptions - %s.xml' % datetime.datetime.now().strftime('%Y-%m-%d')
        msg     = EmailMultiAlternatives(subject, text, 
                                         from_email='NewsBlur <%s>' % settings.HELLO_EMAIL,
                                         to=['%s <%s>' % (user, user.email)])
        msg.attach_alternative(html, "text/html")
        msg.attach(filename, opml, 'text/xml')
        msg.send(fail_silently=True)
        
        logging.user(self.user, "~BB~FM~SBSending OPML backup email to: %s" % self.user.email)
開發者ID:343max,項目名稱:NewsBlur,代碼行數:28,代碼來源:models.py

示例2: send_opml_export_email

# 需要導入模塊: from apps.feed_import.models import OPMLExporter [as 別名]
# 或者: from apps.feed_import.models.OPMLExporter import process [as 別名]
    def send_opml_export_email(self, reason=None, force=False):
        if not self.user.email:
            return
        
        emails_sent = MSentEmail.objects.filter(receiver_user_id=self.user.pk,
                                                email_type='opml_export')
        day_ago = datetime.datetime.now() - datetime.timedelta(days=1)
        for email in emails_sent:
            if email.date_sent > day_ago and not force:
                logging.user(self.user, "~SN~FMNot sending opml export email, already sent today.")
                return

        MSentEmail.record(receiver_user_id=self.user.pk, email_type='opml_export')
        
        exporter = OPMLExporter(self.user)
        opml     = exporter.process()

        params = {
            'feed_count': UserSubscription.objects.filter(user=self.user).count(),
            'reason': reason,
        }
        user    = self.user
        text    = render_to_string('mail/email_opml_export.txt', params)
        html    = render_to_string('mail/email_opml_export.xhtml', params)
        subject = "Backup OPML file of your NewsBlur sites"
        filename= 'NewsBlur Subscriptions - %s.xml' % datetime.datetime.now().strftime('%Y-%m-%d')
        msg     = EmailMultiAlternatives(subject, text, 
                                         from_email='NewsBlur <%s>' % settings.HELLO_EMAIL,
                                         to=['%s <%s>' % (user, user.email)])
        msg.attach_alternative(html, "text/html")
        msg.attach(filename, opml, 'text/xml')
        msg.send(fail_silently=True)
        
        logging.user(self.user, "~BB~FM~SBSending OPML backup email to: %s" % self.user.email)
開發者ID:JayabalM,項目名稱:NewsBlur,代碼行數:36,代碼來源:models.py

示例3: opml_export

# 需要導入模塊: from apps.feed_import.models import OPMLExporter [as 別名]
# 或者: from apps.feed_import.models.OPMLExporter import process [as 別名]
def opml_export(request):
    user     = get_user(request)
    exporter = OPMLExporter(user)
    opml     = exporter.process()
    now      = datetime.datetime.now()
    
    response = HttpResponse(opml, mimetype='text/xml')
    response['Content-Disposition'] = 'attachment; filename=NewsBlur Subscriptions - %s' % (
        now.strftime('%d %B %Y')
    )
    
    return response
開發者ID:Laptop765,項目名稱:NewsBlur,代碼行數:14,代碼來源:views.py

示例4: opml_export

# 需要導入模塊: from apps.feed_import.models import OPMLExporter [as 別名]
# 或者: from apps.feed_import.models.OPMLExporter import process [as 別名]
def opml_export(request):
    user     = get_user(request)
    now      = datetime.datetime.now()
    if request.REQUEST.get('user_id') and user.is_staff:
        user = User.objects.get(pk=request.REQUEST['user_id'])
    exporter = OPMLExporter(user)
    opml     = exporter.process()
    
    response = HttpResponse(opml, mimetype='text/xml')
    response['Content-Disposition'] = 'attachment; filename=NewsBlur Subscriptions - %s - %s' % (
        user.username,
        now.strftime('%Y-%m-%d')
    )
    
    return response
開發者ID:AlphaCluster,項目名稱:NewsBlur,代碼行數:17,代碼來源:views.py

示例5: opml_export

# 需要導入模塊: from apps.feed_import.models import OPMLExporter [as 別名]
# 或者: from apps.feed_import.models.OPMLExporter import process [as 別名]
def opml_export(request):
    user = get_user(request)
    now = datetime.datetime.now()
    if request.REQUEST.get("user_id") and user.is_staff:
        user = User.objects.get(pk=request.REQUEST["user_id"])
    exporter = OPMLExporter(user)
    opml = exporter.process()

    response = HttpResponse(opml, mimetype="text/xml")
    response["Content-Disposition"] = "attachment; filename=NewsBlur Subscriptions - %s - %s" % (
        user.username,
        now.strftime("%Y-%m-%d"),
    )

    return response
開發者ID:gforguru,項目名稱:NewsBlur,代碼行數:17,代碼來源:views.py


注:本文中的apps.feed_import.models.OPMLExporter.process方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。