Skip to content

Commit

Permalink
Tune colors, fix lang highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Jan 4, 2015
1 parent 498787a commit 1937e0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@
'github_button': True,
'github_banner': True,
'travis_button': True,
'pre_bg': '#FFFAF0',
'pre_bg': '#FFF6E5',
'note_bg': '#E5ECD1',
'note_border': '#BFCF8C',
}

# Add any paths that contain custom themes here, relative to this directory.
Expand Down
13 changes: 9 additions & 4 deletions docs/web.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ files. This means adding *enctype* attribute to your form element with
the value of *multipart/form-data*. A very simple example would be a
form that accepts a mp3 file. Notice, we have set up the form as
previously explained and also added the *input* element of the *file*
type::
type:

.. code-block:: html

<form action="/store_mp3" method="post" accept-charset="utf-8"
enctype="multipart/form-data">
Expand All @@ -156,20 +158,23 @@ handler<aiohttp-web-handler>` (here assumed to answer on
:class:`FileField` object accessible through the :meth:`Request.post`
coroutine. The two properties we are interested in are
:attr:`~FileField.file` and :attr:`~FileField.filename` and we will
use those to read a file's name and a content::
use those to read a file's name and a content:

.. code-block:: python
import os
import uuid
from aiohttp.web import Response
@asyncio.coroutine
def store_mp3_view(request):
data = yield from request.post()
# ``filename`` contains the name of the file in string format.
# filename contains the name of the file in string format.
filename = data['mp3'].filename
# ``input_file`` contains the actual file data which needs to be
# input_file contains the actual file data which needs to be
# stored somewhere.
input_file = data['mp3'].file
Expand Down

0 comments on commit 1937e0a

Please sign in to comment.