[Moin-user] reference ot external file possible?

Markus Liebelt markus.liebelt at online.de
Tue Oct 4 11:13:25 EDT 2005


Hello all together,

I hope it is not too boring for you, but I wan't to share what I have reached:

1. I implemented a macro that provides a link with the correct arguments to call an action.
2. I implemented that action (it even works).

So I can now do the following:
- I have a MoinMoin  wiki at work where I summarize some knowledge. But the wiki is only the glue code to the knowledge base.
- The knowledge base itself (documents, installations, guides, tutorials) are stored on the file system, which is managed by Subversion.
- I link the installed files by the macro.
- When I zip the wiki and store it in a MoinMoin desktop edition, I can there change the mapping by changing the configuration to the root of the knowledge base.
- It even works in windows for different browsers which normally don't serve file-URLS from http adresses.

I have appended the (beta) version I currently have. It works for me, but I will test it a little bit and make it more robust. What you have to do is the following:
1. Install LinkFile.py under macro
2. Install extfile.py under action
3. Append to your wikiconfig.py the following line (changed to meet your needs):
     file_roots = {"pb": "d:/pb/svn/"}

    That means that I have under the symbolic name "pb" the directory where it is stored locally here. By changing it to something like "http://localhost/pb/", it would be provided by a local webserver (if I had any).

So if you include the following in the source of a page:

[[LinkFile(pb,java/eclipse/eclipse-SDK-3.1-win32.zip,eclipse)]]

if will result in a link like that:

<a href="/SpielWiese?action=extfile&do=get&root=pb&file=java/eclipse/eclipse-SDK-3.1-win32.zip&altname=eclipse">eclipse</a>

The action will then take the root stored in the configuration, append to it the relative path, and serve it to the request. The result is, that any browser will allow you to open files from a http source.

If you have any questions about the implementation, please don't hesitate to ask. And please be nice, it is my first python implementation in the last 8 years after a lot of java (and reasently ruby, yeh!).

When I have polished up the work (perhaps with your tips), I will provide it in the MoinMoin wiki so that others will find it.

Bye and thank once again for all your help

Markus

On Sun, 02 Oct 2005 12:38:19 +0200, Markus Liebelt <markus.liebelt at online.de> wrote:

> Hello all together,
>
> I now reached something, but am stuck and have no idea how to proceed.
>
> My design is:
> 1. Implement a macro that will output a link in HTML that will call an action.
> 2. Implement that action (by stealing a lot from AttachFile) to open the external file.
>
> The macro is working, I have appended the version that works. So when I use the following on a page:
>
> [[LinkFile(show.txt,pb)]] this is emmited:
>
> <a href="/SpielWiese?action=extfile&do=get&root=pb&file=show.txt">show.txt</a>
>
> Then when I click on the link, I get a pretty weird exception (that I cannot locate in the source):
>
> ===================================
> TypeError'NoneType' object is not callable	Please include this information in your bug reports!:
> Python Python 2.4.1: D:\programme\Internet\MMDE\moin.exe
> Platform: win32 (nt)
> MoinMoin Release 1.3.4 [Revision patch-723; DesktopEdition Release 1.3.4-2]
> Sun Oct 02 12:30:14 2005	
>
> A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
>
>   D:\programme\Internet\MMDE\MoinMoin\request.pyo in run(self=<MoinMoin.request.RequestStandAlone instance>)	
>
> TypeError: 'NoneType' object is not callable
>        __doc__ = 'Inappropriate argument type.'
>        __getitem__ = <bound method TypeError.__getitem__ of <exceptions.TypeError instance>>
>        __init__ = <bound method TypeError.__init__ of <exceptions.TypeError instance>>
>        __module__ = 'exceptions'
>        __str__ = <bound method TypeError.__str__ of <exceptions.TypeError instance>>
>        args = ("'NoneType' object is not callable",)
> ===============================================
>
> I tried then to rename the file to see if the lookup of the action works. So when I missspell the extfile.py to extfile2.py, I got the following:
>
> - The browser is called with that link: http://localhost:8080/SpielWiese?action=extfile&do=get&root=pb&file=show.txt
> - The output is: Unknown action extfile
>
> Exactly what to expect...
>
> So I don't know what to do now. Has anyone a tip how to debug MoinMoin? Does anyone have an (internal) action that does something minimal and that works? Are there any things that don't work in the Desktop Edition I don't know?
>
> I have appended the macro and the action, so if someone has time to check it ...
>
> Thank you all a lot for your patience
>
> Markus
>
> On Thu, 29 Sep 2005 09:46:09 +0200, Markus Liebelt <markus.liebelt at online.de> wrote:
>
>> Hello all together,
>>
>> I have searched the list for some information on my topic, but found no answer yet. So I send this email, perhaps someone has a tip or even a solution for me.
>>
>> I want to get something doing this:
>> - I have a setup where the MoinMoin Desktop Edition will be installed on a DVD. It is a knowledge repository that may be easily installed on every desktop.
>> - Together with the wiki come a lot of ressources which are handled external to the wiki. There are some reasons for to do that, but just believe me, that is necessary.
>> - There should be a way to link the external ressources inside the wiki. When I use a link like file:///d:/some/stupid/file.exe, it is displayed in the browser, but the browser does not open it for security reasons.
>>
>> What I would like to get is the following:
>> 1. Expand the configuration to allow for a variable that denotes the root of the external ressources file system.
>> 2. Write a macro or action, that takes the value of the variable, the relative path to a ressource, and provides that ressource as a http ressource to the browser.
>>
>> I know that are two different questions, but I need answers for both of them to get my solution working. If anyone could point me to some example that does similar things, I will dive again into python (last wrote something in python now 8 years ago) and implement that solution (of cource, with providing it to the community :-)).
>>
>> I hope there is a kind soul somewhere out there to help me
>>
>> Bye
>> 	Markus
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by:
>> Power Architecture Resource Center: Free content, downloads, discussions,
>> and more. http://solutions.newsforge.com/ibmarch.tmpl
>> _______________________________________________
>> Moin-user mailing list
>> Moin-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/moin-user
>>
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: extfile.py
Type: application/octet-stream
Size: 4199 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/moin-user/attachments/20051004/a8c0ccc5/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LinkFile.py
Type: application/octet-stream
Size: 1516 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/moin-user/attachments/20051004/a8c0ccc5/attachment-0001.obj>


More information about the Moin-user mailing list