This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/maryokhin/.virtualenvs/backend/bin/python /Applications/PyCharm.app/helpers/pycharm/pytestrunner.py -p pytest_teamcity /Users/maryokhin/Workspace/backend/api/tests/test_comment2.py | |
Testing started at 23:08 ... | |
============================= test session starts ============================== | |
platform darwin -- Python 3.4.1 -- py-1.4.20 -- pytest-2.5.2 | |
plugins: django | |
collected 1 items | |
../../../Users/maryokhin/Workspace/backend/api/tests/test_comment2.py E | |
def setup_module(): | |
> channel = Channel.objects.create(name='test') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PostSerializer(ModelSerializer): | |
""" | |
General post serializer. | |
""" | |
url = ReverseField(view_name='post-instance') | |
channel = ChannelSerializer(read_only=True) | |
user = UserInstanceSerializer(read_only=True) | |
latest_comments = serializers.SerializerMethodField('get_latest_comments') | |
comments_url = ReverseField(view_name='post-comment-list') | |
channel_id = serializers.PrimaryKeyRelatedField(source='channel', write_only=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Channels | |
url(r'^channels/$', ChannelViewSet.as_view(**VIEW_LIST), name='channel-list'), | |
url(r'^channels/(?P<channel_key>[\w_]+)/$', ChannelViewSet.as_view(**VIEW_INSTANCE), name='channel-instance'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChannelViewSet(GetObjectByKeyMixin, ModelViewSet): | |
""" | |
View for retrieving and updating channel information. | |
""" | |
queryset = Channel.objects.all() | |
serializer_class = ChannelSerializer | |
lookup_field = 'channel_key' | |
permission_classes = (ChannelPermission,) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReverseField(Field): | |
""" | |
Simple read only field for returning reverse URLs. | |
This field utilizes information from the object being serialized. It does | |
not care about what the current URL contains, lookup fields in the URL, | |
nor the structure of a model. Instead, it takes the field names passed | |
into lookup_fields and reads the values of those fields from the object. | |
The values are then passed as arguments to the reverse function, which | |
constructs the final URL. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import serializers | |
from rest_framework.serializers import ModelSerializer, Serializer | |
from api.models import Subscriber | |
from api.models.channel import Channel | |
from api.util.connection import get_redis_connection | |
from api.util.field import ReverseField | |
class ChannelStatsSerializer(Serializer): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* AbstractGraph.java | |
* | |
* Created: 10th of November 2003 | |
* | |
* File Version: 0.4 | |
* | |
* History: | |
* -------- | |
* - The methods are implemented, They were not implemented before, Tomas Saxeggen and Lars Johansson, 20031118 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import, unicode_literals | |
""" | |
oauthlib.parameters | |
~~~~~~~~~~~~~~~~~~~ | |
This module contains methods related to `section 3.5`_ of the OAuth 1.0a spec. | |
.. _`section 3.5`: http://tools.ietf.org/html/rfc5849#section-3.5 |
NewerOlder