def render(self, context):
        from django.utils.text import normalize_newlines
        import base64
        context.push()
        if self.obj_id_lookup_var is not None:
            try:
                self.obj_id = template.resolve_variable(self.obj_id_lookup_var, context)
            except template.VariableDoesNotExist:
                return ''
            # Validate that this object ID is valid for this content-type.
            # We only have to do this validation if obj_id_lookup_var is provided,
            # because do_comment_form() validates hard-coded object IDs.
            try:
                self.content_type.get_object_for_this_type(pk=self.obj_id)
            except __HOLE__:
                context['display_form'] = False
            else:
                context['display_form'] = True
        else:
            context['display_form'] = True
        context['target'] = '%s:%s' % (self.content_type.id, self.obj_id)
        options = []
        for var, abbr in (('photos_required', PHOTOS_REQUIRED),
                          ('photos_optional', PHOTOS_OPTIONAL),
                          ('ratings_required', RATINGS_REQUIRED),
                          ('ratings_optional', RATINGS_OPTIONAL),
                          ('is_public', IS_PUBLIC)):
            context[var] = getattr(self, var)
            if getattr(self, var):
                options.append(abbr)
        context['options'] = ','.join(options)
        if self.free:
            context['hash'] = Comment.objects.get_security_hash(context['options'], '', '', context['target'])
            default_form = loader.get_template(FREE_COMMENT_FORM)
        else:
            context['photo_options'] = self.photo_options
            context['rating_options'] = normalize_newlines(base64.encodestring(self.rating_options).strip())
            if self.rating_options:
                context['rating_range'], context['rating_choices'] = Comment.objects.get_rating_options(self.rating_options)
            context['hash'] = Comment.objects.get_security_hash(context['options'], context['photo_options'], context['rating_options'], context['target'])
            default_form = loader.get_template(COMMENT_FORM)
        output = default_form.render(context)
        context.pop()
        return output
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/contrib/comments/templatetags/comments.py/CommentFormNode.render