isn't the controller called plugin_tagging? in this case

LOAD('plugin_tagging','tagging',args=(table_name,record_id or
0),ajax=True)

On Aug 17, 4:59 am, "david.waldrop" <david.wald...@gmail.com> wrote:
> CANCEL THAT.
>
> The function defined in the model (see code below) is being executed
> as I see the print statements on the console.
>
> def tags(table_name=None,record_id=0):
>     """
>     You can tag a record of a table by embedding this::
>        {{=tagging('mytable',45)}}
>     where 'mytable' is a table name and 45 is a record id.
>     It will display a tagging widget.
>     """
>     print "in model - tagging - calling LOAD"
>     return LOAD('tagging','tagging',args=(table_name,record_id or
> 0),ajax=True)
>
> however the function 'tagging" in the controller "tagging" is never
> getting invoked.
>
> On Aug 17, 5:29 am, "david.waldrop" <david.wald...@gmail.com> wrote:
>
> > massimo thanks for the response.  It is good to see someone else
> > either has insomnia or likes to get up way to early.  I swapped out
> > the code from the tagging plugin with the code form the wiki, but
> > still have the same problem.  In essence I cannot use the plugin as is
> > because of the separate community databases (a design decision that
> > provides clear data partitioning and performance, at the cost of all
> > these funky issues).
>
> > However, now that I removed the 3 lines of code in the top of the
> > tagging controller, the init function is getting invoked.  This is
> > pretty painful sledding - what do you use for debugging?  I would love
> > some type of debugger with breakpoints, etc.
>
> > any ideas on why the tagging view is never getting invoked and I get
> > 'loading.."
>
> > On Aug 17, 4:35 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > Please use plugin_wiki and
>
> > > {{=plugin_wiki.widget('tagging',...._}}
>
> > > instead. plugin_tagging as a separate piece will no longer be
> > > supported unless somebody adopts it.
>
> > > On Aug 16, 7:32 pm, "david.waldrop" <david.wald...@gmail.com> wrote:
>
> > > > 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

Reply via email to