File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ - ** 0.3.1** (2025-04-16):
2+ - fix race conditions around tags (duplicate keys)
3+
14- ** 0.3.0** (2025-04-15):
25 - now collecting more data: tags, license, geo-accuracy
36 - re-downloading these data for existing records
Original file line number Diff line number Diff line change 1515except ImportError :
1616 pass
1717
18- __version__ = "0.3.0.post1 "
18+ __version__ = "0.3.1 "
Original file line number Diff line number Diff line change 77
88import datetime
99
10+ import sqlalchemy
11+
1012from .models import License , Photo , Tag
1113from .session import Session
1214from .user_saver import UserSaver
@@ -108,10 +110,12 @@ def save(self, data):
108110 photo .update (** photo_data )
109111
110112 photo .tags = []
111- for tag in tags :
112- tag = session .merge (session .get (Tag , tag ) or Tag (tag = tag ))
113- if tag not in photo .tags :
114- photo .tags .append (tag )
113+ for tag in set (tags ):
114+ try :
115+ with session .begin_nested ():
116+ photo .tags .append (session .merge (Tag (tag = tag )))
117+ except sqlalchemy .exc .IntegrityError :
118+ photo .tags .append (session .get (Tag , tag ))
115119
116120 license = session .merge (
117121 session .get (License , license ) or License (id = license )
You can’t perform that action at this time.
0 commit comments