'''
Created on 07 August 2012

@author: Corinne
'''
import logging

logger = logging.getLogger('document')

class ClientDocumentAnnotationCreateAttributes(object):

    def __init__(self, request):
        self.request = request
    
    def get_user(self):
        user = ''
        try:
            user = self.request.POST['user']
        except Exception, err:
            logger.info('No user attribute in the http post request. ' + str(err))
        return user
    
    def get_documentary_file(self):
        documentary_file = ''
        try:
            documentary_file = self.request.POST['documentary_file_id']
        except Exception, err:
            logger.info('No documentary_file_id attribute in the http post request. ' + str(err))
        return documentary_file
    
    def get_annotation_id(self):
        annotation_id = ''
        try:
            annotation_id = self.request.POST['annotation']
        except Exception, err:
            logger.info('No annotation_id attribute in the http post request. ' + str(err))
        return annotation_id
    
    def get_document(self):
        document = ''
        try:
            document = self.request.POST['document_id']
        except Exception, err:
            logger.info('No document_id attributes in the http post request. ' + str(err))
        return document
    
    def get_tags(self):
        tags = []
        try:
            tags = self.request.POST['tags']
            tags = eval(tags)
        except Exception, err:
            logger.info('Info: ' + str(err))
        
        return tags
    
    def get_annotated_text(self):
        annotated_text = ''
        try:
            annotated_text = self.request.POST['annotated_text']
        except Exception, err:
            logger.info('No annotated_text attributes in the http post request. ' + str(err))
        return annotated_text
    
    def get_annotated_text_page(self):
        annotated_text_page = ''
        try:
            annotated_text_page = self.request.POST['annotated_text_page']
        except Exception, err:
            logger.info('No annotated_text_page attributes in the http post request. ' + str(err))
        return annotated_text_page
    
    def get_annotated_text_offset(self):
        annotated_text_offset = ''
        try:
            annotated_text_offset = self.request.POST['annotated_text_offset']
        except Exception, err:
            logger.info('No annotated_text_offset attributes in the http post request. ' + str(err))
        return annotated_text_offset