def activity_stream_detail(self, activity_id, activity_type): if activity_type == 'new': # New PackageTag objects are recorded as 'added tag' activities. activity_type = 'added' elif activity_type == 'changed': # Changed PackageTag objects are recorded as 'removed tag' # activities. # FIXME: This assumes that whenever a PackageTag is changed it's # because its' state has been changed from 'active' to 'deleted'. # Should do something more here to test whether that is in fact # what has changed. activity_type = 'removed' else: return None # Return an 'added tag' or 'removed tag' activity. import ckan.model as model c = {'model': model} d = { 'tag': ckan.lib.dictization.table_dictize(self.tag, c), 'package': ckan.lib.dictization.table_dictize(self.package, c) } return activity.ActivityDetail(activity_id=activity_id, object_id=self.id, object_type='tag', activity_type=activity_type, data=d)
def activity_stream_detail(self, activity_id, activity_type): import ckan.model as model # Handle 'deleted' resources. # When the user marks a resource as deleted this comes through here as # a 'changed' resource activity. We detect this and change it to a # 'deleted' activity. if activity_type == 'changed' and self.state == u'deleted': activity_type = 'deleted' res_dict = ckan.lib.dictization.table_dictize(self, context={'model': model}) return activity.ActivityDetail(activity_id, self.id, u"Resource", activity_type, {'resource': res_dict})
def activity_stream_detail(self, activity_id, activity_type): import ckan.model # Handle 'deleted' objects. # When the user marks a package as deleted this comes through here as # a 'changed' package activity. We detect this and change it to a # 'deleted' activity. if activity_type == 'changed' and self.state == u'deleted': activity_type = 'deleted' package_dict = dictization.table_dictize(self, context={'model':ckan.model}) return activity.ActivityDetail(activity_id, self.id, u"Package", activity_type, {'package': package_dict })
def activity_stream_detail(self, activity_id, activity_type): import ckan.model as model # Handle 'deleted' extras. # When the user marks an extra as deleted this comes through here as a # 'changed' extra. We detect this and change it to a 'deleted' # activity. if activity_type == 'changed' and self.state == u'deleted': activity_type = 'deleted' data_dict = ckan.lib.dictization.table_dictize(self, context={'model': model}) return activity.ActivityDetail(activity_id, self.id, u"PackageExtra", activity_type, {'package_extra': data_dict})