RE: Re: specifying content types when uploading files with WebDAV
"Davis Mr MR" <[email protected]> Tue, 31 Jan 2006 11:41:24 -0000
| Newsgroups | gmane.comp.web.zope.plone.design |
|---|---|
| Message-ID | <83FE527C9C65A247BF3BD36F6962AB784CB389@CranfieldMail.shrivenham.cranfield.ac.uk> |
Hi,
You can do it on a folder type basis by overriding the Put method, code
below. Just put the method on your NewATFolder class, and then put in
the portal type that you want to override in the method.
Works with ftp, not tried with webdav yet.
Hope that helps
Cheers
Michael
# from PortalFolder
def PUT_factory( self, name, typ, body ):
"""
Dispatcher for PUT requests to non-existent IDs. Returns
an object of the appropriate type (or None, if we don't
know what to do).
"""
registry =3D getToolByName( self, 'content_type_registry' )
if registry is None:
return None
typeObjectName =3D registry.findTypeName( name, typ, body )
if typeObjectName is None:
return None
elif typeObjectName =3D=3D 'Image':
typeObjectName =3D 'Student Photo'
self.invokeFactory( typeObjectName, name )
# XXX: this is butt-ugly.
obj =3D aq_base( self._getOb( name ) )
self._delObject( name )
return obj
-----Original Message-----
From: plone-design-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:plone-design-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of reco
Sent: 02 January 2006 13:32
To: [email protected]
Subject: [Plone-design] Re: specifying content types when uploading
files with WebDAV
hi nate,
i ran into a similar problem the other day.
i played arround crating a plone product which subclasses the ATFolder=20
and the ATImage. lets call them here: NewATFolder and NewATImage.=20
NewATImage is the only Content Type allowed in NewATFolder.
so when i crate a NewATFolder in my plone site and navigate to it via=20
webdav/ftp and want to upload an image i get an error cause the=20
registry points wants to create an ATImage.
is there any way to tell plone to create NewATImage Content Types when=20
to parrent object is a NewATFolder?
thanx christof
On 2005-12-15 20:05:54 +0100, Nate Aune=20
<natea-cNZgzcB+5vhWk0Htik3J/[email protected]> said:
> Dmersch wrote:
>> Whenever I upload text files into Plone with WebDAV (WebDrive) it
tags=20
>> them all as "Documents" when I need them all to be "Portal Files."
I'd=20
>> add these text files through the Plone interface, but I often have to
>> upload them 100 at a time.
>> Any ideas on how to make sure that all uploaded text files get tagged
a=20
>> 'file' and not a 'document'?
>=20
> You can specify the mapping of file extension or MIME type in the=20
> content_type_registry portal tool which you can find in the Plone
root.
>=20
> Nate
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD
SPLUNK!
> http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick
_______________________________________________
Plone-design mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-design
--=20
This message has been scanned for viruses and
dangerous content by the Cranfield MailScanner, and is
believed to be clean.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642