Merge ~cjwatson/launchpad:reword-sqlobject-comments into launchpad:master
- Git
- lp:~cjwatson/launchpad
- reword-sqlobject-comments
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | e018b2bce23c71e96ed4b7cec4d0e1c865201791 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:reword-sqlobject-comments |
Merge into: | launchpad:master |
Diff against target: |
610 lines (+78/-102) 35 files modified
database/schema/security.cfg (+3/-3) doc/reference/python.rst (+1/-1) lib/lp/answers/browser/questiontarget.py (+1/-1) lib/lp/answers/interfaces/question.py (+2/-2) lib/lp/app/validators/README.txt (+2/-4) lib/lp/bugs/browser/tests/buglinktarget-views.rst (+1/-1) lib/lp/bugs/model/bugtask.py (+1/-1) lib/lp/bugs/model/bugtasksearch.py (+2/-2) lib/lp/buildmaster/interfaces/processor.py (+1/-1) lib/lp/code/doc/codeimport-machine.rst (+1/-1) lib/lp/code/interfaces/branch.py (+1/-1) lib/lp/code/model/tests/test_codereviewkarma.py (+1/-1) lib/lp/code/model/tests/test_revisionauthor.py (+6/-6) lib/lp/registry/browser/person.py (+3/-4) lib/lp/registry/model/distributionsourcepackage.py (+2/-2) lib/lp/registry/model/mailinglist.py (+1/-2) lib/lp/registry/model/person.py (+4/-5) lib/lp/registry/model/pillar.py (+1/-1) lib/lp/registry/tests/test_teammembership.py (+1/-1) lib/lp/services/database/doc/storm-security-proxies.rst (+2/-2) lib/lp/services/database/multitablecopy.py (+3/-3) lib/lp/services/database/sqlbase.py (+22/-23) lib/lp/services/messages/model/message.py (+1/-2) lib/lp/services/statistics/tests/test_update_stats.py (+1/-1) lib/lp/services/tarfile_helpers.py (+0/-10) lib/lp/services/worlddata/interfaces/language.py (+2/-8) lib/lp/soyuz/model/distributionsourcepackagerelease.py (+2/-2) lib/lp/soyuz/scripts/gina/README (+1/-1) lib/lp/testing/__init__.py (+1/-1) lib/lp/translations/doc/rosetta-karma.rst (+2/-2) lib/lp/translations/doc/translationmessage-destroy.rst (+1/-2) lib/lp/translations/model/distroserieslanguage.py (+1/-1) lib/lp/translations/model/pofile.py (+1/-1) lib/lp/translations/model/potemplate.py (+1/-1) utilities/snakefood/Makefile (+2/-2) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jürgen Gmach | Approve | ||
Review via email: mp+451740@code.launchpad.net |
Commit message
Update/remove lots of comments/docstrings mentioning SQLObject
Description of the change
To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/database/schema/security.cfg b/database/schema/security.cfg |
2 | index ab71472..50328ff 100644 |
3 | --- a/database/schema/security.cfg |
4 | +++ b/database/schema/security.cfg |
5 | @@ -3,9 +3,9 @@ |
6 | # |
7 | # Possible permissions: SELECT, INSERT, UPDATE, EXECUTE |
8 | # |
9 | -# Note that we cannot have INSERT only tables if we are using SQLObject, as it |
10 | -# creates new entries by first doing an insert (to get the id) and then |
11 | -# issuing an update |
12 | +# Note that we cannot have INSERT only tables if we are using Storm, as it |
13 | +# sometimes creates new entries by first doing an insert (to get the id) and |
14 | +# then issuing an update. |
15 | [DEFAULT] |
16 | public_schemas= |
17 | |
18 | diff --git a/doc/reference/python.rst b/doc/reference/python.rst |
19 | index e3a76ab..5d877b3 100644 |
20 | --- a/doc/reference/python.rst |
21 | +++ b/doc/reference/python.rst |
22 | @@ -298,7 +298,7 @@ queries or fragments, e.g.: |
23 | FROM TeamParticipation |
24 | INNER JOIN Person ON TeamParticipation.team = Person.id |
25 | WHERE TeamParticipation.person = %s |
26 | - """ % sqlvalues(personID) |
27 | + """ % sqlvalues(person_id) |
28 | |
29 | This is also easy to cut-and-paste into ``psql`` for interactive testing, |
30 | unlike if you use several lines of single quoted strings. |
31 | diff --git a/lib/lp/answers/browser/questiontarget.py b/lib/lp/answers/browser/questiontarget.py |
32 | index ed993fb..e9556fc 100644 |
33 | --- a/lib/lp/answers/browser/questiontarget.py |
34 | +++ b/lib/lp/answers/browser/questiontarget.py |
35 | @@ -510,7 +510,7 @@ class SearchQuestionsView(UserSupportLanguagesMixin, LaunchpadFormView): |
36 | to question or mdash if there is no related source package. |
37 | """ |
38 | # XXX sinzui 2007-11-27 bug=164435: |
39 | - # SQLObject can refetch the question, so we are comparing ids. |
40 | + # Storm can refetch the question, so we are comparing ids. |
41 | assert self.context.id == question.distribution.id, ( |
42 | "The question.distribution (%s) must be equal to the context (%s)" |
43 | % (question.distribution, self.context) |
44 | diff --git a/lib/lp/answers/interfaces/question.py b/lib/lp/answers/interfaces/question.py |
45 | index dea2c45..00f27ff 100644 |
46 | --- a/lib/lp/answers/interfaces/question.py |
47 | +++ b/lib/lp/answers/interfaces/question.py |
48 | @@ -482,8 +482,8 @@ class IQuestion(IHasOwner): |
49 | |
50 | Return the created IQuestionMessage. |
51 | |
52 | - (Note this method is named expireQuestion and not expire because of |
53 | - conflicts with SQLObject.) |
54 | + (Note this method is named expireQuestion and not expire because it |
55 | + used to conflict with SQLObject.) |
56 | |
57 | This method should fire an IObjectCreatedEvent for the created |
58 | IQuestionMessage and an IObjectModifiedEvent for the question. |
59 | diff --git a/lib/lp/app/validators/README.txt b/lib/lp/app/validators/README.txt |
60 | index 2efe490..bae777f 100644 |
61 | --- a/lib/lp/app/validators/README.txt |
62 | +++ b/lib/lp/app/validators/README.txt |
63 | @@ -1,4 +1,2 @@ |
64 | -Validators in this directory are either simple functions that correspond |
65 | -to database constraints such as valid_name(name), or they can be |
66 | -subclasses of sqlobject.include.validators.Validator such as |
67 | -PersonValidatorBase. |
68 | +Validators in this directory are simple functions that correspond to |
69 | +database constraints such as valid_name(name). |
70 | diff --git a/lib/lp/bugs/browser/tests/buglinktarget-views.rst b/lib/lp/bugs/browser/tests/buglinktarget-views.rst |
71 | index d3a139a..caebb44 100644 |
72 | --- a/lib/lp/bugs/browser/tests/buglinktarget-views.rst |
73 | +++ b/lib/lp/bugs/browser/tests/buglinktarget-views.rst |
74 | @@ -94,7 +94,7 @@ IBugLinkTarget. |
75 | >>> print(view.cancel_url) |
76 | http://bugs.launchpad.test/bugs/cve/2005-2730 |
77 | |
78 | -After removing the bugs, it sends a SQLObjectModified event. |
79 | +After removing the bugs, it sends an ObjectModifiedEvent. |
80 | |
81 | >>> request = LaunchpadTestRequest( |
82 | ... method="POST", |
83 | diff --git a/lib/lp/bugs/model/bugtask.py b/lib/lp/bugs/model/bugtask.py |
84 | index d66c62a..2d9845e 100644 |
85 | --- a/lib/lp/bugs/model/bugtask.py |
86 | +++ b/lib/lp/bugs/model/bugtask.py |
87 | @@ -932,7 +932,7 @@ class BugTask(StormBase): |
88 | for synched_attr in self._CONJOINED_ATTRIBUTES: |
89 | replica_attr_value = getattr(conjoined_replica, synched_attr) |
90 | # Bypass our checks that prevent setting attributes on |
91 | - # conjoined primaries by calling the underlying sqlobject |
92 | + # conjoined primaries by calling the underlying Storm |
93 | # setter methods directly. |
94 | setattr(self, synched_attr, PassthroughValue(replica_attr_value)) |
95 | |
96 | diff --git a/lib/lp/bugs/model/bugtasksearch.py b/lib/lp/bugs/model/bugtasksearch.py |
97 | index 08fe8dc..d8170b6 100644 |
98 | --- a/lib/lp/bugs/model/bugtasksearch.py |
99 | +++ b/lib/lp/bugs/model/bugtasksearch.py |
100 | @@ -334,8 +334,8 @@ def _build_query(params): |
101 | # * a searchbuilder.any object, representing a set of acceptable |
102 | # filter values |
103 | # * a searchbuilder.NULL object |
104 | - # * an sqlobject |
105 | - # * a dbschema item |
106 | + # * a Storm instance |
107 | + # * a `DBItem` |
108 | # * None (meaning no filter criteria specified for that arg_name) |
109 | # |
110 | # XXX: kiko 2006-03-16: |
111 | diff --git a/lib/lp/buildmaster/interfaces/processor.py b/lib/lp/buildmaster/interfaces/processor.py |
112 | index 67f0a58..b9bb853 100644 |
113 | --- a/lib/lp/buildmaster/interfaces/processor.py |
114 | +++ b/lib/lp/buildmaster/interfaces/processor.py |
115 | @@ -40,7 +40,7 @@ class ProcessorNotFound(NameLookupFailed): |
116 | # 'devel' as their version. |
117 | @exported_as_webservice_entry(publish_web_link=False, as_of="beta") |
118 | class IProcessor(Interface): |
119 | - """The SQLObject Processor Interface""" |
120 | + """The Storm Processor Interface""" |
121 | |
122 | id = Attribute("The Processor ID") |
123 | name = exported( |
124 | diff --git a/lib/lp/code/doc/codeimport-machine.rst b/lib/lp/code/doc/codeimport-machine.rst |
125 | index 1b7b523..22fedca 100644 |
126 | --- a/lib/lp/code/doc/codeimport-machine.rst |
127 | +++ b/lib/lp/code/doc/codeimport-machine.rst |
128 | @@ -213,7 +213,7 @@ setQuiescing methods must fail. |
129 | |
130 | Since our scripts and daemons run at "READ COMMITTED" isolation level, |
131 | there are races that we cannot easily detect within the limitation of |
132 | -SQLObject, when the watchdog process and the controller daemon |
133 | +Storm, when the watchdog process and the controller daemon |
134 | concurrently call setOffline. Those undetected races will lead to the |
135 | creation of redundant OFFLINE events with different reason values, where |
136 | one of the reasons will be WATCHDOG. Those races should not have any |
137 | diff --git a/lib/lp/code/interfaces/branch.py b/lib/lp/code/interfaces/branch.py |
138 | index 0bf790f..16db888 100644 |
139 | --- a/lib/lp/code/interfaces/branch.py |
140 | +++ b/lib/lp/code/interfaces/branch.py |
141 | @@ -1045,7 +1045,7 @@ class IBranchView( |
142 | |
143 | :param notification_levels: An iterable of |
144 | `BranchSubscriptionNotificationLevel`s |
145 | - :return: An SQLObject query result. |
146 | + :return: A `ResultSet` of `BranchSubscription`s. |
147 | """ |
148 | |
149 | def getBranchRevision(sequence=None, revision=None, revision_id=None): |
150 | diff --git a/lib/lp/code/model/tests/test_codereviewkarma.py b/lib/lp/code/model/tests/test_codereviewkarma.py |
151 | index fc4cdce..4278a3c 100644 |
152 | --- a/lib/lp/code/model/tests/test_codereviewkarma.py |
153 | +++ b/lib/lp/code/model/tests/test_codereviewkarma.py |
154 | @@ -56,7 +56,7 @@ class TestCodeReviewKarma(TestCaseWithFactory): |
155 | # target as there would be other karma events for the branch |
156 | # creations. |
157 | self.karma_events = [] |
158 | - # The normal SQLObject events use the logged in person. |
159 | + # The normal Storm events use the logged in person. |
160 | login_person(registrant) |
161 | source_branch.addLandingTarget(registrant, target_branch) |
162 | self.assertOneKarmaEvent(registrant, "branchmergeproposed") |
163 | diff --git a/lib/lp/code/model/tests/test_revisionauthor.py b/lib/lp/code/model/tests/test_revisionauthor.py |
164 | index a256b90..37401f6 100644 |
165 | --- a/lib/lp/code/model/tests/test_revisionauthor.py |
166 | +++ b/lib/lp/code/model/tests/test_revisionauthor.py |
167 | @@ -100,8 +100,8 @@ class TestRevisionAuthorMatching(MakeHarryTestCase): |
168 | # Check a VALIDATED email address is used to link. |
169 | harry = self._makeHarry(EmailAddressStatus.VALIDATED) |
170 | author = self._createRevisionAuthor() |
171 | - # Reget harry as the SQLObject cache has been flushed on |
172 | - # transaction boundary. |
173 | + # Reget harry as the Storm cache has been flushed on transaction |
174 | + # boundary. |
175 | harry = getUtility(IPersonSet).getByName("harry") |
176 | self.assertEqual("harry@canonical.com", author.email) |
177 | self.assertEqual(harry, author.person) |
178 | @@ -110,8 +110,8 @@ class TestRevisionAuthorMatching(MakeHarryTestCase): |
179 | # Check a OLD email address is used to link. |
180 | harry = self._makeHarry(EmailAddressStatus.OLD) |
181 | author = self._createRevisionAuthor() |
182 | - # Reget harry as the SQLObject cache has been flushed on |
183 | - # transaction boundary. |
184 | + # Reget harry as the Storm cache has been flushed on transaction |
185 | + # boundary. |
186 | harry = getUtility(IPersonSet).getByName("harry") |
187 | self.assertEqual("harry@canonical.com", author.email) |
188 | self.assertEqual(harry, author.person) |
189 | @@ -120,8 +120,8 @@ class TestRevisionAuthorMatching(MakeHarryTestCase): |
190 | # Check a PREFERRED email address is used to link. |
191 | harry = self._makeHarry(EmailAddressStatus.PREFERRED) |
192 | author = self._createRevisionAuthor() |
193 | - # Reget harry as the SQLObject cache has been flushed on |
194 | - # transaction boundary. |
195 | + # Reget harry as the Storm cache has been flushed on transaction |
196 | + # boundary. |
197 | harry = getUtility(IPersonSet).getByName("harry") |
198 | self.assertEqual("harry@canonical.com", author.email) |
199 | self.assertEqual(harry, author.person) |
200 | diff --git a/lib/lp/registry/browser/person.py b/lib/lp/registry/browser/person.py |
201 | index 4b4e920..c359df7 100644 |
202 | --- a/lib/lp/registry/browser/person.py |
203 | +++ b/lib/lp/registry/browser/person.py |
204 | @@ -248,8 +248,8 @@ class RestrictedMembershipsPersonView(LaunchpadView): |
205 | Private teams are filtered out if the user is not a member of them. |
206 | """ |
207 | # This method returns a list as opposed to the database object's |
208 | - # getLatestApprovedMembershipsForPerson which returns a sqlobject |
209 | - # result set. |
210 | + # getLatestApprovedMembershipsForPerson which returns a Storm |
211 | + # ResultSet. |
212 | membership_list = self.context.getLatestApprovedMembershipsForPerson() |
213 | return [ |
214 | membership |
215 | @@ -265,8 +265,7 @@ class RestrictedMembershipsPersonView(LaunchpadView): |
216 | Private teams are filtered out if the user is not a member of them. |
217 | """ |
218 | # This method returns a list as opposed to the database object's |
219 | - # teams_with_icons which returns a sqlobject |
220 | - # result set. |
221 | + # teams_with_icons which returns a Storm ResultSet. |
222 | return [ |
223 | team |
224 | for team in self.context.teams_with_icons |
225 | diff --git a/lib/lp/registry/model/distributionsourcepackage.py b/lib/lp/registry/model/distributionsourcepackage.py |
226 | index 67312ee..bc80a4f 100644 |
227 | --- a/lib/lp/registry/model/distributionsourcepackage.py |
228 | +++ b/lib/lp/registry/model/distributionsourcepackage.py |
229 | @@ -91,8 +91,8 @@ class DistributionSourcePackage( |
230 | HasDriversMixin, |
231 | WebhookTargetMixin, |
232 | ): |
233 | - """This is a "Magic Distribution Source Package". It is not an |
234 | - SQLObject, but instead it represents a source package with a particular |
235 | + """This is a "Magic Distribution Source Package". It is not a |
236 | + Storm model, but instead it represents a source package with a particular |
237 | name in a particular distribution. You can then ask it all sorts of |
238 | things about the releases that are published under its name, the latest |
239 | or current release, etc. |
240 | diff --git a/lib/lp/registry/model/mailinglist.py b/lib/lp/registry/model/mailinglist.py |
241 | index fd26b09..f3fcaf5 100644 |
242 | --- a/lib/lp/registry/model/mailinglist.py |
243 | +++ b/lib/lp/registry/model/mailinglist.py |
244 | @@ -336,8 +336,7 @@ class MailingList(StormBase): |
245 | ), "Email already associated with another team." |
246 | |
247 | def _setAndNotifyDateActivated(self): |
248 | - """Set the date_activated field and fire a |
249 | - SQLObjectModified event. |
250 | + """Set the date_activated field and fire an ObjectModifiedEvent. |
251 | |
252 | The date_activated field is only set once - repeated calls |
253 | will not change the field's value. |
254 | diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py |
255 | index 778f1dd..788333b 100644 |
256 | --- a/lib/lp/registry/model/person.py |
257 | +++ b/lib/lp/registry/model/person.py |
258 | @@ -520,10 +520,9 @@ class Person( |
259 | # mailing list. This is because renaming a mailing list is not |
260 | # trivial in Mailman 2.1 (see Mailman FAQ item 4.70). We prohibit |
261 | # such renames in the team edit details view, but just to be safe, we |
262 | - # also assert that such an attempt is not being made here. To do |
263 | - # this, we must override the SQLObject method for setting the 'name' |
264 | - # database column. Watch out for when SQLObject is creating this row, |
265 | - # because in that case self.name isn't yet available. |
266 | + # also assert that such an attempt is not being made here. Watch |
267 | + # out for when Storm is creating this row, because in that case |
268 | + # self.name isn't yet available. |
269 | if self.name is None: |
270 | mailing_list = None |
271 | else: |
272 | @@ -535,7 +534,7 @@ class Person( |
273 | or mailing_list.status == MailingListStatus.PURGED |
274 | ) |
275 | assert can_rename, "Cannot rename teams with mailing lists" |
276 | - # Everything's okay, so let SQLObject do the normal thing. |
277 | + # Everything's okay, so let Storm do the normal thing. |
278 | return value |
279 | |
280 | name = Unicode(name="name", allow_none=False, validator=_validate_name) |
281 | diff --git a/lib/lp/registry/model/pillar.py b/lib/lp/registry/model/pillar.py |
282 | index 496aceb..14d4fc8 100644 |
283 | --- a/lib/lp/registry/model/pillar.py |
284 | +++ b/lib/lp/registry/model/pillar.py |
285 | @@ -100,7 +100,7 @@ class PillarNameSet: |
286 | # We could attempt to do this in a single database query, but I |
287 | # expect that doing two queries will be faster that OUTER JOINing |
288 | # the Project, Product and Distribution tables (and this approach |
289 | - # works better with SQLObject too. |
290 | + # is easier with Storm too). |
291 | |
292 | # Retrieve information out of the PillarName table. |
293 | query = """ |
294 | diff --git a/lib/lp/registry/tests/test_teammembership.py b/lib/lp/registry/tests/test_teammembership.py |
295 | index ec7e3c9..5a5fb5b 100644 |
296 | --- a/lib/lp/registry/tests/test_teammembership.py |
297 | +++ b/lib/lp/registry/tests/test_teammembership.py |
298 | @@ -821,7 +821,7 @@ class TestTeamMembership(TestCaseWithFactory): |
299 | TeamMembershipStatus.DEACTIVATED, |
300 | getUtility(IPersonSet).getByName("name16"), |
301 | ) |
302 | - # Bypass SQLObject to make sure the update was really flushed to the |
303 | + # Bypass Storm to make sure the update was really flushed to the |
304 | # database. |
305 | cur = cursor() |
306 | cur.execute("SELECT status FROM teammembership WHERE id = %d" % tm.id) |
307 | diff --git a/lib/lp/services/database/doc/storm-security-proxies.rst b/lib/lp/services/database/doc/storm-security-proxies.rst |
308 | index e95fb66..600dcc2 100644 |
309 | --- a/lib/lp/services/database/doc/storm-security-proxies.rst |
310 | +++ b/lib/lp/services/database/doc/storm-security-proxies.rst |
311 | @@ -1,5 +1,5 @@ |
312 | -Demonstrate that SQLObject works with security proxies |
313 | ------------------------------------------------------- |
314 | +Demonstrate that Storm works with security proxies |
315 | +-------------------------------------------------- |
316 | |
317 | Do some imports. |
318 | |
319 | diff --git a/lib/lp/services/database/multitablecopy.py b/lib/lp/services/database/multitablecopy.py |
320 | index de07713..b34e1dd 100644 |
321 | --- a/lib/lp/services/database/multitablecopy.py |
322 | +++ b/lib/lp/services/database/multitablecopy.py |
323 | @@ -353,9 +353,9 @@ class MultiTableCopy: |
324 | extracted. The WHERE clause may refer to rows from table being |
325 | extracted as "source." |
326 | :param id_sequence: SQL sequence that should assign new identifiers |
327 | - for the extracted rows. Defaults to `source_table` with "_seq_id" |
328 | - appended, which by SQLObject/Launchpad convention is the sequence |
329 | - that provides `source_table`'s primary key values. Used verbatim, |
330 | + for the extracted rows. Defaults to `source_table` with "_id_seq" |
331 | + appended, which by Launchpad convention is the sequence that |
332 | + provides `source_table`'s primary key values. Used verbatim, |
333 | without quoting. |
334 | :param inert_where: Boolean SQL expression characterizing rows that |
335 | are extracted, but should not poured back into `source_table` |
336 | diff --git a/lib/lp/services/database/sqlbase.py b/lib/lp/services/database/sqlbase.py |
337 | index 9cb0d1d..3a2f903 100644 |
338 | --- a/lib/lp/services/database/sqlbase.py |
339 | +++ b/lib/lp/services/database/sqlbase.py |
340 | @@ -83,9 +83,6 @@ class StupidCache: |
341 | This class is basically equivalent to Storm's standard Cache class |
342 | with a very large size but without the overhead of maintaining the |
343 | LRU list. |
344 | - |
345 | - This provides caching behaviour equivalent to what we were using |
346 | - under SQLObject. |
347 | """ |
348 | |
349 | def __init__(self, size): |
350 | @@ -485,25 +482,28 @@ def convert_storm_clause_to_string(storm_clause): |
351 | def flush_database_updates(): |
352 | """Flushes all pending database updates. |
353 | |
354 | - When SQLObject's _lazyUpdate flag is set, then it's possible to have |
355 | - changes written to objects that aren't flushed to the database, leading to |
356 | - inconsistencies when doing e.g.:: |
357 | + Storm normally flushes changes to objects before it needs to issue the |
358 | + next query, but there are situations where it doesn't realize that it |
359 | + needs to do so. One common case is when creating an object and |
360 | + immediately fetching its ID, which is typically assigned by the database |
361 | + based on a sequence when the row is inserted:: |
362 | |
363 | - # Assuming the Beer table already has a 'Victoria Bitter' row... |
364 | - assert Beer.select("name LIKE 'Vic%'").count() == 1 # This will pass |
365 | - beer = Beer.byName('Victoria Bitter') |
366 | - beer.name = 'VB' |
367 | - assert Beer.select("name LIKE 'Vic%'").count() == 0 # This will fail |
368 | + store = IStore(Beer) |
369 | + beer = Beer(name="Victoria Bitter") |
370 | + store.add(beer) |
371 | + assert beer.id is not None # This will fail |
372 | |
373 | To avoid this problem, use this function:: |
374 | |
375 | - # Assuming the Beer table already has a 'Victoria Bitter' row... |
376 | - assert Beer.select("name LIKE 'Vic%'").count() == 1 # This will pass |
377 | - beer = Beer.byName('Victoria Bitter') |
378 | - beer.name = 'VB' |
379 | + store = IStore(Beer) |
380 | + beer = Beer(name="Victoria Bitter") |
381 | + store.add(beer) |
382 | flush_database_updates() |
383 | - assert Beer.select("name LIKE 'Vic%'").count() == 0 # This will pass |
384 | + assert beer.id is not None # This will pass |
385 | |
386 | + (You can also flush individual stores using `store.flush()`, which is |
387 | + normally sufficient, but sometimes this function is a convenient |
388 | + shorthand if you don't already have a store object handy.) |
389 | """ |
390 | zstorm = getUtility(IZStorm) |
391 | for name, store in zstorm.iterstores(): |
392 | @@ -513,14 +513,13 @@ def flush_database_updates(): |
393 | def flush_database_caches(): |
394 | """Flush all database caches. |
395 | |
396 | - SQLObject caches field values from the database in SQLObject |
397 | - instances. If SQL statements are issued that change the state of |
398 | - the database behind SQLObject's back, these cached values will be |
399 | - invalid. |
400 | + Storm caches field values from the database in Storm instances. If SQL |
401 | + statements are issued that change the state of the database behind |
402 | + Storm's back, these cached values will be invalid. |
403 | |
404 | - This function iterates through all the objects in the SQLObject |
405 | - connection's cache, and synchronises them with the database. This |
406 | - ensures that they all reflect the values in the database. |
407 | + This function iterates through all the objects in the Storm connection's |
408 | + cache, and synchronises them with the database. This ensures that they |
409 | + all reflect the values in the database. |
410 | """ |
411 | zstorm = getUtility(IZStorm) |
412 | for name, store in zstorm.iterstores(): |
413 | diff --git a/lib/lp/services/messages/model/message.py b/lib/lp/services/messages/model/message.py |
414 | index ade6a5d..9f84932 100644 |
415 | --- a/lib/lp/services/messages/model/message.py |
416 | +++ b/lib/lp/services/messages/model/message.py |
417 | @@ -720,8 +720,7 @@ class UserToUserEmail(StormBase): |
418 | # On the other hand, we really don't need a UserToUserEmailSet for any |
419 | # other purpose. There isn't any other relationship that can be |
420 | # inferred, so in this case I think it makes fine sense for the |
421 | - # constructor to add self to the store. Also, this closely mimics |
422 | - # what the SQLObject compatibility layer does. |
423 | + # constructor to add self to the store. |
424 | Store.of(sender).add(self) |
425 | |
426 | |
427 | diff --git a/lib/lp/services/statistics/tests/test_update_stats.py b/lib/lp/services/statistics/tests/test_update_stats.py |
428 | index 577ff58..2b25e58 100644 |
429 | --- a/lib/lp/services/statistics/tests/test_update_stats.py |
430 | +++ b/lib/lp/services/statistics/tests/test_update_stats.py |
431 | @@ -281,7 +281,7 @@ class UpdateTranslationStatsTest(unittest.TestCase): |
432 | |
433 | flush_database_caches() |
434 | |
435 | - # The transaction changed, we need to refetch SQLObjects. |
436 | + # The transaction changed, we need to refetch Storm instances. |
437 | ubuntu = self.distribution["ubuntu"] |
438 | hoary = self.distroseriesset.queryByName(ubuntu, "hoary") |
439 | spanish = self.languageset["es"] |
440 | diff --git a/lib/lp/services/tarfile_helpers.py b/lib/lp/services/tarfile_helpers.py |
441 | index ef10c54..09dc721 100644 |
442 | --- a/lib/lp/services/tarfile_helpers.py |
443 | +++ b/lib/lp/services/tarfile_helpers.py |
444 | @@ -13,16 +13,6 @@ import tarfile |
445 | import tempfile |
446 | import time |
447 | |
448 | -# A note about tarballs, BytesIO and unicode. SQLObject returns unicode |
449 | -# values for columns which are declared as StringCol. We have to be careful |
450 | -# not to pass unicode instances to the tarfile module, because when the |
451 | -# tarfile's filehandle is a BytesIO object, the BytesIO object gets upset |
452 | -# later when we ask it for its value and it tries to join together its |
453 | -# buffers. This is why the tarball code is sprinkled with ".encode('ascii')". |
454 | -# If we get separate StringCol and UnicodeCol column types, we won't need this |
455 | -# any longer. |
456 | -# -- Dafydd Harries, 2005-04-07. |
457 | - |
458 | |
459 | class LaunchpadWriteTarFile: |
460 | """Convenience wrapper around the tarfile module. |
461 | diff --git a/lib/lp/services/worlddata/interfaces/language.py b/lib/lp/services/worlddata/interfaces/language.py |
462 | index 7f77f9b..63a3ce5 100644 |
463 | --- a/lib/lp/services/worlddata/interfaces/language.py |
464 | +++ b/lib/lp/services/worlddata/interfaces/language.py |
465 | @@ -120,16 +120,10 @@ class ILanguage(Interface): |
466 | ) |
467 | |
468 | def addCountry(country): |
469 | - """Add a country to a list of countries this language is spoken in. |
470 | - |
471 | - Provided by SQLObject. |
472 | - """ |
473 | + """Add a country to a list of countries this language is spoken in.""" |
474 | |
475 | def removeCountry(country): |
476 | - """Remove country from list of countries this language is spoken in. |
477 | - |
478 | - Provided by SQLObject. |
479 | - """ |
480 | + """Remove country from list of countries this language is spoken in.""" |
481 | |
482 | visible = exported( |
483 | Bool( |
484 | diff --git a/lib/lp/soyuz/model/distributionsourcepackagerelease.py b/lib/lp/soyuz/model/distributionsourcepackagerelease.py |
485 | index d6b3ffa..0d0de46 100644 |
486 | --- a/lib/lp/soyuz/model/distributionsourcepackagerelease.py |
487 | +++ b/lib/lp/soyuz/model/distributionsourcepackagerelease.py |
488 | @@ -33,8 +33,8 @@ from lp.soyuz.model.publishing import ( |
489 | @implementer(IDistributionSourcePackageRelease) |
490 | @delegate_to(ISourcePackageRelease, context="sourcepackagerelease") |
491 | class DistributionSourcePackageRelease: |
492 | - """This is a "Magic Distribution Source Package Release". It is not an |
493 | - SQLObject, but it represents the concept of a specific source package |
494 | + """This is a "Magic Distribution Source Package Release". It is not a |
495 | + Storm model, but it represents the concept of a specific source package |
496 | release in the distribution. You can then query it for useful |
497 | information. |
498 | """ |
499 | diff --git a/lib/lp/soyuz/scripts/gina/README b/lib/lp/soyuz/scripts/gina/README |
500 | index 1208e80..7f84725 100644 |
501 | --- a/lib/lp/soyuz/scripts/gina/README |
502 | +++ b/lib/lp/soyuz/scripts/gina/README |
503 | @@ -28,7 +28,7 @@ Using the Gina output: |
504 | -> Tons of packages (13k binaries and 7k sources)* |
505 | -> Person-related information (name, multiple mails, gpgkey, etc) |
506 | |
507 | - * the current implementation of Soyuz/SQLObject is quite slow to |
508 | + * the current implementation of Soyuz/Storm is quite slow to |
509 | fetch all information from DB, so don't forget to use "renice" |
510 | to reduce the postgres and the zope priority if your machine is |
511 | `normal' (non-dual-Xeon), otherwise it will CRASH (I'm serious). |
512 | diff --git a/lib/lp/testing/__init__.py b/lib/lp/testing/__init__.py |
513 | index 32256e1..9f9ccdc 100644 |
514 | --- a/lib/lp/testing/__init__.py |
515 | +++ b/lib/lp/testing/__init__.py |
516 | @@ -579,7 +579,7 @@ class TestCase(testtools.TestCase, fixtures.TestWithFixtures): |
517 | to another date value. Trickery is required because SQLBuilder truth |
518 | semantics cause UTC_NOW to appear equal to all dates. |
519 | |
520 | - :param sql_object: a security-proxied SQLObject instance. |
521 | + :param sql_object: a security-proxied Storm instance. |
522 | :param attribute_name: the name of a database column in the table |
523 | associated to this object. |
524 | :param date: `datetime.datetime` object or `UTC_NOW`. |
525 | diff --git a/lib/lp/translations/doc/rosetta-karma.rst b/lib/lp/translations/doc/rosetta-karma.rst |
526 | index 9ae8415..48e08d9 100644 |
527 | --- a/lib/lp/translations/doc/rosetta-karma.rst |
528 | +++ b/lib/lp/translations/doc/rosetta-karma.rst |
529 | @@ -3,8 +3,8 @@ Rosetta gives Karma to the users that do some kind of actions. |
530 | This test documents when and why Rosetta does it. |
531 | |
532 | Note, that once we commit the transaction, we need to fetch again any |
533 | -SQLObject we need to use to be sure we have the right information. Seems |
534 | -like SQLObjects are not persistent between transactions. |
535 | +Storm instance we need to use to be sure we have the right information. Seems |
536 | +like Storm instances are not persistent between transactions. |
537 | |
538 | >>> import transaction |
539 | >>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities |
540 | diff --git a/lib/lp/translations/doc/translationmessage-destroy.rst b/lib/lp/translations/doc/translationmessage-destroy.rst |
541 | index 6c79ec3..05cf0ef 100644 |
542 | --- a/lib/lp/translations/doc/translationmessage-destroy.rst |
543 | +++ b/lib/lp/translations/doc/translationmessage-destroy.rst |
544 | @@ -4,8 +4,7 @@ destroySelf |
545 | (Note: this test runs as rosettaadmin to obtain the necessary |
546 | privileges) |
547 | |
548 | -With this method, we allow to remove a submission, it comes from SQLObject, |
549 | -but we test it here to be sure it appears in our public interface. |
550 | +With this method, we allow removing a submission. |
551 | |
552 | We will need extra permissions to use this method. |
553 | |
554 | diff --git a/lib/lp/translations/model/distroserieslanguage.py b/lib/lp/translations/model/distroserieslanguage.py |
555 | index d147f4b..c2385f4 100644 |
556 | --- a/lib/lp/translations/model/distroserieslanguage.py |
557 | +++ b/lib/lp/translations/model/distroserieslanguage.py |
558 | @@ -36,7 +36,7 @@ from lp.translations.utilities.rosettastats import RosettaStats |
559 | class DistroSeriesLanguage(StormBase, RosettaStats): |
560 | """See `IDistroSeriesLanguage`. |
561 | |
562 | - A SQLObject based implementation of IDistroSeriesLanguage. |
563 | + A Storm implementation of IDistroSeriesLanguage. |
564 | """ |
565 | |
566 | __storm_table__ = "DistroSeriesLanguage" |
567 | diff --git a/lib/lp/translations/model/pofile.py b/lib/lp/translations/model/pofile.py |
568 | index 96196ca..9548b3e 100644 |
569 | --- a/lib/lp/translations/model/pofile.py |
570 | +++ b/lib/lp/translations/model/pofile.py |
571 | @@ -1,7 +1,7 @@ |
572 | # Copyright 2009-2020 Canonical Ltd. This software is licensed under the |
573 | # GNU Affero General Public License version 3 (see the file LICENSE). |
574 | |
575 | -"""`SQLObject` implementation of `IPOFile` interface.""" |
576 | +"""Storm implementation of `IPOFile` interface.""" |
577 | |
578 | __all__ = [ |
579 | "PlaceholderPOFile", |
580 | diff --git a/lib/lp/translations/model/potemplate.py b/lib/lp/translations/model/potemplate.py |
581 | index 87e79d5..8487230 100644 |
582 | --- a/lib/lp/translations/model/potemplate.py |
583 | +++ b/lib/lp/translations/model/potemplate.py |
584 | @@ -1,7 +1,7 @@ |
585 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
586 | # GNU Affero General Public License version 3 (see the file LICENSE). |
587 | |
588 | -"""`SQLObject` implementation of `IPOTemplate` interface.""" |
589 | +"""Storm implementation of `IPOTemplate` interface.""" |
590 | |
591 | __all__ = [ |
592 | "get_pofiles_for", |
593 | diff --git a/utilities/snakefood/Makefile b/utilities/snakefood/Makefile |
594 | index 06d92cc..7984534 100644 |
595 | --- a/utilities/snakefood/Makefile |
596 | +++ b/utilities/snakefood/Makefile |
597 | @@ -4,11 +4,11 @@ default: lp-clustered.svg |
598 | |
599 | # Generate import dependency graph |
600 | lp.sfood: |
601 | - sfood -i -u -I $(LIB_DIR)/sqlobject -I $(LIB_DIR)/schoolbell \ |
602 | + sfood -i -u -I $(LIB_DIR)/schoolbell \ |
603 | -I $(LIB_DIR)/contrib \ |
604 | -I $(LIB_DIR)/canonical/not-used $(LIB_DIR)/canonical \ |
605 | $(LIB_DIR)/lp 2>/dev/null | grep -v contrib/ \ |
606 | - | grep -v sqlobject | egrep -v 'BeautifulSoup|bs4' | grep -v psycopg \ |
607 | + | egrep -v 'BeautifulSoup|bs4' | grep -v psycopg \ |
608 | | grep -v schoolbell | grep -v '/tests/' | grep -v '/ftests/' \ |
609 | | grep -v 'lp/services/config' > lp.sfood.tmp |
610 | mv lp.sfood.tmp lp.sfood |