from adhocracy import model
from adhocracy.lib import cache
from adhocracy.lib.helpers import proposal_helper as proposal
from adhocracy.lib.helpers import text_helper as text
from adhocracy.lib.helpers import url as _url
from paste.deploy.converters import asbool
from pylons import config


@cache.memoize('comment_url')
def url(comment, member=None, format=None, comment_page=False, **kwargs):
    if member is None and format is None and not comment_page:
        if isinstance(comment.topic, model.Page):
            if comment.topic.function == model.Page.DESCRIPTION:
                return (proposal.url(comment.topic.proposal, **kwargs) + '#c' +
                        str(comment.id))
            return (text.url(comment.topic.variant_head(comment.variant),
                             **kwargs) +
                    '#c' + str(comment.id))
        elif isinstance(comment.topic, model.Proposal):
            return (proposal.url(comment.topic, **kwargs) +
                    '#c' + str(comment.id))
    return _url.build(comment.topic.instance, 'comment',
                      comment.id, member=member, format=format, **kwargs)


def wording(config=config):
    return asbool(config.get('adhocracy.comment_wording', False))

@@ -632,27 +632,8 @@
 sal,
- **kwargs) + '#c' +
 %0A   
@@ -653,30 +653,65 @@
         
-str(comment.id
+             anchor=u'c%25i' %25 comment.id, **kwargs
 ))%0A     
@@ -812,61 +812,44 @@
     
-**kwargs) +%0A                    '#c' + str(comment.id
+anchor=u'c%25i' %25 comment.id, **kwargs
 ))%0A 
@@ -955,61 +955,77 @@
 ic, 
-**kwargs) +%0A                    '#c' + str(comment.id
+anchor=u'c%25i' %25 comment.id,%0A                                 **kwargs
 ))%0A 

use anchor parameter instead of manually appending it