Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djrandom-py-deleted-112
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is pending deletion, and will be deleted on
2025-06-14
. Repository and other project resources are read-only.
Show more breadcrumbs
ale
djrandom-py-deleted-112
Commits
062aa0b7
Commit
062aa0b7
authored
13 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
do not log since logging is not setup yet anyway; unquote configuration values
parent
999c4941
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/djrandom_client/utils.py
+8
-6
8 additions, 6 deletions
client/djrandom_client/utils.py
with
8 additions
and
6 deletions
client/djrandom_client/utils.py
+
8
−
6
View file @
062aa0b7
import
hashlib
import
hashlib
import
logging
import
os
import
os
NESTING
=
2
NESTING
=
2
log
=
logging
.
getLogger
(
__name__
)
def
generate_path
(
base_dir
,
sha1
):
def
generate_path
(
base_dir
,
sha1
):
dir_parts
=
[
base_dir
]
dir_parts
=
[
base_dir
]
...
@@ -31,8 +28,14 @@ class SyntaxError(Exception):
...
@@ -31,8 +28,14 @@ class SyntaxError(Exception):
pass
pass
def
_unquote
(
s
):
for
qchar
in
(
'"'
,
'
\'
'
):
if
s
.
startswith
(
qchar
)
and
s
.
endswith
(
qchar
):
return
s
.
strip
(
qchar
)
return
s
def
read_config_defaults
(
parser
,
path
):
def
read_config_defaults
(
parser
,
path
):
log
.
debug
(
'
reading config from %s
'
%
path
)
if
not
os
.
path
.
exists
(
path
):
if
not
os
.
path
.
exists
(
path
):
return
return
with
open
(
path
,
'
r
'
)
as
fd
:
with
open
(
path
,
'
r
'
)
as
fd
:
...
@@ -44,5 +47,4 @@ def read_config_defaults(parser, path):
...
@@ -44,5 +47,4 @@ def read_config_defaults(parser, path):
raise
SyntaxError
(
'
%s, line %d: Syntax Error
'
%
(
raise
SyntaxError
(
'
%s, line %d: Syntax Error
'
%
(
path
,
1
+
linenum
))
path
,
1
+
linenum
))
var
,
value
=
map
(
lambda
x
:
x
.
strip
(),
line
.
split
(
'
=
'
,
1
))
var
,
value
=
map
(
lambda
x
:
x
.
strip
(),
line
.
split
(
'
=
'
,
1
))
log
.
debug
(
'
config: %s =
"
%s
"'
%
(
var
,
value
))
parser
.
set_default
(
var
,
_unquote
(
value
))
parser
.
set_default
(
var
,
value
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment