Skip to Content.
Sympa Menu

idok-commit - [idok-commit] idok commit r19 - trunk/python/pydok/src/pydok

idok-commit AT lists.psi.ch

Subject: Commit emails of the iDok project

List archive

[idok-commit] idok commit r19 - trunk/python/pydok/src/pydok


Chronological Thread 
  • From: "AFS account Roman Geus" <geus AT savannah.psi.ch>
  • To: idok-commit AT lists.psi.ch
  • Subject: [idok-commit] idok commit r19 - trunk/python/pydok/src/pydok
  • Date: Wed, 5 Mar 2008 12:11:24 +0100
  • List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
  • List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>

Author: geus
Date: Wed Mar 5 12:11:24 2008
New Revision: 19

Log:
Implemented getFileReadIterator() method and fixed getLastModified() method
of clienthandler CORBA interface of pydok

Modified:
trunk/python/pydok/src/pydok/handler.py

Modified: trunk/python/pydok/src/pydok/handler.py
==============================================================================
--- trunk/python/pydok/src/pydok/handler.py (original)
+++ trunk/python/pydok/src/pydok/handler.py Wed Mar 5 12:11:24 2008
@@ -66,6 +66,14 @@

return pydok.security.get_corba_credentials(user_principal, "", token)

+class FileMetaData:
+ "CORBA struct MetaDataType"
+ def __init__(self, pathname):
+ s = os.stat(pathname)
+ self.fileSize = s.st_size
+ self.modificationDate = time.strftime("%Y-%m-%dT%H:%M:%SZ",
+ time.gmtime(s.st_mtime))

+
class GssException(Exception):
def __init__(self, message):
self.reason = message
@@ -104,7 +112,6 @@
"""Implementation of ClientHandler servant

TODO: Testing
- TODO: Implement getFileReadIterator()
"""
def __init__(self, idok_corba):
"""Initalize ClientHandler
@@ -128,12 +135,12 @@
def getAbsolutePath(self, pathname):
"Returns the absolute pathname string of this pathname"
return os.path.abspath(pathname)
- def getFileReadIterator(self, filePath, contents_out, metadata_out):
+ def getFileReadIterator(self, pathname):
"""This factory method returns a <FileReadIterator> that
can be used to read the file <contents> associated with
<filePath> one ``chunk'' at a time. The <metadata>
reports information about the <contents>."""
- raise NotImplementedError
+ return FileReadIterator_i(pathname)._this(), FileMetaData(pathname)
def getFileName(self, pathname):
"""Returns the name of the file or directory denoted by this
pathname. This
is just the last name in the pathname's name sequence."""
@@ -148,9 +155,8 @@
"""Returns the last modified date of the file or directory denoted by
this pathname as a string in "yyyy-MM-dd hh:mm:ss" format."""
file_stat = os.stat(pathname)
- print file_stat.st_mtime
- print time.ctime(file_stat.st_mtime)
- return time.ctime(file_stat.st_mtime)
+ return time.strftime("%Y-%m-%dT%H:%M:%SZ",
+ time.gmtime(file_stat.st_mtime))
def getMD5(self, pathname):
"Returns the MD5 digest of the file denoted by the pathname as a
string"
BUFSIZE = 16384



  • [idok-commit] idok commit r19 - trunk/python/pydok/src/pydok, AFS account Roman Geus, 03/05/2008

Archive powered by MHonArc 2.6.19.

Top of Page