I am having a problem with some customization of the tagging plugin. I downloaded and installed in a test app and all is well. In my application I need to manipulate the data tables. More specifically I need one set of tagging tables (t tables) for each of my partitioned databases. This required me to customize it a bit. It is no longer a plugin, but the models and views and controllers are directly in my app. The problem is I get "loading..." whenever I try and invoke {{=tagging('meeting',43}} in my applications index view (my way of testing/debugging this). While I am not 100% sure I think the calling sequence initiated from the previous statement is:
1) call to tagging defined in the model - tagging.py def tagging(table_name=None,record_id=0): """ You can tag a record of a table by embedding this:: {{=tag('mytable',45)}} where 'mytable' is a table name and 45 is a record id. It will display a tagging widget. """ print ' ' print 'in model - tagging' print table_name print record_id print ' ' return LOAD('tagging','index',args=(table_name,record_id),ajax=True) which in fact does print the debug statements. I am unsure if I need the LOAD statement and wonder if this is residual form the original plugin. 2) I think that is what is supposed to happen is the LOAD statement invokes the "index" function in the "tagging controller" passing in the requisite parameters. This is not happening as the debug statements never print. Also I am not sure when (or if) the 3 lines of code after the import are getting executed. I assume this is relate dto the LOAD functiion. Controller Code follows: import re mtgdb = getmtgdb() db_tag = mtgdb.tagging_tag db_link = mtgdb.tagging_link def index(): print '----------------------in tagging' print request.args(0) print request.args(1) print ' ' table_name=request.args(0) record_id=request.args(1) if not auth.user_id: return '' if table_name!='0' and not (table_name in mtgdb.tables and record_id): raise HTTP(404) form = SQLFORM.factory(Field('tag_name')) if request.vars.tag_name: for item in request.vars.tag_name.split(','): tag_name = re.compile('\s+').sub(' ',item).strip() if not tag_name[-1:]=='/': tag_name+='/' tag_exists = tag = mtgdb(db_tag.name==tag_name).select().first() if not tag_exists: tag = db_tag.insert(name=tag_name, links=1) link = mtgdb(db_link.tag==tag.id)\ (db_link.table_name==table_name)\ (db_link.record_id==record_id).select().first() if not link: db_link.insert(tag=tag.id,table_name=table_name,record_id=record_id) if tag_exists: tag.update_record(links=tag.links+1) for key in request.vars: if key[:6]=='delete': link_id=key[6:] link=db_link[link_id] del db_link[link_id] db_tag[link.tag] = dict(links=db_tag[link.tag].links-1) links = mtgdb(db_link.table_name==table_name)\ (db_link.record_id==record_id).select()\ .sort(lambda row: row.tag.name.upper()) return dict(links=links, form=form) def tag_cloud(): tags = mtgdb(db_tag.links>0).select() if tags: mc = max([tag.links for tag in tags]) return DIV(_class='tagging_tag_cloud', *[SPAN(tag.name[:-1]+' ',_style='font-size:%sem' \ % (0.8+1.0*tag.links/mc)) for tag in tags]) View Code - tagging.html: <div class="tagging"> {{=form.custom.begin}} {{for link in links:}} <span>{{=link.tag.name[:-1]}}({{=link.tag.links}})</span> <input type="checkbox" name="delete{{=link.id}}" /> {{pass}} {{if links:}}<input type="submit" value="del"/>{{pass}} <input name="tag_name" value="" size="5" /> <input type="submit" value="tag" /> {{=form.custom.end}} </div> Thanks in advance . /david