Beispiel #1
0
 def GET(self, module_id):
     module = modules.get_module(module_id)
     _tags = tags.get_tags(module_id)
     _comments = comments.get_comments(module_id)
     related_module = modules.get_related(module_id)
 
     return render.layout(view.show_module(module, _tags, _comments, related_module, misc.get_pub_id()), 
         title=module.title + ' - Google Modules')
Beispiel #2
0
    def GET(self, module_id):
        module = modules.get_module(module_id)
        _tags = tags.get_tags(module_id)
        _comments = comments.get_comments(module_id)
        related_module = modules.get_related(module_id)

        return render.layout(view.show_module(module, _tags,
                                              _comments, related_module,
                                              misc.get_pub_id()),
                             title=module.title + ' - Google Modules')
Beispiel #3
0
def get_related(module_id): 
    """Get a similar module."""
    module_tags = [t.tag for t in tags.get_tags(module_id)]
    
    m = web.listget(
        db.select('tags', 
            vars  = dict(id=module_id, tags=module_tags),
            what  = 'module_id',
            where = 'module_id != $id and %s' % web.sqlors("tag = ", module_tags),
            group = 'module_id having count(module_id) > 1',
            order = 'rand()'), 0, False)
    
    return m and get_module(m.module_id)
Beispiel #4
0
def get_related(module_id):
    """Get a similar module."""
    module_tags = [t.tag for t in tags.get_tags(module_id)]

    m = web.listget(
        db.select('tags',
                  vars=dict(id=module_id, tags=module_tags),
                  what='module_id',
                  where='module_id != $id and %s' %
                  web.sqlors("tag = ", module_tags),
                  group='module_id having count(module_id) > 1',
                  order='rand()'), 0, False)

    return m and get_module(m.module_id)