Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
37c6cfde
Kaydet (Commit)
37c6cfde
authored
Ara 12, 2012
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
officehelper.py: fix obvious Python 3 issues
Change-Id: I40691cd6b1a0a6777e6469bf242fb41dac423587
üst
94a1b9c4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
mailmerge.py
scripting/source/pyprov/mailmerge.py
+12
-12
officehelper.py
scripting/source/pyprov/officehelper.py
+8
-8
No files found.
scripting/source/pyprov/mailmerge.py
Dosyayı görüntüle @
37c6cfde
...
...
@@ -80,10 +80,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
print
(
"PyMailSMPTService connect"
,
file
=
dbgout
)
server
=
xConnectionContext
.
getValueByName
(
"ServerName"
)
if
dbg
:
print
>>
dbgout
,
server
print
(
server
,
file
=
dbgout
)
port
=
int
(
xConnectionContext
.
getValueByName
(
"Port"
))
if
dbg
:
print
>>
dbgout
,
port
print
(
port
,
file
=
dbgout
)
self
.
server
=
smtplib
.
SMTP
(
server
,
port
)
#stderr not available for us under windows, but
#set_debuglevel outputs there, and so throw
...
...
@@ -93,7 +93,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
self
.
server
.
set_debuglevel
(
1
)
connectiontype
=
xConnectionContext
.
getValueByName
(
"ConnectionType"
)
if
dbg
:
print
>>
dbgout
,
connectiontype
print
(
connectiontype
,
file
=
dbgout
)
if
connectiontype
==
'Ssl'
:
self
.
server
.
ehlo
()
self
.
server
.
starttls
()
...
...
@@ -103,7 +103,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
if
user
!=
''
:
if
dbg
:
print
>>
dbgout
,
'Logging in, username of'
,
user
print
(
"Logging in, username of"
+
user
,
file
=
dbgout
)
self
.
server
.
login
(
user
,
password
)
for
listener
in
self
.
listeners
:
...
...
@@ -265,13 +265,13 @@ class PyMailIMAPService(unohelper.Base, XMailService):
self
.
connectioncontext
=
xConnectionContext
server
=
xConnectionContext
.
getValueByName
(
"ServerName"
)
if
dbg
:
print
>>
dbgout
,
server
print
(
server
,
file
=
dbgout
)
port
=
int
(
xConnectionContext
.
getValueByName
(
"Port"
))
if
dbg
:
print
>>
dbgout
,
port
print
(
port
,
file
=
dbgout
)
connectiontype
=
xConnectionContext
.
getValueByName
(
"ConnectionType"
)
if
dbg
:
print
>>
dbgout
,
connectiontype
print
(
connectiontype
,
file
=
dbgout
)
print
(
"BEFORE"
,
file
=
dbgout
)
if
connectiontype
==
'Ssl'
:
self
.
server
=
imaplib
.
IMAP4_SSL
(
server
,
port
)
...
...
@@ -283,7 +283,7 @@ class PyMailIMAPService(unohelper.Base, XMailService):
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
if
user
!=
''
:
if
dbg
:
print
>>
dbgout
,
'Logging in, username of'
,
user
print
(
"Logging in, username of"
+
user
,
file
=
dbgout
)
self
.
server
.
login
(
user
,
password
)
for
listener
in
self
.
listeners
:
...
...
@@ -334,13 +334,13 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
self
.
connectioncontext
=
xConnectionContext
server
=
xConnectionContext
.
getValueByName
(
"ServerName"
)
if
dbg
:
print
>>
dbgout
,
server
print
(
server
,
file
=
dbgout
)
port
=
int
(
xConnectionContext
.
getValueByName
(
"Port"
))
if
dbg
:
print
>>
dbgout
,
port
print
(
port
,
file
=
dbgout
)
connectiontype
=
xConnectionContext
.
getValueByName
(
"ConnectionType"
)
if
dbg
:
print
>>
dbgout
,
connectiontype
print
(
connectiontype
,
file
=
dbgout
)
print
(
"BEFORE"
,
file
=
dbgout
)
if
connectiontype
==
'Ssl'
:
self
.
server
=
poplib
.
POP3_SSL
(
server
,
port
)
...
...
@@ -351,7 +351,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
user
=
xAuthenticator
.
getUserName
()
.
encode
(
'ascii'
)
password
=
xAuthenticator
.
getPassword
()
.
encode
(
'ascii'
)
if
dbg
:
print
>>
dbgout
,
'Logging in, username of'
,
user
print
(
"Logging in, username of"
+
user
,
file
=
dbgout
)
self
.
server
.
user
(
user
)
self
.
server
.
pass_
(
user
,
password
)
...
...
scripting/source/pyprov/officehelper.py
Dosyayı görüntüle @
37c6cfde
...
...
@@ -40,28 +40,28 @@ def bootstrap():
get the ServiceManager by calling getServiceManager() on the returned object.
"""
try
:
# soffice script used on *ix, Mac; soffice.exe used on Windoof
# soffice script used on *ix, Mac; soffice.exe used on Win
if
"UNO_PATH"
in
os
.
environ
:
sOffice
=
os
.
environ
[
"UNO_PATH"
]
else
:
sOffice
=
""
# lets hope for the best
sOffice
=
os
.
path
.
join
(
sOffice
,
"soffice"
)
if
platform
.
startswith
(
"win"
):
if
platform
.
startswith
(
"win"
):
sOffice
+=
".exe"
# Generate a random pipe name.
random
.
seed
()
sPipeName
=
"uno"
+
str
(
random
.
random
())[
2
:]
# Start the office process, don't check for exit status since an exception is caught anyway if the office terminates unexpectedly.
cmdArray
=
(
sOffice
,
"--nologo"
,
"--nodefault"
,
""
.
join
([
"--accept=pipe,name="
,
sPipeName
,
";urp;"
]))
os
.
spawnv
(
os
.
P_NOWAIT
,
sOffice
,
cmdArray
)
# ---------
xLocalContext
=
uno
.
getComponentContext
()
resolver
=
xLocalContext
.
ServiceManager
.
createInstanceWithContext
(
"com.sun.star.bridge.UnoUrlResolver"
,
xLocalContext
)
"com.sun.star.bridge.UnoUrlResolver"
,
xLocalContext
)
sConnect
=
""
.
join
([
"uno:pipe,name="
,
sPipeName
,
";urp;StarOffice.ComponentContext"
])
# Wait until an office is started, but loop only nLoop times (can we do this better???)
...
...
@@ -77,8 +77,8 @@ def bootstrap():
sleep
(
0.5
)
# Sleep 1/2 second.
except
BootstrapException
:
raise
except
Exception
,
e
:
# Any other exception
raise
except
Exception
as
e
:
# Any other exception
raise
BootstrapException
(
"Caught exception "
+
str
(
e
),
None
)
return
xContext
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