+ source_name, subkey = match.groups()
+ if not subkey:
+ # This is the type declaration; use a special key
+ subkey = '__type__'
+
+ update_config[source_name][subkey] = val
+
+
+ global_config = dict(
+ limit = 10,
+ )
+
+ # Ask plugins to deal with this stuff for us!
+ updates = []
+ for source, source_config in update_config.iteritems():
+ source_config2 = source_config.copy()
+ hook_name = 'frontpage_updates_' + source_config2.pop('__type__')
+ source_config2.update(global_config)
+
+ # Hooks should return a list of FrontPageUpdate objects, making this
+ # return value a list of lists
+ updates_lol = run_hooks(hook_name, **source_config2)
+ updates += sum(updates_lol, [])
+
+ # Sort everything by descending time, then crop to the right number of
+ # items
+ updates.sort(key=lambda obj: obj.time)
+ updates.reverse()
+ c.updates = updates[:global_config['limit']]