Skip to content

Commit 2dff2d3

Browse files
Merge pull request #6 from RobinEnjalbert/v25.0
V25.0
2 parents 815d097 + 1664171 commit 2dff2d3

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $ pip install git+https://github.com/mimesis-inria/SimulationSimpleDatabase.git
3232

3333
# Option 2 (DEVS): install as editable
3434
$ git clone https://github.com/mimesis-inria/SimulationSimpleDatabase.git
35-
$ cd SimRender
35+
$ cd SimulationSimpleDatabase
3636
$ pip install -e .
3737
```
3838

docs/src/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Install with *pip*
3535

3636
.. code-block:: bash
3737
38-
$ pip install git+https://github.com/mimesis-inria/SimulationSimpleDatabase.git
38+
pip install git+https://github.com/mimesis-inria/SimulationSimpleDatabase.git
3939
4040
Then, you should be able to run:
4141

src/SSD/core/database.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,23 @@ def __new_fields(self,
253253
field_name, field_type = field[0], field[1]
254254
field_default = '_null_' if len(field) == 2 else field[2]
255255

256-
# As peewee.Model creates a new attribute named field_name, check that this attribute does not exist
257-
if field_name in [m[0] for m in getmembers(table)]:
258-
raise ValueError(f"Tried to create a field '{field_name}' in the Table '{table_name}'. "
259-
f"You are not allowed to create a field with this name, please rename it.")
260-
261256
# Extend the Table
262257
if field_name not in table.fields():
258+
259+
# As peewee.Model creates a new attribute named field_name, check that this attribute does not exist
260+
if field_name in [m[0] for m in getmembers(table)]:
261+
raise ValueError(f"Tried to create a field '{field_name}' in the Table '{table_name}'. "
262+
f"You are not allowed to create a field with this name, please rename it.")
263+
263264
# FK
264265
if type(field_type) == str:
265266
if (fk_table_name := self.make_name(field_type)) not in self.__tables.keys():
266267
raise ValueError(f"Cannot create the ForeignKey '{fk_table_name}' since this Table does not"
267268
f"exists. Created Tables so far: {self.__tables.keys()}")
268269
table.extend_fk(self.__tables[fk_table_name], field_name)
269270
self.__fk[table_name][field_name] = fk_table_name
271+
272+
# Standard field
270273
else:
271274
table.extend(field_name, field_type, field_default)
272275

0 commit comments

Comments
 (0)