예제 #1
0
 def __init__(self, o, **kwds):
     OmekaLoader.__init__(
         self,
         endpoint_url='http://example.com',
         institution_title=kwds['institution_id'],
         institution_url='http://example.com',
         **kwds
     )
     self.__output_file_path = o
예제 #2
0
 def _run(self, **kwds):
     self.__csv_rows = []
     self.__csv_column_headers = {}
     OmekaLoader._run(self, **kwds)
     sorted_csv_column_headers = ['Collection ID', 'Item ID', 'Tags'] + list(sorted(self.__csv_column_headers.keys()))
     with open(self.__output_file_path, 'w+b') as csv_file:
         csv_writer = csv.writer(csv_file)
         csv_writer.writerow(sorted_csv_column_headers)
         for csv_row in self.__csv_rows:
             out_csv_row = []
             for csv_column_header in sorted_csv_column_headers:
                 value = csv_row.get(csv_column_header)
                 if value is None or len(value) == 0:
                     out_csv_row.append('')
                     continue
                 value = '|'.join(value)
                 out_csv_row.append(value)
             csv_writer.writerow(out_csv_row)