Re: [Trac] Help in development of trac macro building links

2017-08-08 Thread RjOllos


On Tuesday, August 8, 2017 at 11:14:25 AM UTC-7, Peter Suter wrote:
>
> A slightly simpler version:
>
> from trac.wiki.macros import WikiMacroBase
> from trac.wiki.formatter import format_to_html
>
>
> class MyLinkMacro(WikiMacroBase):
> def expand_macro(self, formatter, name, text, args):
> the_link = 
> '[myschema://myserver:1234/this/that/page?param1=value1=value2='
>  
> + text + '=value4 ' + text + ']'
>
> return format_to_html(self.env, formatter.context, 
> the_link)
>

Seems like it would be a good idea to change the example code to use 
format_to_html, as in your example:
https://trac.edgewall.org/wiki/WikiMacros#Macrowitharguments

, unless the example is intended to be illustrative of something. 

Using format_to_html is effectively the same after two levels of 
indirection:
https://trac.edgewall.org/browser/tags/trac-1.2.2/trac/wiki/formatter.py?marks=1606#L1601
https://trac.edgewall.org/browser/tags/trac-1.2.2/trac/wiki/formatter.py?marks=1559-1562#L1541

What do you think?

- Ryan
 

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


Re: [Trac] How does the non-local GIT repository be added to the source browser

2017-08-08 Thread Mingxing Tian


在 2017年8月8日星期二 UTC+8下午12:22:45,Jun Omae写道:
>
> On Tue, Aug 8, 2017 at 11:52 AM, Mingxing Tian  > wrote: 
> > This is the log information I see: 
> > 
> > 2017-08-08 10:49:17,339 Trac[PyGIT] ERROR: GIT control files missing in 
> '/home/git/repositories/testing.git' 
> > 2017-08-08 10:49:17,339 Trac[git_fs] ERROR: GitError: GIT control files 
> not found, maybe wrong directory? 
>
> Please make sure that your web server can access the git repository. 
>
> e.g. 
>
> $ (cd / && sudo -u www-data git 
> --git-dir=/home/git/repositories/testing.git fsck) 
>
> -- 
> Jun Omae  (大前 潤) 
>

Yes, this is really a matter of competence, and I hope to get more specific 
tips, let me know that this is caused by the authority.
Thank you very much, it's working right now. 

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


[Trac] Introduce the warehouse synchronization documents need to be updated

2017-08-08 Thread Mingxing Tian
I follow the following document configuration each time you push to the Git 
repository, insert a change record to the corresponding task order.

http://trac.idouzi.com/wiki/TracRepositoryAdmin#Git

In my warehouse hooks do not see the "hooks/post-commit" file, only the 
following files.

[root@host105 hooks]# pwd
/home/git/repositories/testing.git/hooks
[root@host105 hooks]# ll
总用量 44
-rwx-- 1 git git  478 8月   2 11:47 applypatch-msg.sample
-rwx-- 1 git git  896 8月   2 11:47 commit-msg.sample
-rwx-- 1 git git  189 8月   9 10:04 post-update.sample
-rwx-- 1 git git  424 8月   2 11:47 pre-applypatch.sample
-rwx-- 1 git git 1642 8月   2 11:47 pre-commit.sample
-rwx-- 1 git git 1239 8月   2 11:47 prepare-commit-msg.sample
-rwx-- 1 git git 1348 8月   2 11:47 pre-push.sample
-rwx-- 1 git git 4951 8月   2 11:47 pre-rebase.sample
-rwx-- 1 git git  544 8月   9 10:02 pre-receive.sample
lrwxrwxrwx 1 git git   39 8月   2 11:47 update -> 
/home/git/.gitolite/hooks/common/update
-rwx-- 1 git git 3610 8月   2 11:47 update.sample
[root@host105 hooks]#


-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


Re: [Trac] Help in development of trac macro building links

2017-08-08 Thread Peter Suter

On 09.08.2017 00:25, RjOllos wrote:


On Tuesday, August 8, 2017 at 11:14:25 AM UTC-7, Peter Suter wrote:

A slightly simpler version:

return format_to_html(self.env, formatter.context, the_link)


Seems like it would be a good idea to change the example code to use 
format_to_html, as in your example:

https://trac.edgewall.org/wiki/WikiMacros#Macrowitharguments

, unless the example is intended to be illustrative of something.

Using format_to_html is effectively the same after two levels of 
indirection:

https://trac.edgewall.org/browser/tags/trac-1.2.2/trac/wiki/formatter.py?marks=1606#L1601
https://trac.edgewall.org/browser/tags/trac-1.2.2/trac/wiki/formatter.py?marks=1559-1562#L1541

What do you think?


Yes, I thought the same thing, but I also wasn't sure if it was intended 
to illustrate something more general.



Peter

--
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


Re: [Trac] Help in development of trac macro building links

2017-08-08 Thread Peter Suter

Hi,

On 08.08.2017 14:19, Riedel, Torge wrote:


Hi,

I’m developing a trac macro to make it easier for wiki editors to add 
links to an external tool.


In Wiki-Markup they can then use a macro:

[[MyLink(my_value)]]

to have a link in trac style on their wiki page to the external tool.

The format of the link is similar to this:

myschema://myserver:1234/this/that/page?param1=value1=value2=my_value=value4



Have you considered using Trac's InterWiki feature?
https://trac.edgewall.org/wiki/InterWiki

For example you could edit own InterMapTxt wiki page, adding something like:

mylinkmyschema://myserver:1234/this/that/page?param1=value1=value2=$1=$2 



and then write

mylink:value3:value4

to get a  link. If that's all you want then no plugin is needed.

My py code (I’m not a python developer, but developing C/C++. Google 
helps me with python) looks like this in the macro file (I modified 
the example from here https://trac.edgewall.org/wiki/0.12/WikiMacros):


from genshi.core import Markup

from trac.wiki.macros import WikiMacroBase

from trac.wiki import Formatter

import StringIO

class MyLinkMacro(WikiMacroBase):

def expand_macro(self, formatter, name, text, args):

the_link = 
'[myschema://myserver:1234/this/that/page?param1=value1=value2=' 
+ text + '=value4 ' + text + ']'


# Convert Wiki markup to HTML, new style

out = StringIO.StringIO()

Formatter(self.env, formatter.context).format(the_link, out)

return Markup(out.getvalue())

My problem is, that the link is rendered but does not work afterwards 
because „&“ is replaced by „“ and without any deeper knowledge of 
python and trac development I’m blocked in progress.


The code above actually seems to work (if "myschema " is replace by a 
known schema like "http").


A slightly simpler version:

from trac.wiki.macros import WikiMacroBase
from trac.wiki.formatter import format_to_html


class MyLinkMacro(WikiMacroBase):
def expand_macro(self, formatter, name, text, args):
the_link = 
'[myschema://myserver:1234/this/that/page?param1=value1=value2=' 
+ text + '=value4 ' + text + ']'


return format_to_html(self.env, formatter.context, the_link)


--
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


[Trac] Re: ticket-workflow-notifications

2017-08-08 Thread mickeyf
I appears that the plug-in has loaded with no error reported, however, I am 
getting not notifications. I would next suspect an error in my 
configuration, but I have copied the example of the ini file entry directly 
from the wiki, changing only the recipients to a valid email, and then 
later to simplify testing, I set .condition = ${true}. Perhaps my 
.recipients is not correct syntax? May I use a simple single email address 
here? Does the email or list of emails need to be defined elsewhere?

On Thursday, August 3, 2017 at 1:29:29 PM UTC-7, RjOllos wrote:
>
>
>
> On Thursday, August 3, 2017 at 7:25:15 AM UTC-7, mickeyf wrote:
>>
>> I have installed directly from github and saw no error messages. 
>> The relevant sections of my trac.ini are identical to those in the 
>> example, except that I have put in a valid email address and have altered 
>> the   condition to be "when_fixed.condition = ${true}" to simplify testing.
>> I do not get a notification when I close a test ticket as 'fixed'.
>> I have set the logging to DEBUG, but don't know what I am looking for. 
>>
>> Any further suggestions?
>>
>
> Yes, confirm that the Component is loading, as noted in:
> https://trac.edgewall.org/wiki/TracTroubleshooting#ChecktheLogs
>
> "Component loading is logged at DEBUG level when restarting tracd or the 
> web server."
>
> You should see message that looks like:
> 13:28:14 Trac[loader] DEBUG: Loading plugin "trac.ticket.web_ui" from 
> "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git"
>
> If WorkflowNotificationPlugin is loaded, you'll see messages that refer to 
> the "workflow_notification" component. If not, you might see a traceback 
> that indicates a problem with the plugin.
>
> - Ryan
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.