How does GetDisplayName get called

11 views
Skip to first unread message

Bernhard

unread,
Mar 17, 2010, 6:02:20 PM3/17/10
to Discuss WsgiDAV
In order to work with real filenames in the background and to show
something else in the webdav client (a kind of name mapping) I tried
to adapt fs_dav_provider and expected that the displayName property
would solve this.
But getDisplayName doesn't seem to get called, I tested this in
fs_dav_provider and virtual_dav_provider.
Can the property displayname be used to transparently re-map shown
names in the client, and if so, how to get getDisplayName called in
the fs_dav_provider?
Regards,
Bernhard

KLEIN Stéphane

unread,
Mar 18, 2010, 5:55:59 PM3/18/10
to Discuss WsgiDAV

Hi,

fs_dav_provider.FileResource is class derived from
dav_provider.DAVResource class.

dav_provider.DAVResource.getPropertyValue use getDisplayName method to
return the file name displayed.

Regards,
Stephane

Bernhard

unread,
Mar 22, 2010, 2:50:17 PM3/22/10
to Discuss WsgiDAV
Hi,
reading the code I expected this one too.
But, changing

def getDisplayName(self):
return self.name

in the standard fs_dav_provider.py (line 108-109) file (directly in
the python site-package folder for testing purposes) to:

def getDisplayName(self):
print "XXX"
return "X-" + self.name

didn't show any file starting with "X-" nor did the print statement
get called ever.
That was the problem. Somehow getPropertyValue doesn't call
getDiaplyName in fs_dav_provider.py.

Regards,
Bernhard

mar10

unread,
Mar 23, 2010, 2:44:13 AM3/23/10
to Discuss WsgiDAV
Hi Bernhard,

getDisplayName() defines the value of the '{DAV:}displayname'
property.
You can see it with clients like DAVExplorer. It's also used by the
dir_browser module to render the directory listings.

In contrast the 'name' of a resource is used to create the URLs.
WebDAV clients like Windows File Explorer display the resource names
as file or directory names.
The name is stored as Resource.name attribute, and initialized in teh
Resource contructor.
If you want to change it, you also have to make sure that the URL-to-
resource mapping is resolved.
This can be done by modifying Provider.getResourceInst()

The samples (hg_dav_provider.py, virtual_dav_provider.py,
mysql_dav_provider.py) may give an idea.

Hope this helps
Martin

Reply all
Reply to author
Forward
0 new messages