Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
180a3226
Commit
180a3226
authored
Mar 03, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
1a6ad340
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
0 deletions
+111
-0
utilities/bbb.py
utilities/bbb.py
+1
-0
utilities/load_site.py
utilities/load_site.py
+110
-0
No files found.
utilities/bbb.py
View file @
180a3226
#!/usr/bin/env python
"""Read and (re-)format BoboPOS 2 database files
"""Read and (re-)format BoboPOS 2 database files
"""
"""
...
...
utilities/load_site.py
0 → 100644
View file @
180a3226
"""Load a Zope site from a collection of files or directories
"""
usage
=
""" [options] url file .....
where options are:
-p path
Path to ZPublisher
-u user:password
Credentials
-v
Run in verbose mode.
"""
import
sys
,
getopt
,
os
,
string
ServerError
=
''
verbose
=
0
def
main
():
user
,
password
=
'superuser'
,
'123'
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'p:u:v'
)
global
verbose
for
o
,
v
in
opts
:
if
o
==
'-p'
:
d
,
f
=
os
.
path
.
split
(
v
)
if
f
==
'ZPublisher'
:
sys
.
path
.
insert
(
0
,
d
)
else
:
sys
.
path
.
insert
(
0
,
v
)
elif
o
==
'-u'
:
v
=
string
.
split
(
v
,
':'
)
user
,
password
=
v
[
0
],
string
.
join
(
v
[
1
:],
':'
)
elif
o
==
'-v'
:
verbose
=
1
if
not
args
:
print
sys
.
argv
[
0
]
+
usage
sys
.
exit
(
1
)
url
=
args
[
0
]
files
=
args
[
1
:]
import
ZPublisher.Client
global
ServerError
ServerError
=
ZPublisher
.
Client
.
ServerError
object
=
ZPublisher
.
Client
.
Object
(
url
,
username
=
user
,
password
=
password
)
for
f
in
files
:
upload_file
(
object
,
f
)
def
call
(
f
,
*
args
,
**
kw
):
# Call a function ignoring redirect bci errors.
try
:
apply
(
f
,
args
,
kw
)
except
ServerError
,
v
:
if
str
(
v
)[:
1
]
!=
'3'
:
raise
sys
.
exc_info
()[
0
],
sys
.
exc_info
()[
1
],
sys
.
exc_info
()[
2
]
def
upload_file
(
object
,
f
):
if
os
.
path
.
isdir
(
f
):
return
upload_dir
(
object
,
f
)
dir
,
name
=
os
.
path
.
split
(
f
)
root
,
ext
=
os
.
path
.
splitext
(
name
)
if
ext
in
(
'file'
,
'dir'
):
ext
=
''
else
:
ext
=
string
.
lower
(
ext
)
if
ext
and
ext
[
0
]
in
'.'
:
ext
=
ext
[
1
:]
if
ext
and
globals
().
has_key
(
'upload_'
+
ext
):
if
verbose
:
print
'upload_'
+
ext
,
f
return
globals
()[
'upload_'
+
ext
](
object
,
f
)
if
verbose
:
print
'upload_file'
,
f
,
ext
call
(
object
.
manage_addFile
,
id
=
name
,
file
=
open
(
f
))
def
upload_dir
(
object
,
f
):
if
verbose
:
print
'upload_dir'
,
f
dir
,
name
=
os
.
path
.
split
(
f
)
call
(
object
.
manage_addFolder
,
id
=
name
)
object
=
object
.
__class__
(
object
.
url
+
'/'
+
name
,
username
=
object
.
username
,
password
=
object
.
password
)
for
n
in
os
.
listdir
(
f
):
upload_file
(
object
,
os
.
path
.
join
(
f
,
n
))
def
upload_html
(
object
,
f
):
dir
,
name
=
os
.
path
.
split
(
f
)
f
=
open
(
f
)
# There is a Document bugs that causes file uploads to fail.
# Waaa. This will be fixed in 1.10.2.
f
=
f
.
read
()
call
(
object
.
manage_addDTMLDocument
,
id
=
name
,
file
=
f
)
upload_htm
=
upload_html
def
upload_dtml
(
object
,
f
):
dir
,
name
=
os
.
path
.
split
(
f
)
call
(
object
.
manage_addDTMLMethod
,
id
=
name
,
file
=
open
(
f
))
def
upload_gif
(
object
,
f
):
dir
,
name
=
os
.
path
.
split
(
f
)
call
(
object
.
manage_addImage
,
id
=
name
,
file
=
open
(
f
))
upload_jpg
=
upload_gif
upload_png
=
upload_gif
if
__name__
==
'__main__'
:
main
()
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