Unnötigen Leerraum entfernen, einfache Anführungszeichen
							parent
							
								
									1260421e7f
								
							
						
					
					
						commit
						4c6521fb48
					
				|  | @ -1,5 +1,6 @@ | |||
| #!/usr/bin/env python | ||||
| 
 | ||||
| from lib import cli | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
| if __name__ == '__main__': | ||||
|     cli.main() | ||||
|  |  | |||
|  | @ -1,27 +1,27 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| import urlparse | ||||
| 
 | ||||
| import sys | ||||
| import urlparse | ||||
| 
 | ||||
| from config_at import Config | ||||
| from environments import ENVIRONMENTS, Environment | ||||
| from functions import CamadeusFunctions | ||||
| 
 | ||||
| def main(): | ||||
| 
 | ||||
|     def _usage(): | ||||
|         print '\nVerwendung: cam.py <environment> <command> [<module_name>/<setup_function>]\n' | ||||
|         print 'Commands:\n' | ||||
|         print '   create                     Neue Datenbank erstellen' | ||||
|         print '   create_from_dump           Neue Datenbank von Dump erstellen' | ||||
|         print '   setup                      Modulinstallation. Konfigurationen.' | ||||
|         print '   setup_part setup_function  Aufruf eines einzelnen Setup Schrittes.' | ||||
|         print '                              "setup_part info" listet die verfügbaren Setup Schritte auf.' | ||||
|         print '   setup                      Modulinstallation, Konfigurationen' | ||||
|         print '   setup_part setup_function  Aufruf eines einzelnen Setup-Schrittes' | ||||
|         print '                              "setup_part info" listet die verfügbaren Setup-Schritte auf' | ||||
|         print '   rollout                    Setzt Dokumentnummern, importiert Benutzer, setzt cam_dmi auf noupdate, ...' | ||||
|         print '   update module_name         Modul updaten' | ||||
|         print '   install modul_name         Modul installieren' | ||||
|         print '   uninstall modul_name       Modul deinstallieren' | ||||
|         print '   cancel_upgrade modul_name  Abbruch Modulinstallation' | ||||
|         print '   update_modules             Update aller Module in der config Modulliste.' | ||||
|         print '   install module_name        Modul installieren' | ||||
|         print '   uninstall module_name      Modul deinstallieren' | ||||
|         print '   cancel_upgrade module_name Abbruch Modulinstallation' | ||||
|         print '   update_modules             Update aller Module in der config-Modulliste' | ||||
|         print '   update_all                 Update aller verfügbaren Module' | ||||
|         print '   list-envs                  Environments auflisten' | ||||
|         print '   anonym                     Daten anonymisieren (Namen, Adresse, E-Mail, ...)' | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| 
 | ||||
| class Config(): | ||||
|     def __init__(self): | ||||
|          | ||||
|         self.dump_file = "upgraded_file_name.dump" | ||||
|         self.dump_file = 'upgraded_file_name.dump' | ||||
| 
 | ||||
|         self.module_name = None | ||||
|         self.lang = 'de_DE' # de_DE, en_US | ||||
|  | @ -243,7 +243,6 @@ class Config(): | |||
|         self.default_values = [   # ir.values | ||||
|             #('product.template', 'type', 'service'), | ||||
|             #('product.template', 'type', 'XML:xmlid'),    #mit prefix "XML:" kann eine XML ID übergeben werden | ||||
|              | ||||
|         ] | ||||
| 
 | ||||
|         self.data_updates = { | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| 
 | ||||
| class Environment(): | ||||
|     def __init__(self, host, port, dbname, username, pwd=None, super_admin_pw=None, basic_auth=None): | ||||
|         self.host = host | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| 
 | ||||
| import base64 | ||||
| import json | ||||
| import pprint | ||||
|  | @ -42,7 +43,7 @@ class CamadeusFunctions(): | |||
|         } | ||||
|         url = '%s:%s/web/database/restore?restore_pwd=%s&new_db=%s&mode=restore' | ||||
|         url %= (self.env.host, self.env.port, self.env.admin_pw, self.env.dbname) | ||||
|         print "Request: " + url | ||||
|         print 'Request: ' + url | ||||
|         res = requests.post(url, files=files, verify=False) | ||||
|         if (res.status_code != 200): | ||||
|             return False | ||||
|  | @ -656,13 +657,12 @@ class CamadeusFunctions(): | |||
|         """Defaultwerte für Dokumente setzen""" | ||||
| 
 | ||||
|         for model,field,value in self.config.default_values: | ||||
|              | ||||
|             #falls XML ID (prefix "XML:") dann die DB ID holen | ||||
|             # Falls XML ID (prefix "XML:") dann die DB ID holen | ||||
|             if value[0:4] == 'XML:': | ||||
|                 xml_id = value[4:] | ||||
|                 dummy,dummy2,res_id = self._execute('ir.model.data', 'xmlid_lookup', xml_id) | ||||
|                 if not res_id: | ||||
|                     raise Exception("Defaultwerte Anlegen: XML ID %s nicht vorhanden!" % (xml_id)) | ||||
|                     raise Exception('Defaultwerte anlegen: XML ID %s nicht vorhanden!' % (xml_id)) | ||||
|                 value = res_id | ||||
| 
 | ||||
|             vals = { | ||||
|  | @ -680,7 +680,6 @@ class CamadeusFunctions(): | |||
|                 self._execute('ir.values', 'create', vals) | ||||
|         return True | ||||
| 
 | ||||
| 
 | ||||
|     def update_special_values(self): | ||||
|         """Spezialwerte setzen""" | ||||
| 
 | ||||
|  | @ -705,7 +704,6 @@ class CamadeusFunctions(): | |||
| 
 | ||||
|         return True | ||||
| 
 | ||||
|      | ||||
|     def update_values(self): | ||||
|         """Existierende Daten aktualisieren""" | ||||
| 
 | ||||
|  | @ -742,7 +740,7 @@ class CamadeusFunctions(): | |||
|         return True | ||||
| 
 | ||||
|     def invalidate_email(self): | ||||
|         """E-Mail adressen @ durch # erstezen um unbeabsichtigen E-Mail Versand zu vermeiden""" | ||||
|         """In E-Mail-Adressen @ durch # ersetzen, um unbeabsichtigen E-Mail-Versand zu vermeiden""" | ||||
| 
 | ||||
|         #E-Mail adressen von res_partner: @ -> # | ||||
|         p_ids = self._execute('res.partner', 'search', [('email','ilike','%@%')]) | ||||
|  | @ -754,7 +752,7 @@ class CamadeusFunctions(): | |||
|             self._execute('res.partner', 'write', [id], {'email': new_email}) | ||||
| 
 | ||||
|     def finance_config(self): | ||||
|         """Basiskonfiguration für Finanzen Laden""" | ||||
|         """Basiskonfiguration für Finanzen laden""" | ||||
| 
 | ||||
|         if hasattr(self.config, 'finance_config'): | ||||
|             vals = self._execute('account.config.settings', 'default_get', []) | ||||
|  | @ -775,15 +773,14 @@ class CamadeusFunctions(): | |||
|         res &= self.make_anonymous_one('make_anonymous_cron') | ||||
|         return res | ||||
| 
 | ||||
|          | ||||
|     def make_anonymous_one(self, func_name): | ||||
|         """Anonymisieren der Daten ein Schritt""" | ||||
| 
 | ||||
|         try: | ||||
|             getattr(self, func_name)() | ||||
|             print '.............. ' + func_name + ": OK"  | ||||
|             print '.............. ' + func_name + ': OK' | ||||
|         except: | ||||
|             print '.............. ' + func_name + ": ERROR!!!" | ||||
|             print '.............. ' + func_name + ': ERROR!!!' | ||||
|             return False | ||||
|         return True | ||||
| 
 | ||||
|  | @ -791,7 +788,7 @@ class CamadeusFunctions(): | |||
|         ids = self._execute('res.partner', 'search', []) | ||||
|         for id in ids: | ||||
|             vals = { | ||||
|                     'name': "Partner %s" % id, | ||||
|                     'name': 'Partner %s' % id, | ||||
|                     'street': '----', | ||||
|                     'email': 'test@example.com', | ||||
|                     } | ||||
|  | @ -802,7 +799,7 @@ class CamadeusFunctions(): | |||
|             ids = self._execute('project.project', 'search', []) | ||||
|             for id in ids: | ||||
|                 vals = { | ||||
|                         'name': "Projekt %s" % id, | ||||
|                         'name': 'Projekt %s' % id, | ||||
|                         } | ||||
|                 self._execute('project.project', 'write', [id], vals) | ||||
| 
 | ||||
|  | @ -810,7 +807,7 @@ class CamadeusFunctions(): | |||
|             ids = self._execute('project.task', 'search', []) | ||||
|             for id in ids: | ||||
|                 vals = { | ||||
|                         'name': "Aufgabe %s" % id, | ||||
|                         'name': 'Aufgabe %s' % id, | ||||
|                         } | ||||
|                 self._execute('project.task', 'write', [id], vals) | ||||
| 
 | ||||
|  | @ -819,7 +816,7 @@ class CamadeusFunctions(): | |||
|             ids = self._execute('hr.employee', 'search', []) | ||||
|             for id in ids: | ||||
|                 vals = { | ||||
|                         'name': "Mitarbeiter %s" % id, | ||||
|                         'name': 'Mitarbeiter %s' % id, | ||||
|                         'work_email': 'test@example.com', | ||||
|                         } | ||||
|                 self._execute('hr.employee','write', [id], vals) | ||||
|  | @ -829,7 +826,7 @@ class CamadeusFunctions(): | |||
|             ids = self._execute('crm.lead', 'search', []) | ||||
|             for id in ids: | ||||
|                 vals = { | ||||
|                         'name': "Lead %s" % id,   | ||||
|                         'name': 'Lead %s' % id, | ||||
|                         'email_from': 'test@example.com', | ||||
|                         'description': '', | ||||
|                         } | ||||
|  | @ -846,6 +843,3 @@ class CamadeusFunctions(): | |||
|         cron_ids = self._execute('ir.cron', 'search', []) | ||||
|         if cron_ids: | ||||
|             self._execute('ir.cron', 'write', cron_ids, {'active': False}) | ||||
| 
 | ||||
| 
 | ||||
|      | ||||
		Loading…
	
		Reference in New Issue