PRHider

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

PRHider

Lukas Renggli-2
Hi All,

in the latest commit of Pier I removed the PRHider. This class was  
sort of obsolete and added a lot of complexity to different parts of  
the code. It is easier to use a security plugin to hide particular  
structures.

Before loading the latest version make sure that you don't have any  
instances of PRHider in your model.

    PRHider allInstancesDo: [ :ea | ea remove ]

I assume that nobody will have any of these instances in their model,  
unless you added them manually from an inspector.

Cheers,
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: PRHider

keith1y

>     PRHider allInstancesDo: [ :ea | ea remove ]
>
> I assume that nobody will have any of these instances in their model,  
> unless you added them manually from an inspector.
>
> Cheers,
> Lukas
>
>  

A couple of suggestions.

How about MAExternalFileModel using class instance vars rather than
Class Pool Vars to aid subclasses which have different directories.

I notice that #buildChildren calls #componentsOf: twice and is the only
caller. Both methods call withContext: []

Keith

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

External File Model

keith1y
Hi there Lukas,

I am trying to work out why the MAExternalFileModel does what it does
the way it does it.

could you please explain

Keith

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

Re: PRHider

Lukas Renggli-2
In reply to this post by keith1y
> How about MAExternalFileModel using class instance vars rather than  
> Class Pool Vars to aid subclasses which have different directories.

This is true. I will have to change the class variables to class  
instance variables.

> I notice that #buildChildren calls #componentsOf: twice and is the  
> only  caller. Both methods call withContext: []

Yes, but with different arguments ;-)

One for the environment and one for the current page.

Cheers,
Lukas

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



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

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: External File Model

Lukas Renggli-2
In reply to this post by keith1y
> I am trying to work out why the MAExternalFileModel does what it  
> does the way it does it.

There are different file-models that you can use with Magritte. The  
idea is that you set the #kind: of an MAFileDescription to one of the  
subclasses of MAFileModel.

Earlier versions of Magritte used MAMemoryFileModel and kept all the  
data within a ByteArray in the memory. This is not really practicable  
for bigger files.

MAMexternalFileModel tries to solve this problem. It manages the  
files on the file-system. From the programmer this looks the same as  
if the file would be in memory, as it is loaded and written out as  
necessary.

- The #baseDirectory is the place where Magritte puts its file-
database. Keep this value to nil to make it default to a subdirectory  
next to the Squeak image. (also check the method comment)

- #baseUrl is a nice optimization to allow Apache (or any other Web  
Server) to directly serve the files. The #baseUrl is an absolute URL  
that is used to generate the path to the file. If you have one  
specified the file data does not go trough the image anymore, but  
instead is directly served trough the Web Server (assuming that you  
have a propre setup).

Now you might wonder why the files are in directories like the  
following one?

     /files/9d/bsy8kyp45g0q7blphknk48zujap2wd/earthmap1k.jpg
     1     2   3                              4

(1) Is the #baseDirectory as specified in the settings.
(2) Are 256 directories named '00' to 'FF' to avoid having thousands  
of files in the same directory. Unfortunately this leads to problems  
with the Squeak file primitives and some filesystems don't handle  
that well. This part is generated at random.
(3) This is a secure id, similar to the Seaside session key. It is  
generated at random and provides sort of a security system that even  
works trough Apache (you have to disable directory listings of  
course): if you don't know the file-name you cannot access the file.
(4) This is the original file-name. In the future there will be other  
cached versions of the file be stored there, for example resized  
images, etc.

HTH,
Lukas

problems with filesystems and Squeak if there are thous


So first of all











>
> could you please explain
>
> Keith
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki

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



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

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PRHider

Lukas Renggli-2
In reply to this post by Lukas Renggli-2
Name: Magritte-All-lr.243
Author: lr
Time: 28 September 2007, 8:15:11 am
UUID: a7c84a0d-a311-4358-a2f7-71c202eda9bb
Ancestors: Magritte-All-lr.242
Dependencies: Magritte-Model-lr.289, Magritte-Tests-lr.122, Magritte-
Seaside-lr.243, Magritte-Morph-lr.38

- MAExternalFileModel
        - changed class variables to class instance variables
        - added some more documentation (from the mailing list)

On 28 Sep 2007, at 07:41, Lukas Renggli wrote:

>> How about MAExternalFileModel using class instance vars rather  
>> than Class Pool Vars to aid subclasses which have different  
>> directories.
>
> This is true. I will have to change the class variables to class  
> instance variables.
>
>> I notice that #buildChildren calls #componentsOf: twice and is the  
>> only  caller. Both methods call withContext: []
>
> Yes, but with different arguments ;-)
>
> One for the environment and one for the current page.
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
--
Lukas Renggli
http://www.lukas-renggli.ch



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

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PRHider

keith1y
In reply to this post by Lukas Renggli-2
Lukas Renggli wrote:

>> How about MAExternalFileModel using class instance vars rather than
>> Class Pool Vars to aid subclasses which have different directories.
>
> This is true. I will have to change the class variables to class
> instance variables.
>
>> I notice that #buildChildren calls #componentsOf: twice and is the
>> only  caller. Both methods call withContext: []
>
> Yes, but with different arguments ;-)
>
> One for the environment and one for the current page.
>
> Cheers,
> Lukas
self withContextDo: [] - is called in #buildChildren and in all of the
methods #buildChildren calls
 
or is being up all night getting to me?

Keith


also, how about:

MAFileUploadComponent-remove

remove
    self value ifNotNilDo: [ :fileModel | fileModel delete ].
    self value: nil

(and at least a dummy #delete method on MAFileModel)


for those file models which handle removal.



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

Re: External File Model

keith1y
In reply to this post by Lukas Renggli-2
>
> Now you might wonder why the files are in directories like the
> following one?
>
I might
>  
 
Thanks for the detailed explanation. I knew there was some logical
reason for it.

Keith

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

Re: PRHider

Lukas Renggli-2
In reply to this post by keith1y
> self withContextDo: [] - is called in #buildChildren and in all of  
> the methods #buildChildren calls
>
> or is being up all night getting to me?

You are right. Removing the unnecessary #withContextDo: calls will  
make the code a bit faster ;-)

> also, how about:
>
> MAFileUploadComponent-remove
>
> remove
>     self value ifNotNilDo: [ :fileModel | fileModel delete ].
>     self value: nil
>
> (and at least a dummy #delete method on MAFileModel)
>
> for those file models which handle removal.

Ok, I added that to the latest version. I called it #finalize,  
because the deletion is (in my opinion) on a different level of  
abstraction. This is rather a cleanup that is done (as opposed to the  
initialization).

Cheers,
Lukas

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


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