<s> from __future__ import unicode_literals <EOL> from django . db . models import Q <EOL> from django . template . defaultfilters import timesince <EOL> from django . utils import six <EOL> from djblets . util . decorators import augment_method_from <EOL> from reviewboard . reviews . models import ScreenshotComment <EOL> from reviewboard . webapi . base import WebAPIResource <EOL> from reviewboard . webapi . decorators import webapi_check_local_site <EOL> from reviewboard . webapi . resources import resources <EOL> from reviewboard . webapi . resources . base_comment import BaseCommentResource <EOL> class BaseScreenshotCommentResource ( BaseCommentResource ) : <EOL> """<STR_LIT>""" <EOL> model = ScreenshotComment <EOL> name = '<STR_LIT>' <EOL> fields = dict ( { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:type>' : '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:description>' : '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT:x>' : { <EOL> '<STR_LIT:type>' : int , <EOL> '<STR_LIT:description>' : '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT:y>' : { <EOL> '<STR_LIT:type>' : int , <EOL> '<STR_LIT:description>' : '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT:w>' : { <EOL> '<STR_LIT:type>' : int , <EOL> '<STR_LIT:description>' : '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT:h>' : { <EOL> '<STR_LIT:type>' : int , <EOL> '<STR_LIT:description>' : '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:type>' : six . text_type , <EOL> '<STR_LIT:description>' : '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> } , ** BaseCommentResource . fields ) <EOL> uri_object_key = '<STR_LIT>' <EOL> allowed_methods = ( '<STR_LIT:GET>' , ) <EOL> def get_queryset ( self , request , * args , ** kwargs ) : <EOL> review_request = resources . review_request . get_object ( request , * args , ** kwargs ) <EOL> return self . model . objects . filter ( <EOL> Q ( screenshot__review_request = review_request ) | <EOL> Q ( screenshot__inactive_review_request = review_request ) , <EOL> review__isnull = False ) <EOL> def serialize_public_field ( self , obj , ** kwargs ) : <EOL> return obj . review . get ( ) . public <EOL> def serialize_timesince_field ( self , obj , ** kwargs ) : <EOL> return timesince ( obj . timestamp ) <EOL> def serialize_user_field ( self , obj , ** kwargs ) : <EOL> return obj . review . get ( ) . user <EOL> def serialize_thumbnail_url_field ( self , obj , ** kwargs ) : <EOL> return obj . get_image_url ( ) <EOL> @ webapi_check_local_site <EOL> @ augment_method_from ( WebAPIResource ) <EOL> def get ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> pass </s>
