Fix configuration on new project
offlate/core/manager.py
| 17 | 17 | from pathlib import Path | |
| 18 | 18 | from ..formats.exception import UnsupportedFormatException | |
| 19 | 19 | from ..systems.list import systems | |
| 20 | + | from ..systems.project import Project | |
| 20 | 21 | ||
| 21 | 22 | import json | |
| 22 | 23 | import os | |
… | |||
| 187 | 188 | settings = self.settings.conf[system['key']] | |
| 188 | 189 | for s in self.settings.conf['Generic'].keys(): | |
| 189 | 190 | settings[s] = self.settings.conf['Generic'][s] | |
| 190 | - | return system['system'].isConfigured(settings) | |
| 191 | + | return Project.isConfigured(system['system'], settings) | |
| 191 | 192 | ||
| 192 | 193 | def isNew(self): | |
| 193 | 194 | if not 'Generic' in self.settings.conf: | |
offlate/systems/project.py
| 111 | 111 | raise Exception("Unimplemented method in concrete class: reload") | |
| 112 | 112 | ||
| 113 | 113 | @staticmethod | |
| 114 | - | def isConfigured(conf): | |
| 114 | + | def isConfigured(project_class, conf): | |
| 115 | 115 | """ | |
| 116 | 116 | :param dict conf: Offlate configuration | |
| 117 | 117 | :returns: Whether the configuration is sufficient for this project (system) | |
| 118 | 118 | :rtype: bool | |
| 119 | 119 | """ | |
| 120 | - | for spec in getSystemConfigSpec(): | |
| 120 | + | for spec in project_class.getSystemConfigSpec(): | |
| 121 | 121 | if not spec.isConfigured(conf): | |
| 122 | 122 | return False | |
| 123 | 123 | return True |
offlate/systems/tp.py
| 142 | 142 | 'lang': self.lang}) | |
| 143 | 143 | return {'default': self.po.content()} | |
| 144 | 144 | ||
| 145 | - | @staticmethod | |
| 146 | - | def isConfigured(conf): | |
| 147 | - | res = 'email' in conf and conf['email'] != '' and conf['email'] != None | |
| 148 | - | res = res and 'name' in conf and conf['name'] != '' and \ | |
| 149 | - | conf['name'] != None | |
| 150 | - | res = res and 'server' in conf and conf['server'] != '' and \ | |
| 151 | - | conf['server'] != None | |
| 152 | - | res = res and 'user' in conf and conf['user'] != '' and \ | |
| 153 | - | conf['user'] != None | |
| 154 | - | return res | |
| 155 | - | ||
| 156 | 145 | def getExternalFiles(self): | |
| 157 | 146 | return [self.po.getExternalFiles()] | |
| 158 | 147 |