Magritte description for a file on the server's FS ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Magritte description for a file on the server's FS ?

Damien Pollet
Hi,

I'd like to describe a field that should point to a file on the server's disk.

The precise use-case is that I have a seaside component to displays
bibliographies in Pier, and I would like to have it display the
contents of a .bib file, which is under SVN or similar
version/replication control (so it will be updated sometimes without
going through Squeak).

Currently I'm using MAFileDescription new kind: MAExternalFileModel; ...
but that makes Pier ask for a file to upload, when I'd like to specify
a server-specific file path.

I was thinking of subclassing MAFileModel but now I suspect that
defining MAServerFileChooserComponent is the way... correct ?

PS. why does MAFileUploadComponent>>#isMultipart actually mean "no file yet"?

--
Damien Pollet
type less, do more [ | ] http://typo.cdlm.fasmz.org

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte description for a file on the server's FS ?

Lukas Renggli-2
> I'd like to describe a field that should point to a file on the  
> server's disk.
>
> The precise use-case is that I have a seaside component to displays
> bibliographies in Pier, and I would like to have it display the
> contents of a .bib file, which is under SVN or similar
> version/replication control (so it will be updated sometimes without
> going through Squeak).
>
> Currently I'm using MAFileDescription new kind:  
> MAExternalFileModel; ...
> but that makes Pier ask for a file to upload, when I'd like to specify
> a server-specific file path.
>
> I was thinking of subclassing MAFileModel but now I suspect that
> defining MAServerFileChooserComponent is the way... correct ?

Yes, in your case you certainly need to create your own file chooser  
dialog. I don't exactly remember the details on how  
MAExternalFileModel is implemented, probably you need to subclass the  
model as well (unless it supports to freely specify the location).

> PS. why does MAFileUploadComponent>>#isMultipart actually mean "no  
> file yet"?

This is used by Seaside to determine if the form has to be a multi-
part form. There is only a file-upload control if there is "no file  
yet" and therefor the form only needs to be multipart in that case.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte description for a file on the server's FS ?

Damien Pollet
On 10/09/2007, Lukas Renggli <[hidden email]> wrote:
> > I'd like to describe a field that should point to a file on the
> > server's disk.
[snip]
> Yes, in your case you certainly need to create your own file chooser
> dialog. I don't exactly remember the details on how
> MAExternalFileModel is implemented, probably you need to subclass the
> model as well (unless it supports to freely specify the location).

OK, thanks!
I have a first implementation in Citezen-Seaside at
http://www.squeaksource.com/Citezen.html

I created MAReferenceFileModel (subclass of MAExternalFileModel with
settable location) and MAServerFileChooserComponent to work with it.

I used Rio to manipulate file paths because it seemed easier; should I
remove the dependancy before committing the code to the Magritte
repository ?

--
Damien Pollet
type less, do more [ | ] http://typo.cdlm.fasmz.org

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte description for a file on the server's FS ?

Lukas Renggli-2

On 11 Sep 2007, at 17:36, Damien Pollet wrote:

> On 10/09/2007, Lukas Renggli <[hidden email]> wrote:
>>> I'd like to describe a field that should point to a file on the
>>> server's disk.
> [snip]
>> Yes, in your case you certainly need to create your own file chooser
>> dialog. I don't exactly remember the details on how
>> MAExternalFileModel is implemented, probably you need to subclass the
>> model as well (unless it supports to freely specify the location).
>
> OK, thanks!
> I have a first implementation in Citezen-Seaside at
> http://www.squeaksource.com/Citezen.html
>
> I created MAReferenceFileModel (subclass of MAExternalFileModel with
> settable location) and MAServerFileChooserComponent to work with it.
>
> I used Rio to manipulate file paths because it seemed easier; should I
> remove the dependancy before committing the code to the Magritte
> repository ?

It depends if you code is in a separate package or not? I would  
prefer to keep Magritte-Core, Magritte-Seaside and Magritte-Tests as  
portable as possible. There are ports to VisualWorks and GemStone and  
such a dependency would make portability much harder. File access in  
general is a bad story anyway.

For extension packages I think it is fine to have dependencies, as  
long as it is documented somewhere. Please go ahead an publish it to  
one of the Magritte repositories.

Cheers,
Lukas


--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki