|
1 ''' |
|
2 Created on 07 August 2012 |
|
3 |
|
4 @author: Corinne |
|
5 ''' |
|
6 import logging |
|
7 |
|
8 logger = logging.getLogger('document') |
|
9 |
|
10 class ClientDocumentAnnotationCreateAttributes(object): |
|
11 |
|
12 def __init__(self, request): |
|
13 self.request = request |
|
14 |
|
15 def get_user(self): |
|
16 user = '' |
|
17 try: |
|
18 user = self.request.POST['user'] |
|
19 except Exception, err: |
|
20 logger.info('No user attribute in the http post request. ' + str(err)) |
|
21 return user |
|
22 |
|
23 def get_documentary_file(self): |
|
24 documentary_file = '' |
|
25 try: |
|
26 documentary_file = self.request.POST['documentary_file_id'] |
|
27 except Exception, err: |
|
28 logger.info('No documentary_file_id attribute in the http post request. ' + str(err)) |
|
29 return documentary_file |
|
30 |
|
31 def get_annotation_id(self): |
|
32 annotation_id = '' |
|
33 try: |
|
34 annotation_id = self.request.POST['annotation'] |
|
35 except Exception, err: |
|
36 logger.info('No annotation_id attribute in the http post request. ' + str(err)) |
|
37 return annotation_id |
|
38 |
|
39 def get_document(self): |
|
40 document = '' |
|
41 try: |
|
42 document = self.request.POST['document_id'] |
|
43 except Exception, err: |
|
44 logger.info('No document_id attributes in the http post request. ' + str(err)) |
|
45 return document |
|
46 |
|
47 def get_tags(self): |
|
48 tags = [] |
|
49 try: |
|
50 tags = self.request.POST['tags'] |
|
51 tags = eval(tags) |
|
52 except Exception, err: |
|
53 logger.info('Info: ' + str(err)) |
|
54 |
|
55 return tags |
|
56 |
|
57 def get_annotated_text(self): |
|
58 annotated_text = '' |
|
59 try: |
|
60 annotated_text = self.request.POST['annotated_text'] |
|
61 except Exception, err: |
|
62 logger.info('No annotated_text attributes in the http post request. ' + str(err)) |
|
63 return annotated_text |
|
64 |
|
65 def get_annotated_text_page(self): |
|
66 annotated_text_page = '' |
|
67 try: |
|
68 annotated_text_page = self.request.POST['annotated_text_page'] |
|
69 except Exception, err: |
|
70 logger.info('No annotated_text_page attributes in the http post request. ' + str(err)) |
|
71 return annotated_text_page |
|
72 |
|
73 def get_annotated_text_offset(self): |
|
74 annotated_text_offset = '' |
|
75 try: |
|
76 annotated_text_offset = self.request.POST['annotated_text_offset'] |
|
77 except Exception, err: |
|
78 logger.info('No annotated_text_offset attributes in the http post request. ' + str(err)) |
|
79 return annotated_text_offset |