c3po/mod/communicator.py
def _merge_local_and_gdoc(self, entry, local_trans_csv,
                              local_meta_csv, gdocs_trans_csv, gdocs_meta_csv):
        """
        Download csv from GDoc.
        :return: returns resource if worksheets are present
        :except: raises PODocsError with info if communication with GDocs
                 lead to any errors
        """
        try:
            new_translations = po_to_csv_merge(
                self.languages, self.locale_root, self.po_files_path,
                local_trans_csv, local_meta_csv,
                gdocs_trans_csv, gdocs_meta_csv)
            if new_translations:
                local_ods = os.path.join(self.temp_path, LOCAL_ODS)
                csv_to_ods(local_trans_csv, local_meta_csv, local_ods)
                media = gdata.data.MediaSource(
                    file_path=local_ods, content_type=
                    'application/x-vnd.oasis.opendocument.spreadsheet'
                )
                self.gd_client.UpdateResource(entry, media=media,
                                              update_metadata=True)
        except (IOError, OSError, RequestError) as e:
            raise PODocsError(e)
def _merge_local_and_gdoc(self, entry, local_trans_csv,
                              local_meta_csv, gdocs_trans_csv, gdocs_meta_csv):
        """
        Download csv from GDoc.
        :return: returns resource if worksheets are present
        :except: raises PODocsError with info if communication with GDocs
                 lead to any errors
        """
        try:
            new_translations = po_to_csv_merge(
                self.languages, self.locale_root, self.po_files_path,
                local_trans_csv, local_meta_csv,
                gdocs_trans_csv, gdocs_meta_csv)
            if new_translations:
                local_ods = os.path.join(self.temp_path, LOCAL_ODS)
                csv_to_ods(local_trans_csv, local_meta_csv, local_ods)
                media = gdata.data.MediaSource(
                    file_path=local_ods, content_type=
                    'application/x-vnd.oasis.opendocument.spreadsheet'
                )
                self.gd_client.UpdateResource(entry, media=media,
                                              update_metadata=True)
        except (IOError, OSError, RequestError) as e:
            raise PODocsError(e)
Download csv from GDoc.
        :return: returns resource if worksheets are present
        :except: raises PODocsError with info if communication with GDocs
                 lead to any errors