Changeset 12287 for main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Timestamp:
- 21 Dec 2014, 17:00:10 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/export.py
r12266 r12287 38 38 @property 39 39 def fields(self): 40 return tuple(sorted(iface_names(self.iface))) + ( 41 'users_with_local_roles',) 40 return tuple(sorted(iface_names(self.iface, exclude_attribs=False, 41 omit=['is_verifiable', 42 'translated_state', 43 'user_id', 44 'formatted_transition_date', 45 'translated_class_name', 46 'connected_files', # Could be used to export file URLs 47 ] 48 ))) + ( 49 'users_with_local_roles',) 42 50 43 51 def mangle_value(self, value, name, context=None): … … 49 57 for local_role, user_name, setting in role_map.getPrincipalsAndRoles(): 50 58 value.append({'user_name':user_name,'local_role':local_role}) 59 if name == 'history': 60 value = value.messages 51 61 return super(DocumentExporterBase, self).mangle_value( 52 62 value, name, context) -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_export.py
r12266 r12287 62 62 exporter.export([self.pdfdocument], self.outfile) 63 63 result = open(self.outfile, 'rb').read() 64 self.assertTrue( 65 'description,document_id,title,users_with_local_roles\r\n' 66 ',DOC1,,"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"' 67 in result 64 self.assertMatches( 65 'class_name,description,document_id,history,state,title,users_with_local_roles\r\n' 66 'PDFDocument,,DOC1,' 67 '[u\'2014-12-21 16:55:16 UTC - Document created by system\'],' 68 'created,,"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"', 69 result 68 70 ) 69 71 return … … 74 76 exporter.export_all(self.app, self.outfile) 75 77 result = open(self.outfile, 'rb').read() 76 self.assertTrue( 77 'description,document_id,title,users_with_local_roles\r\n' 78 ',DOC1,,"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"' 79 in result 78 self.assertMatches( 79 'class_name,description,document_id,history,state,title,users_with_local_roles\r\n' 80 'PDFDocument,,DOC1,' 81 '[u\'2014-12-21 16:55:16 UTC - Document created by system\'],' 82 'created,,"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"', 83 result 80 84 ) 81 85 return … … 109 113 exporter.export([self.htmldocument], self.outfile) 110 114 result = open(self.outfile, 'rb').read() 111 self.assertTrue( 112 'description,document_id,html_multilingual,title,' 113 'users_with_local_roles\r\n,DOC2,' 114 ',,' 115 '"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"\r\n' 116 in result 115 self.assertMatches( 116 'class_name,description,document_id,history,html_dict,' 117 'html_multilingual,state,title,users_with_local_roles\r\n' 118 'HTMLDocument,,DOC2,' 119 '[u\'2014-12-21 16:50:28 UTC - Document created by system\'],' 120 '{},,created,,"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"', 121 result 117 122 ) 118 123 return … … 123 128 exporter.export_all(self.app, self.outfile) 124 129 result = open(self.outfile, 'rb').read() 125 self.assertTrue( 126 'description,document_id,html_multilingual,title,' 127 'users_with_local_roles\r\n,DOC2,' 128 ',,' 129 '"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"\r\n' 130 in result 130 self.assertMatches( 131 'class_name,description,document_id,history,html_dict,' 132 'html_multilingual,state,title,users_with_local_roles\r\n' 133 'HTMLDocument,,DOC2,' 134 '[u\'2014-12-21 16:50:28 UTC - Document created by system\'],' 135 '{},,created,,"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"', 136 result 131 137 ) 132 138 return
Note: See TracChangeset for help on using the changeset viewer.