Beispiel #1
0
    def run(self, user_id):
        user = User.objects.get(pk=user_id)
        logging.user(user, "~FR~SBOPML upload (task) starting...")

        opml = UploadedOPML.objects.filter(user_id=user_id).first()
        opml_importer = OPMLImporter(opml.opml_file, user)
        opml_importer.process()
        
        feed_count = UserSubscription.objects.filter(user=user).count()
        user.profile.send_upload_opml_finished_email(feed_count)
        logging.user(user, "~FR~SBOPML upload (task): ~SK%s~SN~SB~FR feeds" % (feed_count))
Beispiel #2
0
def ProcessOPML(user_id):
    user = User.objects.get(pk=user_id)
    logging.user(user, "~FR~SBOPML upload (task) starting...")

    opml = UploadedOPML.objects.filter(user_id=user_id).first()
    opml_importer = OPMLImporter(opml.opml_file, user)
    opml_importer.process()

    feed_count = UserSubscription.objects.filter(user=user).count()
    user.profile.send_upload_opml_finished_email(feed_count)
    logging.user(
        user, "~FR~SBOPML upload (task): ~SK%s~SN~SB~FR feeds" % (feed_count))
Beispiel #3
0
def ProcessOPML(user_id):
    user = User.objects.get(pk=user_id)
    logging.user(user, "~FR~SBOPML upload (task) starting...")

    opml = UploadedOPML.objects.filter(user_id=user_id).first()
    opml_importer = OPMLImporter(opml.opml_file.encode('utf-8'), user)
    opml_importer.process()

    feed_count = UserSubscription.objects.filter(user=user).count()
    user.profile.send_upload_opml_finished_email(feed_count)
    logging.user(
        user, "~FR~SBOPML upload (task): ~SK%s~SN~SB~FR feeds" % (feed_count))

    UserSubscription.queue_new_feeds(user)
    UserSubscription.refresh_stale_feeds(user, exclude_new=True)
Beispiel #4
0
def opml_upload(request):
    xml_opml = None
    message = "OK"
    code = 1
    payload = {}
    
    if request.method == 'POST':
        if 'file' in request.FILES:
            logging.user(request, "~FR~SBOPML upload starting...")
            file = request.FILES['file']
            xml_opml = file.read()
            opml_importer = OPMLImporter(xml_opml, request.user)
            folders = opml_importer.process()

            feeds = UserSubscription.objects.filter(user=request.user).values()
            payload = dict(folders=folders, feeds=feeds)
            logging.user(request, "~FR~SBOPML Upload: ~SK%s~SN~SB~FR feeds" % (len(feeds)))
            
            request.session['import_from_google_reader'] = False
        else:
            message = "Attach an .opml file."
            code = -1
            
    data = json.encode(dict(message=message, code=code, payload=payload))
    return HttpResponse(data, mimetype='text/plain')
Beispiel #5
0
def opml_upload(request):
    xml_opml = None
    message = "OK"
    code = 1
    payload = {}

    if request.method == 'POST':
        if 'file' in request.FILES:
            logging.user(request, "~FR~SBOPML upload starting...")
            file = request.FILES['file']
            xml_opml = file.read()
            opml_importer = OPMLImporter(xml_opml, request.user)
            folders = opml_importer.process()

            feeds = UserSubscription.objects.filter(user=request.user).values()
            payload = dict(folders=folders, feeds=feeds)
            logging.user(
                request,
                "~FR~SBOPML Upload: ~SK%s~SN~SB~FR feeds" % (len(feeds)))

            request.session['import_from_google_reader'] = False
        else:
            message = "Attach an .opml file."
            code = -1

    data = json.encode(dict(message=message, code=code, payload=payload))
    return HttpResponse(data, mimetype='text/plain')
Beispiel #6
0
def opml_upload(request):
    xml_opml = None
    message = "OK"
    code = 1
    payload = {}
    
    if request.method == 'POST':
        if 'file' in request.FILES:
            logging.info(" ---> [%s] OPML Upload" % request.user)
            file = request.FILES['file']
            xml_opml = file.read()
            
            opml_importer = OPMLImporter(xml_opml, request.user)
            folders = opml_importer.process()

            feeds = UserSubscription.objects.filter(user=request.user).values()
            payload = dict(folders=folders, feeds=feeds)
        else:
            message = "Attach an .opml file."
            code = -1
            
    data = json.encode(dict(message=message, code=code, payload=payload))
    return HttpResponse(data, mimetype='text/plain')