equal
deleted
inserted
replaced
|
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 attribute in the http post request. ' + str(err)) |
|
29 return documentary_file |
|
30 |
|
31 def get_annotation(self): |
|
32 annotation = '' |
|
33 try: |
|
34 annotation = self.request.POST['annotation'] |
|
35 except Exception, err: |
|
36 logger.info('No annotation attribute in the http post request. ' + str(err)) |
|
37 return annotation |
|
38 |
|
39 def get_cluster(self): |
|
40 cluster = '' |
|
41 try: |
|
42 cluster = self.request.POST['cluster_id'] |
|
43 except Exception, err: |
|
44 logger.info('No cluster attributes in the http post request. ' + str(err)) |
|
45 return cluster |
|
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 |