Skip to content

Commit

Permalink
Let WB know a request is coming from MFR.
Browse files Browse the repository at this point in the history
  • Loading branch information
AddisonSchiller authored and cslzchen committed Dec 5, 2017
1 parent 8bb2dd4 commit 5a88dd5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 10 additions & 8 deletions mfr/server/handlers/core.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import os
import abc
import uuid
import asyncio
import os
import pkg_resources
import uuid

from raven.contrib.tornado import SentryMixin
import tornado.web
import tornado.iostream
from raven.contrib.tornado import SentryMixin

import waterbutler.core.exceptions
import waterbutler.core.utils
import waterbutler.server.utils
import waterbutler.core.exceptions

from mfr.server import settings
from mfr.core.metrics import MetricsRecord
from mfr.core import utils, exceptions, remote_logging
from mfr.core.metrics import MetricsRecord
from mfr.server import settings

CORS_ACCEPT_HEADERS = [
'Range',
Expand Down Expand Up @@ -97,13 +97,15 @@ def NAME(self):

async def prepare(self):
"""Builds an MFR provider instance, to which it passes the the ``url`` query parameter.
From that, the file metadata is extracted. Also builds cached waterbutler providers.
From that, the file metadata is extracted. Also builds cached waterbutler providers.
"""

if self.request.method == 'OPTIONS':
return

try:
self.url = self.request.query_arguments['url'][0].decode('utf-8')
# retrieve the url from request query parameter and append `&mfr=ture`
self.url = self.request.query_arguments['url'][0].decode('utf-8') + '&mfr=true'
except KeyError:
raise exceptions.ProviderError(
'"url" is a required argument.',
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def parse_requirements(requirements):
'mfr.exporters': [
# google docs
'.gdraw = mfr.extensions.image:ImageExporter',
'.gdoc = mfr.extensions.unoconv:UnoconvExporter',
'.gsheet = mfr.extensions.unoconv:UnoconvExporter',
'.gslides = mfr.extensions.unoconv:UnoconvExporter',

Expand Down Expand Up @@ -660,7 +659,6 @@ def parse_requirements(requirements):

# google docs
'.gdraw = mfr.extensions.image:ImageRenderer',
'.gdoc = mfr.extensions.unoconv:UnoconvRenderer',
'.gsheet = mfr.extensions.tabular:TabularRenderer',
'.gslides = mfr.extensions.unoconv:UnoconvRenderer',

Expand Down Expand Up @@ -693,6 +691,7 @@ def parse_requirements(requirements):

# pdf
'.pdf = mfr.extensions.pdf:PdfRenderer',
'.gdoc = mfr.extensions.pdf:PdfRenderer',

# rst
'.rst = mfr.extensions.rst:RstRenderer',
Expand Down

0 comments on commit 5a88dd5

Please sign in to comment.