Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
147a2b67
Commit
147a2b67
authored
Jan 31, 2011
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow uniform use of logging throughout the module
parent
7ca85974
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
39 additions
and
17 deletions
+39
-17
fs/__init__.py
+13
-0
fs/commands/fsserve.py
+1
-2
fs/contrib/davfs/__init__.py
+5
-5
fs/contrib/tahoefs/__init__.py
+2
-1
fs/expose/dokan/__init__.py
+5
-0
fs/mountfs.py
+5
-2
fs/path.py
+4
-0
fs/remote.py
+0
-5
fs/wrapfs/__init__.py
+2
-1
fs/wrapfs/debugfs.py
+2
-1
No files found.
fs/__init__.py
View file @
147a2b67
...
...
@@ -45,3 +45,16 @@ import os
SEEK_CUR
=
os
.
SEEK_CUR
SEEK_END
=
os
.
SEEK_END
SEEK_SET
=
os
.
SEEK_SET
# Allow clean use of logging throughout the lib
import
logging
as
_logging
class
_NullHandler
(
_logging
.
Handler
):
def
emit
(
self
,
record
):
pass
_logging
.
getLogger
(
"fs"
)
.
addHandler
(
_NullHandler
())
def
getLogger
(
name
):
"""Get a logger object for use within the pyfilesystem library."""
assert
name
.
startswith
(
"fs."
)
return
_logging
.
getLogger
(
name
)
fs/commands/fsserve.py
View file @
147a2b67
...
...
@@ -94,4 +94,4 @@ def run():
return
FSServe
()
.
run
()
if
__name__
==
"__main__"
:
sys
.
exit
(
run
())
\ No newline at end of file
sys
.
exit
(
run
())
fs/contrib/davfs/__init__.py
View file @
147a2b67
...
...
@@ -31,6 +31,7 @@ import cookielib
import
fnmatch
import
xml.dom.pulldom
import
fs
from
fs.base
import
*
from
fs.path
import
*
from
fs.errors
import
*
...
...
@@ -40,8 +41,7 @@ from fs.contrib.davfs.util import *
from
fs.contrib.davfs
import
xmlobj
from
fs.contrib.davfs.xmlobj
import
*
import
logging
logger
=
logging
.
getLogger
(
"fs.contrib.davfs"
)
logger
=
fs
.
getLogger
(
"fs.contrib.davfs"
)
import
errno
_RETRYABLE_ERRORS
=
[
errno
.
EADDRINUSE
]
...
...
@@ -236,7 +236,7 @@ class DAVFS(FS):
except
KeyError
:
msg
=
"unsupported protocol: '
%
s'"
%
(
url
.
scheme
,)
raise
RemoteConnectionError
(
msg
=
msg
)
#
logger.debug("DAVFS >REQ %s %s/%s",method,url.hostname,url.path)
logger
.
debug
(
"DAVFS >REQ
%
s
%
s/
%
s"
,
method
,
url
.
hostname
,
url
.
path
)
con
=
ConClass
(
url
.
hostname
,
url
.
port
,
timeout
=
self
.
timeout
)
self
.
_add_connection
(
con
)
try
:
...
...
@@ -257,11 +257,11 @@ class DAVFS(FS):
resp
=
con
.
getresponse
()
self
.
_cookiejar
.
extract_cookies
(
FakeResp
(
resp
),
FakeReq
(
con
,
url
.
scheme
,
url
.
path
))
except
Exception
,
e
:
#
logger.exception("DAVFS <ERR %s %s/%s",method,url.hostname,url.path)
logger
.
exception
(
"DAVFS <ERR
%
s
%
s/
%
s"
,
method
,
url
.
hostname
,
url
.
path
)
self
.
_del_connection
(
con
)
raise
else
:
#
logger.debug("DAVFS <RESP %s %s %s/%s",resp.status,method,url.hostname,url.path)
logger
.
debug
(
"DAVFS <RESP
%
s
%
s
%
s/
%
s"
,
resp
.
status
,
method
,
url
.
hostname
,
url
.
path
)
old_close
=
resp
.
close
def
new_close
():
old_close
()
...
...
fs/contrib/tahoefs/__init__.py
View file @
147a2b67
...
...
@@ -54,6 +54,7 @@ import stat as statinfo
import
logging
from
logging
import
DEBUG
,
INFO
,
ERROR
,
CRITICAL
import
fs
import
fs.errors
as
errors
from
fs.path
import
abspath
,
relpath
,
normpath
,
dirname
,
pathjoin
from
fs
import
FS
,
NullFile
,
_thread_synchronize_default
,
SEEK_END
...
...
@@ -63,7 +64,7 @@ from fs.base import fnmatch, NoDefaultMeta
from
util
import
TahoeUtil
from
connection
import
Connection
logger
=
logging
.
getLogger
(
'fs.tahoefs'
)
logger
=
fs
.
getLogger
(
'fs.tahoefs'
)
def
_fix_path
(
func
):
"""Method decorator for automatically normalising paths."""
...
...
fs/expose/dokan/__init__.py
View file @
147a2b67
...
...
@@ -83,6 +83,10 @@ else:
from
ctypes.wintypes
import
LPCWSTR
,
WCHAR
kernel32
=
ctypes
.
windll
.
kernel32
import
logging
logger
=
logging
.
getLogger
(
"fs.expose.dokan"
)
# Options controlling the behaiour of the Dokan filesystem
DOKAN_OPTION_DEBUG
=
1
DOKAN_OPTION_STDERR
=
2
...
...
@@ -139,6 +143,7 @@ FILETIME_UNIX_EPOCH = 116444736000000000
def
_debug
(
*
args
):
#print >>sys.stderr, args; sys.stderr.flush()
#logger.debug(map(str,args))
pass
...
...
fs/mountfs.py
View file @
147a2b67
...
...
@@ -54,7 +54,10 @@ class DirMount(object):
self
.
fs
=
fs
def
__str__
(
self
):
return
"Mount point:
%
s"
%
self
.
path
return
"Mount point: <
%
s,
%
s>"
%
(
self
.
path
,
self
.
fs
,)
__repr__
=
__str__
def
__unicode__
(
self
):
return
unicode
(
str
(
self
))
class
FileMount
(
object
):
...
...
@@ -83,7 +86,7 @@ class MountFS(FS):
self
.
mount_tree
=
PathMap
()
def
__str__
(
self
):
return
"<
MountFS>"
return
"<
%
s [
%
s]>"
%
(
self
.
__class__
.
__name__
,
self
.
mount_tree
.
items
(),)
__repr__
=
__str__
...
...
fs/path.py
View file @
147a2b67
...
...
@@ -496,6 +496,9 @@ class PathMap(object):
for
subk
in
self
.
iterkeys
(
k
,
subm
):
yield
subk
def
__iter__
(
self
):
return
self
.
iterkeys
()
def
keys
(
self
,
root
=
"/"
):
return
list
(
self
.
iterkeys
(
root
))
...
...
@@ -558,6 +561,7 @@ class PathMap(object):
def
names
(
self
,
root
=
"/"
):
return
list
(
self
.
iternames
(
root
))
_wild_chars
=
frozenset
(
'*?[]!{}'
)
def
iswildcard
(
path
):
"""Check if a path ends with a wildcard
...
...
fs/remote.py
View file @
147a2b67
...
...
@@ -39,9 +39,6 @@ from fs.local_functools import wraps
from
fs.filelike
import
StringIO
,
SpooledTemporaryFile
,
FileWrapper
from
fs
import
SEEK_SET
,
SEEK_CUR
,
SEEK_END
import
logging
logger
=
logging
.
getLogger
(
"fs.remote"
)
_SENTINAL
=
object
()
...
...
@@ -595,9 +592,7 @@ class CacheFSMixin(WrapFS):
if
not
ci
.
has_full_info
:
raise
KeyError
info
=
ci
.
info
logger
.
debug
(
"GOT INFO FROM CACHE:
%
r"
,
path
)
except
KeyError
:
logger
.
debug
(
"INFO WASN'T IN CACHE:
%
r"
,
path
)
info
=
super
(
CacheFSMixin
,
self
)
.
getinfo
(
path
)
self
.
__set_cached_info
(
path
,
CachedInfo
(
info
))
return
info
...
...
fs/wrapfs/__init__.py
View file @
147a2b67
...
...
@@ -466,6 +466,7 @@ def wrap_fs_methods(decorator, cls=None, exclude=[]):
wrap_fs_methods
.
method_names
=
[
"open"
,
"exists"
,
"isdir"
,
"isfile"
,
"listdir"
,
"makedir"
,
"remove"
,
"setcontents"
,
"removedir"
,
"rename"
,
"getinfo"
,
"copy"
,
"move"
,
"copydir"
,
"movedir"
,
"close"
,
"getxattr"
,
"setxattr"
,
"delxattr"
,
"listxattrs"
,
"getsyspath"
,
"createfile"
,
"hasmeta"
,
"getmeta"
]
"listxattrs"
,
"getsyspath"
,
"createfile"
,
"hasmeta"
,
"getmeta"
,
"listdirinfo"
,
"ilistdir"
,
"ilistdirinfo"
]
fs/wrapfs/debugfs.py
View file @
147a2b67
...
...
@@ -38,9 +38,10 @@ import logging
from
logging
import
DEBUG
,
INFO
,
ERROR
,
CRITICAL
import
sys
import
fs
from
fs.errors
import
FSError
logger
=
logging
.
getLogger
(
'fs.debugfs'
)
logger
=
fs
.
getLogger
(
'fs.debugfs'
)
logger
.
setLevel
(
logging
.
DEBUG
)
logger
.
addHandler
(
logging
.
StreamHandler
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment