[ckan-changes] commit/ckan: 3 new changesets
Bitbucket
commits-noreply at bitbucket.org
Wed Oct 26 21:16:08 UTC 2011
3 new commits in ckan:
https://bitbucket.org/okfn/ckan/changeset/d59942c79363/
changeset: d59942c79363
branch: feature-1371-task-status-logic-layer
user: kindly
date: 2011-10-26 23:12:43
summary: [logic] allow all commits in logic layer the ablility to be deferred
affected #: 2 files
diff -r 9fa9fe70dd42299de0f27a6c219c22239e06d58c -r d59942c7936343ff95ad6f675d5be48c7f4a321d ckan/logic/action/create.py
--- a/ckan/logic/action/create.py
+++ b/ckan/logic/action/create.py
@@ -65,7 +65,9 @@
model.Session.flush()
for item in PluginImplementations(IPackageController):
item.create(pkg)
- model.repo.commit()
+
+ if not context.get('defer_commit'):
+ model.repo.commit()
## need to let rest api create
context["package"] = pkg
@@ -132,7 +134,8 @@
rev.author = user
rev.message = _(u'REST API: Create package relationship: %s %s %s') % (pkg1, rel_type, pkg2)
rel = pkg1.add_relationship(rel_type, pkg2, comment=comment)
- model.repo.commit_and_remove()
+ if not context.get('defer_commit'):
+ model.repo.commit_and_remove()
relationship_dicts = rel.as_dict(ref_package_by=ref_package_by)
return relationship_dicts
@@ -168,7 +171,8 @@
model.Session.flush()
for item in PluginImplementations(IGroupController):
item.create(group)
- model.repo.commit()
+ if not context.get('defer_commit'):
+ model.repo.commit()
context["group"] = group
context["id"] = group.id
log.debug('Created object %s' % str(group.name))
@@ -225,7 +229,8 @@
user = user_dict_save(data, context)
- model.repo.commit()
+ if not context.get('defer_commit'):
+ model.repo.commit()
context['user'] = user
context['id'] = user.id
log.debug('Created user %s' % str(user.name))
diff -r 9fa9fe70dd42299de0f27a6c219c22239e06d58c -r d59942c7936343ff95ad6f675d5be48c7f4a321d ckan/logic/action/update.py
--- a/ckan/logic/action/update.py
+++ b/ckan/logic/action/update.py
@@ -149,7 +149,8 @@
revision.approved_timestamp = datetime.datetime.now()
session.add(revision)
- session.commit()
+ if not context.get('defer_commit'):
+ session.commit()
session.remove()
@@ -183,7 +184,8 @@
rev.message = _(u'REST API: Update object %s') % data.get("name")
resource = resource_dict_save(data, context)
- model.repo.commit()
+ if not context.get('defer_commit'):
+ model.repo.commit()
return resource_dictize(resource, context)
@@ -223,7 +225,8 @@
for item in PluginImplementations(IPackageController):
item.edit(pkg)
- model.repo.commit()
+ if not context.get('defer_commit'):
+ model.repo.commit()
return package_dictize(pkg, context)
def package_update_validate(context, data_dict):
@@ -264,7 +267,8 @@
rev.message = (_(u'REST API: Update package relationship: %s %s %s') %
(relationship.subject, relationship.type, relationship.object))
relationship.comment = comment
- model.repo.commit_and_remove()
+ if not context.get('defer_commit'):
+ model.repo.commit_and_remove()
rel_dict = relationship.as_dict(package=relationship.subject,
ref_package_by=ref_package_by)
return rel_dict
@@ -327,7 +331,8 @@
for item in PluginImplementations(IGroupController):
item.edit(group)
- model.repo.commit()
+ if not context.get('defer_commit'):
+ model.repo.commit()
if errors:
raise ValidationError(errors)
@@ -355,7 +360,8 @@
user = user_dict_save(data, context)
- model.repo.commit()
+ if not context.get('defer_commit'):
+ model.repo.commit()
return user_dictize(user, context)
def task_status_update(context, data_dict):
@@ -383,13 +389,21 @@
task_status = task_status_dict_save(data, context)
- model.Session.commit()
+ if not context.get('defer_commit'):
+ model.Session.commit()
return task_status_dictize(task_status, context)
def task_status_update_many(context, data_dict):
results = []
+ model = context['model']
+ deffered = context.get('defer_commit')
+ context['defer_commit'] = True
for data in data_dict['data']:
results.append(task_status_update(context, data))
+ if not deffered:
+ context.pop('defer_commit')
+ if not context.get('defer_commit'):
+ model.Session.commit()
return {'results': results}
## Modifications for rest api
https://bitbucket.org/okfn/ckan/changeset/bfe8825f1866/
changeset: bfe8825f1866
branch: feature-1371-task-status-logic-layer
user: kindly
date: 2011-10-26 23:14:18
summary: [merge] this branch
affected #: 1 file
diff -r d59942c7936343ff95ad6f675d5be48c7f4a321d -r bfe8825f1866cfd0c7907bfb1a19595586054b63 requires/lucid_missing.txt
--- a/requires/lucid_missing.txt
+++ b/requires/lucid_missing.txt
@@ -5,8 +5,8 @@
-e svn+https://software.sandia.gov/svn/public/pyutilib/pyutilib.component.core/trunk@1972#egg=pyutilib.component.core
# licenses==0.4,<0.6.99
-e hg+https://bitbucket.org/okfn/licenses@0eed4a13296b#egg=licenses
-# vdm>=0.9,<0.9.99
--e hg+https://bitbucket.org/okfn/vdm@54193f2df710#egg=vdm
+# vdm>=0.10,<0.10.99
+-e hg+https://bitbucket.org/okfn/vdm@vdm-0.10#egg=vdm
# markupsafe==0.9.2 required by webhelpers==1.2 required by formalchemy with SQLAlchemy 0.6
-e git+https://github.com/mitsuhiko/markupsafe.git@0.9.2#egg=markupsafe
# autoneg>=0.5
https://bitbucket.org/okfn/ckan/changeset/d47743b7cc27/
changeset: d47743b7cc27
branch: feature-1371-task-status-logic-layer
user: kindly
date: 2011-10-26 23:15:47
summary: [logic] fix spelling
affected #: 1 file
diff -r bfe8825f1866cfd0c7907bfb1a19595586054b63 -r d47743b7cc27c630b22667ca512d354e06a50286 ckan/logic/action/update.py
--- a/ckan/logic/action/update.py
+++ b/ckan/logic/action/update.py
@@ -396,11 +396,11 @@
def task_status_update_many(context, data_dict):
results = []
model = context['model']
- deffered = context.get('defer_commit')
+ deferred = context.get('defer_commit')
context['defer_commit'] = True
for data in data_dict['data']:
results.append(task_status_update(context, data))
- if not deffered:
+ if not deferred:
context.pop('defer_commit')
if not context.get('defer_commit'):
model.Session.commit()
Repository URL: https://bitbucket.org/okfn/ckan/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the ckan-changes
mailing list