Kaydet (Commit) 0ca978e9 authored tarafından Xisco Fauli's avatar Xisco Fauli

pyweb: some pyflakes love

Change-Id: I317656ca26eec5946959ac21e7da335196dd8548
üst 59e09804
......@@ -66,7 +66,7 @@ class AbstractErrorHandler(ErrorHandler):
return self.showMessage(self.getMessageFor(ex, arg, ix, errorType), errorType)
elif (errorType == ErrorHandler.ERROR_MESSAGE):
return self.showMessage(self.getMessageFor(ex, arg, ix, errorType), errorType)
raise IllegalArgumentException("unknown error type")
raise ValueError("unknown error type")
# @deprecated
# @param message
......@@ -109,7 +109,7 @@ class AbstractErrorHandler(ErrorHandler):
return 2
elif (errorType in (ErrorHandler.ERROR_WARNING, ErrorHandler.ERROR_MESSAGE)):
return 1
raise IllegalArgumentException("unkonown error type")
raise ValueError("unkonown error type")
# @param errorType
......@@ -136,7 +136,7 @@ class AbstractErrorHandler(ErrorHandler):
return OK
elif (errorType == ErrorHandler.ERROR_MESSAGE):
return OK
raise IllegalArgumentException("unkonown error type")
raise ValueError("unkonown error type")
# @deprecated
# @param errorType
......@@ -163,7 +163,7 @@ class AbstractErrorHandler(ErrorHandler):
return "warningbox"
elif (errorType == ErrorHandler.ERROR_MESSAGE):
return "infobox"
raise IllegalArgumentException("unkonown error type")
raise ValueError("unkonown error type")
# renders the error
# @param ex the exception
......
......@@ -15,7 +15,6 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import uno
import traceback
from .ImageListDialog import ImageListDialog
......
......@@ -16,7 +16,7 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
from com.sun.star.awt.VclWindowPeerAttribute import OK, DEF_OK, OK_CANCEL, DEF_CANCEL
from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO, DEF_YES
from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO
class ErrorHandler:
......
......@@ -28,8 +28,6 @@ from ..common.SystemDialog import SystemDialog
from ..common.FileAccess import FileAccess
from ..common.HelpIds import HelpIds
from ..common.UCB import UCB
from .data.CGPublish import CGPublish
from .data.CGSettings import CGSettings
from com.sun.star.ucb import AuthenticationRequest
from com.sun.star.ucb import InteractiveAugmentedIOException
......@@ -305,18 +303,18 @@ class FTPDialog(UnoDialog2, UIConsts):
try:
self.connect1(self.getFullUrl())
success = True
except InteractiveAugmentedIOException as iaioex:
except InteractiveAugmentedIOException:
try:
self.connect1(self.getAccountUrl())
self.setDir("/")
success = True
except Exception:
self.setLabel(self.STATUS_NO_RIGHTS)
except InteractiveNetworkResolveNameException as inrne:
except InteractiveNetworkResolveNameException:
self.setLabel(self.STATUS_SERVER_NOT_FOUND)
except AuthenticationRequest as ar:
except AuthenticationRequest:
self.setLabel(self.STATUS_USER_PWD_WRONG)
except InteractiveNetworkConnectException as incx:
except InteractiveNetworkConnectException:
self.setLabel(self.STATUS_HOST_UNREACHABLE)
except Exception:
self.setLabel(-1)
......@@ -341,9 +339,6 @@ class FTPDialog(UnoDialog2, UIConsts):
def connect1(self, acountUrl):
content = self.ucb.getContent(self.getAccountUrl())
# list files in the content.
l = self.ucb.listFiles(self.getAccountUrl(), None)
# open the content
aArg = OpenCommandArgument2()
aArg.Mode = FOLDERS # FOLDER, DOCUMENTS -> simple filter
......@@ -351,9 +346,6 @@ class FTPDialog(UnoDialog2, UIConsts):
self.ucb.executeCommand(content, "open", aArg)
# get the title property of the content.
obj = self.ucb.getContentProperty(content, "Title", str)
# changes the ftp subdirectory, in both
# the UI and the data.
# @param s the directory.
......
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
# used for debugging.
class LogTaskListener(TaskListener, ErrorHandler):
out
def __init__(os):
out = os
def __init__():
self.__init__(System.out)
# @see com.sun.star.wizards.web.status.TaskListener#taskStarted(com.sun.star.wizards.web.status.TaskEvent)
def taskStarted(te):
out.println("TASK " + te.getTask().getTaskName() + " STARTED.")
#@see com.sun.star.wizards.web.status.TaskListener#taskFinished(com.sun.star.wizards.web.status.TaskEvent)
def taskFinished(te):
out.println("TASK " + te.getTask().getTaskName() + " FINISHED: " + te.getTask().getSuccessfull() + "/" + te.getTask().getMax() + "Succeeded.")
#@see com.sun.star.wizards.web.status.TaskListener#taskStatusChanged(com.sun.star.wizards.web.status.TaskEvent)
def taskStatusChanged(te):
out.println("TASK " + te.getTask().getTaskName() + " status : " + te.getTask().getSuccessfull() + "(+" + te.getTask().getFailed() + ")/" + te.getTask().getMax())
#@see com.sun.star.wizards.web.status.TaskListener#subtaskNameChanged(com.sun.star.wizards.web.status.TaskEvent)
def subtaskNameChanged(te):
out.println("SUBTASK Name:" + te.getTask().getSubtaskName())
# @see com.sun.star.wizards.web.status.ErrorReporter#error(java.lang.Exception, java.lang.Object, java.lang.String)
def error(ex, arg, ix, i):
print (PropertyNames.EMPTY_STRING + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage())
ex.printStackTrace()
return True;
......@@ -25,12 +25,7 @@ from ..ui.event.CommonListener import StreamListenerProcAdapter
from .ProcessErrors import ProcessErrors
from .ExtensionVerifier import ExtensionVerifier
from .ErrorHandler import ErrorHandler
from .data.CGContent import CGContent
from .data.CGDocument import CGDocument
from .data.CGExporter import CGExporter
from .data.CGLayout import CGLayout
from .data.CGPublish import CGPublish
from .data.CGSettings import CGSettings
from com.sun.star.io import IOException
from com.sun.star.uno import SecurityException
......
......@@ -18,8 +18,6 @@ import uno
import traceback
from ..ui.UnoDialog2 import UnoDialog2
from ..ui.UnoDialog import UnoDialog
from ..ui.event.TaskListener import TaskListener
from ..common.PropertyNames import PropertyNames
# Note on the argument resource:
......@@ -45,7 +43,7 @@ class StatusDialog(UnoDialog2):
self.res = resources
if not (len(self.res) == 6):
# display a close button?
raise IllegalArgumentException("The resources argument should contain 6 Strings, see doc on constructor.")
raise ValueError("The resources argument should contain 6 Strings, see doc on constructor.")
b = not (self.enableBreak or self.closeOnFinish)
......
......@@ -15,8 +15,6 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import traceback
from .Process import Process
from ..ui.event.Task import Task
from ..common.FileAccess import FileAccess
......
......@@ -16,10 +16,9 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import traceback
import uno
from .WWD_Startup import WWD_Startup
from .WWD_General import WWD_General
from .WebWizardConst import *
from ..common.FileAccess import FileAccess
from ..common.Configuration import Configuration
......@@ -561,7 +560,7 @@ class WWD_Events(WWD_Startup):
try:
fileAccess.xInterface.createFolder(p.cp_URL)
except Exception as ex:
except Exception:
message = self.resources.resLocalTargetCouldNotCreate.replace(
"%FILENAME", path)
AbstractErrorHandler.showMessage1(
......@@ -643,7 +642,7 @@ class WWD_Events(WWD_Startup):
try:
fileAccess.mkdir(p.url)
except Exception as ex:
except Exception:
message = self.resources.resFTPTargetCouldNotCreate.replace(
"%FILENAME", path)
AbstractErrorHandler.showMessage1(
......@@ -679,7 +678,7 @@ class WWD_Events(WWD_Startup):
ErrorHandler.ERROR_NORMAL_IGNORE):
return False #remove the old session
Configuration.removeNode(conf, name)
except NoSuchElementException as nsex:
except NoSuchElementException:
pass
self.settings.cp_DefaultSession.cp_Index = 0
......@@ -892,7 +891,7 @@ class WWD_Events(WWD_Startup):
#if ProcessStatusRenderer is not None:
# ProcessStatusRenderer.close(False)
except Exception as ex:
except Exception:
traceback.print_exc()
class LoadDocs(object):
......
......@@ -300,6 +300,6 @@ class WWD_General(WebWizardDialog):
def substitute(self, path):
try:
return self.xStringSubstitution.substituteVariables(path, False)
except Exception as ex:
except Exception:
traceback.print_exc()
return path
......@@ -16,15 +16,12 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import traceback
import uno
from .WWD_General import WWD_General
from .WebWizardConst import *
from .StylePreview import StylePreview
from ..common.Configuration import Configuration
from ..common.FileAccess import FileAccess
from ..common.Desktop import Desktop
from ..common.Properties import Properties
from ..document.OfficeDocument import OfficeDocument
from .data.CGSettings import CGSettings
from .data.CGDocument import CGDocument
......@@ -39,8 +36,6 @@ from ..ui.DocumentPreview import DocumentPreview
from ..ui.event.DataAware import DataAware
from ..ui.event.Task import Task
from com.sun.star.lang import IllegalArgumentException
'''
Web Wizard Dialog implementation : Startup.
This class contains the startup implementation and session mounting methods.
......@@ -131,7 +126,6 @@ class WWD_Startup(WWD_General):
self.txtZip.Model.Enabled = False
self.buildStepX()
self.xMSF = xmsf
xDesktop = Desktop.getDesktop(xmsf)
self.terminateListener = TerminateListenerProcAdapter(self)
self.myFrame = OfficeDocument.createNewFrame(xmsf, self.terminateListener)
doc = OfficeDocument.createNewDocument(
......
......@@ -18,7 +18,6 @@
import traceback
from ..common.ConfigGroup import ConfigGroup
from ..common.Configuration import Configuration
from ..common.XMLProvider import XMLProvider
from ..ui.event.EventListenerList import EventListenerList
from ..ui.event.ListDataEvent import ListDataEvent
from ..ui.event.ListDataListener import ListDataListener
......@@ -124,7 +123,7 @@ class WebConfigSet(ConfigGroup):
self.childrenMap.clear()
del self.childrenList[:]
def update(i):
def update(self, i):
self.fireListDataListenerContentsChanged(i, i)
def createDOM(self, parent):
......
......@@ -15,8 +15,6 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import unohelper
from ..ui.WizardDialog import WizardDialog, uno, PropertyNames
from .WebWizardDialogResources import WebWizardDialogResources
from .WebWizardConst import *
......
......@@ -15,8 +15,6 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import uno
from os import sep as separator
from ...common.ConfigGroup import ConfigGroup
from ...document.OfficeDocument import OfficeDocument
......@@ -142,7 +140,6 @@ class CGDocument(ConfigGroup):
task.advance(True)
#5
valid = True
if self.cp_Title == "":
self.cp_Title = self.title
......
......@@ -32,7 +32,6 @@ class CGLayout(ConfigGroup):
def createTemplates(self, xmsf):
self.templates = {}
workPath = self.getSettings().workPath
fa = FileAccess(xmsf)
stylesheetPath = fa.getURL(
self.getSettings().workPath, "layouts/" + self.cp_FSName)
......@@ -46,7 +45,6 @@ class CGLayout(ConfigGroup):
i += 1
def getImageUrls(self):
sRetUrls = range(1)
ResId = UIConsts.RID_IMG_WEB + (self.cp_Index * 2)
return [ResId, ResId + 1]
......
......@@ -15,8 +15,6 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import uno
from ...common.ConfigGroup import ConfigGroup
from ..WebConfigSet import WebConfigSet
from ...common.XMLHelper import XMLHelper
......
......@@ -16,7 +16,6 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import traceback
import uno
from datetime import date as dateTimeObject
from ...common.FileAccess import FileAccess
......@@ -35,7 +34,6 @@ from .CGSession import CGSession
from com.sun.star.i18n.NumberFormatIndex import DATE_SYS_DMMMYYYY
from com.sun.star.i18n.NumberFormatIndex import NUMBER_1000DEC2
from com.sun.star.util import DateTime
class CGSettings(ConfigGroup):
......
......@@ -16,7 +16,6 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import traceback
import uno
from .Exporter import Exporter
from ..TypeDetection import *
......
......@@ -48,4 +48,3 @@ class ConfiguredExporter(FilterExporter):
if (s == "true"):
return True
return None
......@@ -18,7 +18,6 @@
from .AbstractExporter import AbstractExporter
from ...common.Properties import Properties
from ...ui.event.Task import Task
from com.sun.star.io import IOException
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment