mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot: add a mode parameter to readfile
When using the read_method in a "python job", it's sometimes needed to read a file in binary mode. With this commit, the mode can be specified when calling the method.
This commit is contained in:
parent
799f3aed22
commit
800691a14c
@ -890,12 +890,13 @@ class runbot_build(models.Model):
|
||||
new_step = step_ids[next_index] # job to do, state is job_state (testing or running)
|
||||
return {'active_step': new_step.id, 'local_state': new_step._step_state()}
|
||||
|
||||
def read_file(self, file):
|
||||
def read_file(self, file, mode='r'):
|
||||
file_path = self._path(file)
|
||||
try:
|
||||
with open(file_path, 'r') as f:
|
||||
with open(file_path, mode) as f:
|
||||
return f.read()
|
||||
except:
|
||||
except Exception as e:
|
||||
self._log('readfile', 'exception: %s' % e)
|
||||
return False
|
||||
|
||||
def build_type_label(self):
|
||||
|
Loading…
Reference in New Issue
Block a user