In my case, I had a homegrown system in Pylons. It has a four-level ID (parent/child/grandchild/filename.extension), an INI setting for the top directory, extension checking, filename sanitizing, and the next version will have virus checking with clamav. To port it to Pyramid I looked at filedepot and pyramid_storage, but a lot of it was for switching to other backends like S3 which we would never do, and I couldn't find any compelling features in the rest, especially since the existing algorithm was known to work and meet our needs. So I ended up porting it to Pyramid. I've started using 'service' classes to represent domain logic, so I put the code there.
FWIW, my service classes are defined as "between the models and the views, with no Pyramid-specific, I/O specific, or presentation-specific ties." Pyramid-specific and I/O-specific are mostly the same thing: how to get things in and out of the views. The few Pyramid ties I allow are an alternate constructor, HTTP exceptions, and pyramid.compat functions. The alternate constructor (class method) is 'from_request'; it picks the things out of the request it needs and creates the regular instance. For exceptions, i try to use generic ones, but if it's a case that the view will just trivially convert it to an HTTPException and has no other use, then I just raise the HTTPException. Unit tests can handle the HTTP exceptions just as easily as other exceptions. On Sat, Dec 19, 2015 at 11:10 AM, Rachid Belaid <[email protected]> wrote: > Hi, > > For file storage abstraction, I used few times pyramid_storage and it did it > the job.. > > Recently I tried filedepot because I wanted something which can be > initialised outside the registry but I hit few problems: > - Dislike the global setup > - Require a bit of plumbing to play nice with ini file > - If you don't use s3 then the local storage make serving files through > nginx (or other) a bit challenging due to the way that it's stored. > > I'll get back to use pyramid storage but I thought that I would ask what you > are using on your projects? > > Thanks. > > -- > Rach Belaid > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/pylons-discuss. > For more options, visit https://groups.google.com/d/optout. -- Mike Orr <[email protected]> -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
