Skip to content

Commit

Permalink
Merge branch 'master' into 3484_revision_ui_removal2
Browse files Browse the repository at this point in the history
  • Loading branch information
David Read committed Dec 21, 2018
2 parents 372d323 + 828c9b2 commit abc8ce7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
3 changes: 1 addition & 2 deletions ckan/logic/auth/__init__.py
Expand Up @@ -9,8 +9,7 @@


def _get_object(context, data_dict, name, class_name):
# return the named item if in the context, or get it from
# model.class_name
# return the named item if in the context, or get it from model.class_name
try:
return context[name]
except KeyError:
Expand Down
15 changes: 9 additions & 6 deletions ckan/model/activity.py
Expand Up @@ -48,8 +48,8 @@

class Activity(domain_object.DomainObject):

def __init__(self, user_id, object_id, revision_id, activity_type,
data=None):
def __init__(
self, user_id, object_id, revision_id, activity_type, data=None):
self.id = _types.make_uuid()
self.timestamp = datetime.datetime.utcnow()
self.user_id = user_id
Expand All @@ -75,7 +75,8 @@ def get(cls, id):

class ActivityDetail(domain_object.DomainObject):

def __init__(self, activity_id, object_id, object_type, activity_type,
def __init__(
self, activity_id, object_id, object_type, activity_type,
data=None):
self.activity_id = activity_id
self.object_id = object_id
Expand All @@ -89,11 +90,11 @@ def __init__(self, activity_id, object_id, object_type, activity_type,
@classmethod
def by_activity_id(cls, activity_id):
return ckan.model.Session.query(cls) \
.filter_by(activity_id = activity_id).all()
.filter_by(activity_id=activity_id).all()


meta.mapper(ActivityDetail, activity_detail_table, properties = {
'activity':orm.relation ( Activity, backref=orm.backref('activity_detail'))
meta.mapper(ActivityDetail, activity_detail_table, properties={
'activity': orm.relation(Activity, backref=orm.backref('activity_detail'))
})


Expand All @@ -109,6 +110,7 @@ def _activities_limit(q, limit, offset=None):
q = q.limit(limit)
return q


def _activities_union_all(*qlist):
'''
Return union of two or more activity queries sorted by timestamp,
Expand All @@ -119,6 +121,7 @@ def _activities_union_all(*qlist):
union_all(*[q.subquery().select() for q in qlist])
).distinct(model.Activity.timestamp)


def _activities_at_offset(q, limit, offset):
'''
Return a list of all activities at an offset with a limit.
Expand Down
3 changes: 2 additions & 1 deletion ckan/model/package.py
Expand Up @@ -2,7 +2,6 @@

import datetime
import logging
logger = logging.getLogger(__name__)

from sqlalchemy.sql import and_, or_
from sqlalchemy import orm
Expand All @@ -21,6 +20,8 @@
import ckan.lib.maintain as maintain
import ckan.lib.dictization as dictization

logger = logging.getLogger(__name__)

__all__ = ['Package', 'package_table', 'package_revision_table',
'PACKAGE_NAME_MAX_LENGTH', 'PACKAGE_NAME_MIN_LENGTH',
'PACKAGE_VERSION_MAX_LENGTH', 'PackageTagRevision',
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates-bs2/package/snippets/resources.html
@@ -1,5 +1,5 @@
{#
Displays a sidebard module with navigation containing the provided resources.
Displays a sidebar module with navigation containing the provided resources.
If no resources are provided then the module will not be displayed.

pkg - The package dict that owns the resources.
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/package/snippets/resources.html
@@ -1,5 +1,5 @@
{#
Displays a sidebard module with navigation containing the provided resources.
Displays a sidebar module with navigation containing the provided resources.
If no resources are provided then the module will not be displayed.

pkg - The package dict that owns the resources.
Expand Down

0 comments on commit abc8ce7

Please sign in to comment.