No space in indentation, /src/common/ part
This commit is contained in:
parent
20835ad104
commit
68619a5597
7 changed files with 111 additions and 111 deletions
|
@ -117,7 +117,7 @@ class ChangeStatusCommand(AdHocCommand):
|
||||||
try:
|
try:
|
||||||
presencetype = form['presence-type'].value
|
presencetype = form['presence-type'].value
|
||||||
if not presencetype in \
|
if not presencetype in \
|
||||||
('free-for-chat', 'online', 'away', 'xa', 'dnd', 'offline'):
|
('free-for-chat', 'online', 'away', 'xa', 'dnd', 'offline'):
|
||||||
self.badRequest(request)
|
self.badRequest(request)
|
||||||
return False
|
return False
|
||||||
except: # KeyError if there's no presence-type field in form or
|
except: # KeyError if there's no presence-type field in form or
|
||||||
|
@ -282,8 +282,8 @@ class ConnectionCommands:
|
||||||
iq = iq_obj.buildReply('result')
|
iq = iq_obj.buildReply('result')
|
||||||
q = iq.getTag('query')
|
q = iq.getTag('query')
|
||||||
q.addChild('identity', attrs = {'type': 'command-node',
|
q.addChild('identity', attrs = {'type': 'command-node',
|
||||||
'category': 'automation',
|
'category': 'automation',
|
||||||
'name': cmd.commandname})
|
'name': cmd.commandname})
|
||||||
q.addChild('feature', attrs = {'var': xmpp.NS_COMMANDS})
|
q.addChild('feature', attrs = {'var': xmpp.NS_COMMANDS})
|
||||||
for feature in cmd.commandfeatures:
|
for feature in cmd.commandfeatures:
|
||||||
q.addChild('feature', attrs = {'var': feature})
|
q.addChild('feature', attrs = {'var': feature})
|
||||||
|
|
|
@ -859,14 +859,14 @@ class ConnectionVcard:
|
||||||
dict[name] = []
|
dict[name] = []
|
||||||
entry = {}
|
entry = {}
|
||||||
for c in info.getChildren():
|
for c in info.getChildren():
|
||||||
entry[c.getName()] = c.getData()
|
entry[c.getName()] = c.getData()
|
||||||
dict[name].append(entry)
|
dict[name].append(entry)
|
||||||
elif info.getChildren() == []:
|
elif info.getChildren() == []:
|
||||||
dict[name] = info.getData()
|
dict[name] = info.getData()
|
||||||
else:
|
else:
|
||||||
dict[name] = {}
|
dict[name] = {}
|
||||||
for c in info.getChildren():
|
for c in info.getChildren():
|
||||||
dict[name][c.getName()] = c.getData()
|
dict[name][c.getName()] = c.getData()
|
||||||
return dict
|
return dict
|
||||||
|
|
||||||
def save_vcard_to_hd(self, full_jid, card):
|
def save_vcard_to_hd(self, full_jid, card):
|
||||||
|
|
|
@ -34,103 +34,103 @@ So most of the credit goes to this guys, thanks :-)
|
||||||
import time
|
import time
|
||||||
|
|
||||||
class FuzzyClock:
|
class FuzzyClock:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__hour = 0
|
self.__hour = 0
|
||||||
self.__minute = 0
|
self.__minute = 0
|
||||||
self.__dayOfWeek = 0
|
self.__dayOfWeek = 0
|
||||||
|
|
||||||
self.__hourNames = [ _('one'), _('two'), _('three'), _('four'), _('five'), _('six'),
|
self.__hourNames = [ _('one'), _('two'), _('three'), _('four'), _('five'), _('six'),
|
||||||
_('seven'), _('eight'), _('nine'), _('ten'), _('eleven'),
|
_('seven'), _('eight'), _('nine'), _('ten'), _('eleven'),
|
||||||
_('twelve')]
|
_('twelve')]
|
||||||
|
|
||||||
#Strings to use for the output. %0 will be replaced with the preceding hour (e.g. "x PAST %0"), %1 with the coming hour (e.g. "x TO %1). '''
|
#Strings to use for the output. %0 will be replaced with the preceding hour (e.g. "x PAST %0"), %1 with the coming hour (e.g. "x TO %1). '''
|
||||||
self.__normalFuzzy = [ _("$0 o'clock"), _('five past $0'),
|
self.__normalFuzzy = [ _("$0 o'clock"), _('five past $0'),
|
||||||
_('ten past $0'), _('quarter past $0'),
|
_('ten past $0'), _('quarter past $0'),
|
||||||
_('twenty past $0'), _('twenty five past $0'),
|
_('twenty past $0'), _('twenty five past $0'),
|
||||||
_('half past $0'), _('twenty five to $1'),
|
_('half past $0'), _('twenty five to $1'),
|
||||||
_('twenty to $1'), _('quarter to $1'),
|
_('twenty to $1'), _('quarter to $1'),
|
||||||
_('ten to $1'), _('five to $1'), _("$1 o'clock") ]
|
_('ten to $1'), _('five to $1'), _("$1 o'clock") ]
|
||||||
|
|
||||||
#A "singular-form". It is used when talking about hour 0
|
#A "singular-form". It is used when talking about hour 0
|
||||||
self.__normalFuzzyOne = [ _("$0 o'clock"), _('five past $0'),
|
self.__normalFuzzyOne = [ _("$0 o'clock"), _('five past $0'),
|
||||||
_('ten past $0'), _('quarter past $0'),
|
_('ten past $0'), _('quarter past $0'),
|
||||||
_('twenty past $0'), _('twenty five past $0'),
|
_('twenty past $0'), _('twenty five past $0'),
|
||||||
_('half past $0'), _('twenty five to $1'),
|
_('half past $0'), _('twenty five to $1'),
|
||||||
_('twenty to $1'), _('quarter to $1'),
|
_('twenty to $1'), _('quarter to $1'),
|
||||||
_('ten to $1'), _('five to $1'),
|
_('ten to $1'), _('five to $1'),
|
||||||
_("$1 o'clock") ]
|
_("$1 o'clock") ]
|
||||||
|
|
||||||
|
|
||||||
self.__dayTime = [ _('Night'), _('Early morning'), _('Morning'), _('Almost noon'),
|
self.__dayTime = [ _('Night'), _('Early morning'), _('Morning'), _('Almost noon'),
|
||||||
_('Noon'), _('Afternoon'), _('Evening'), _('Late evening') ]
|
_('Noon'), _('Afternoon'), _('Evening'), _('Late evening') ]
|
||||||
|
|
||||||
self.__fuzzyWeek = [ _('Start of week'), _('Middle of week'), _('End of week'),
|
self.__fuzzyWeek = [ _('Start of week'), _('Middle of week'), _('End of week'),
|
||||||
_('Weekend!') ]
|
_('Weekend!') ]
|
||||||
|
|
||||||
self.setCurrent()
|
self.setCurrent()
|
||||||
|
|
||||||
def setHour(self,hour):
|
def setHour(self,hour):
|
||||||
self.__hour = int(hour)
|
self.__hour = int(hour)
|
||||||
|
|
||||||
def setMinute(self,minute):
|
def setMinute(self,minute):
|
||||||
self.__minute=int(minute)
|
self.__minute=int(minute)
|
||||||
|
|
||||||
def setDayOfWeek(self,day):
|
def setDayOfWeek(self,day):
|
||||||
self.__dayOfWeek=int(day)
|
self.__dayOfWeek=int(day)
|
||||||
|
|
||||||
def setTime(self,time):
|
def setTime(self,time):
|
||||||
timeArray = time.split(":")
|
timeArray = time.split(":")
|
||||||
self.setHour(timeArray[0])
|
self.setHour(timeArray[0])
|
||||||
self.setMinute(timeArray[1])
|
self.setMinute(timeArray[1])
|
||||||
|
|
||||||
def setCurrent(self):
|
def setCurrent(self):
|
||||||
hour=time.strftime("%H")
|
hour=time.strftime("%H")
|
||||||
minute=time.strftime("%M")
|
minute=time.strftime("%M")
|
||||||
day=time.strftime("%w")
|
day=time.strftime("%w")
|
||||||
|
|
||||||
self.setTime(hour+":"+minute)
|
self.setTime(hour+":"+minute)
|
||||||
self.setDayOfWeek(day)
|
self.setDayOfWeek(day)
|
||||||
|
|
||||||
def getFuzzyTime(self, fuzzyness = 1):
|
def getFuzzyTime(self, fuzzyness = 1):
|
||||||
sector = 0
|
sector = 0
|
||||||
realHour = 0
|
realHour = 0
|
||||||
|
|
||||||
if fuzzyness == 1 or fuzzyness == 2:
|
if fuzzyness == 1 or fuzzyness == 2:
|
||||||
if fuzzyness == 1:
|
if fuzzyness == 1:
|
||||||
if self.__minute >2:
|
if self.__minute >2:
|
||||||
sector = (self.__minute - 3) / 5 +1
|
sector = (self.__minute - 3) / 5 +1
|
||||||
else:
|
else:
|
||||||
if self.__minute > 6:
|
if self.__minute > 6:
|
||||||
sector = ((self.__minute - 7) / 15 + 1) * 3
|
sector = ((self.__minute - 7) / 15 + 1) * 3
|
||||||
|
|
||||||
newTimeStr = self.__normalFuzzy[sector]
|
newTimeStr = self.__normalFuzzy[sector]
|
||||||
#$0 or $1?
|
#$0 or $1?
|
||||||
deltaHour = int(newTimeStr[newTimeStr.find("$")+1])
|
deltaHour = int(newTimeStr[newTimeStr.find("$")+1])
|
||||||
|
|
||||||
if (self.__hour + deltaHour) % 12 > 0:
|
if (self.__hour + deltaHour) % 12 > 0:
|
||||||
realHour = (self.__hour + deltaHour) % 12 - 1
|
realHour = (self.__hour + deltaHour) % 12 - 1
|
||||||
else:
|
else:
|
||||||
realHour = 12 - ((self.__hour + deltaHour) % 12 + 1)
|
realHour = 12 - ((self.__hour + deltaHour) % 12 + 1)
|
||||||
|
|
||||||
if realHour == 0:
|
if realHour == 0:
|
||||||
newTimeStr = self.__normalFuzzyOne[sector]
|
newTimeStr = self.__normalFuzzyOne[sector]
|
||||||
|
|
||||||
newTimeStr = newTimeStr.replace("$"+str(deltaHour),
|
newTimeStr = newTimeStr.replace("$"+str(deltaHour),
|
||||||
self.__hourNames[realHour])
|
self.__hourNames[realHour])
|
||||||
|
|
||||||
|
|
||||||
elif fuzzyness == 3:
|
elif fuzzyness == 3:
|
||||||
newTimeStr = self.__dayTime[self.__hour / 3]
|
newTimeStr = self.__dayTime[self.__hour / 3]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
dayOfWeek = self.__dayOfWeek
|
dayOfWeek = self.__dayOfWeek
|
||||||
if dayOfWeek == 1:
|
if dayOfWeek == 1:
|
||||||
newTimeStr = self.__fuzzyWeek[0]
|
newTimeStr = self.__fuzzyWeek[0]
|
||||||
elif dayOfWeek >= 2 and dayOfWeek <= 4:
|
elif dayOfWeek >= 2 and dayOfWeek <= 4:
|
||||||
newTimeStr = self.__fuzzyWeek[1]
|
newTimeStr = self.__fuzzyWeek[1]
|
||||||
elif dayOfWeek == 5:
|
elif dayOfWeek == 5:
|
||||||
newTimeStr = self.__fuzzyWeek[2]
|
newTimeStr = self.__fuzzyWeek[2]
|
||||||
else:
|
else:
|
||||||
newTimeStr = self.__fuzzyWeek[3]
|
newTimeStr = self.__fuzzyWeek[3]
|
||||||
|
|
||||||
return newTimeStr
|
return newTimeStr
|
||||||
|
|
|
@ -620,7 +620,7 @@ r'Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders')
|
||||||
finally:
|
finally:
|
||||||
win32api.RegCloseKey(rkey)
|
win32api.RegCloseKey(rkey)
|
||||||
return val
|
return val
|
||||||
|
|
||||||
def get_my_pictures_path():
|
def get_my_pictures_path():
|
||||||
'''windows-only atm. [Unix lives in the past]'''
|
'''windows-only atm. [Unix lives in the past]'''
|
||||||
return get_windows_reg_env('My Pictures')
|
return get_windows_reg_env('My Pictures')
|
||||||
|
@ -698,7 +698,7 @@ def get_os_info():
|
||||||
(2, 5, 0): '2000',
|
(2, 5, 0): '2000',
|
||||||
(2, 5, 1): 'XP',
|
(2, 5, 1): 'XP',
|
||||||
(2, 5, 2): '2003',
|
(2, 5, 2): '2003',
|
||||||
(2, 6, 0): 'Vista',
|
(2, 6, 0): 'Vista',
|
||||||
}
|
}
|
||||||
if win_version.has_key(ver_format):
|
if win_version.has_key(ver_format):
|
||||||
return 'Windows' + ' ' + win_version[ver_format]
|
return 'Windows' + ' ' + win_version[ver_format]
|
||||||
|
@ -760,7 +760,7 @@ def sanitize_filename(filename):
|
||||||
filename = filename.replace('?', '_').replace(':', '_')\
|
filename = filename.replace('?', '_').replace(':', '_')\
|
||||||
.replace('\\', '_').replace('"', "'").replace('|', '_')\
|
.replace('\\', '_').replace('"', "'").replace('|', '_')\
|
||||||
.replace('*', '_').replace('<', '_').replace('>', '_')
|
.replace('*', '_').replace('<', '_').replace('>', '_')
|
||||||
# 48 is the limit
|
# 48 is the limit
|
||||||
if len(filename) > 48:
|
if len(filename) > 48:
|
||||||
extension = filename.split('.')[-1]
|
extension = filename.split('.')[-1]
|
||||||
filename = filename[0:48]
|
filename = filename[0:48]
|
||||||
|
|
|
@ -361,14 +361,14 @@ class OptionsParser:
|
||||||
trayicon_notification_on_events '''
|
trayicon_notification_on_events '''
|
||||||
if self.old_values.has_key('trayicon_notification_on_new_messages'):
|
if self.old_values.has_key('trayicon_notification_on_new_messages'):
|
||||||
gajim.config.set('trayicon_notification_on_events',
|
gajim.config.set('trayicon_notification_on_events',
|
||||||
self.old_values['trayicon_notification_on_new_messages'])
|
self.old_values['trayicon_notification_on_new_messages'])
|
||||||
gajim.config.set('version', '0.10.1.7')
|
gajim.config.set('version', '0.10.1.7')
|
||||||
|
|
||||||
def update_config_to_01018(self):
|
def update_config_to_01018(self):
|
||||||
'''chat_state_notifications -> outgoing_chat_state_notifications'''
|
'''chat_state_notifications -> outgoing_chat_state_notifications'''
|
||||||
if self.old_values.has_key('chat_state_notifications'):
|
if self.old_values.has_key('chat_state_notifications'):
|
||||||
gajim.config.set('outgoing_chat_state_notifications',
|
gajim.config.set('outgoing_chat_state_notifications',
|
||||||
self.old_values['chat_state_notifications'])
|
self.old_values['chat_state_notifications'])
|
||||||
gajim.config.set('version', '0.10.1.8')
|
gajim.config.set('version', '0.10.1.8')
|
||||||
|
|
||||||
def update_config_to_01101(self):
|
def update_config_to_01101(self):
|
||||||
|
|
|
@ -28,7 +28,7 @@ else:
|
||||||
options={}, content=[]):
|
options={}, content=[]):
|
||||||
'''Role to make handy references to Jabber Enhancement Proposals (JEP).
|
'''Role to make handy references to Jabber Enhancement Proposals (JEP).
|
||||||
|
|
||||||
Use as :JEP:`71` (or jep, or jep-reference).
|
Use as :JEP:`71` (or jep, or jep-reference).
|
||||||
Modeled after the sample in docutils documentation.
|
Modeled after the sample in docutils documentation.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ if __name__ == '__main__':
|
||||||
print Generator.create_xhtml('''
|
print Generator.create_xhtml('''
|
||||||
test::
|
test::
|
||||||
|
|
||||||
>>> print 1
|
>>> print 1
|
||||||
1
|
1
|
||||||
|
|
||||||
*I* like it. It is for :JEP:`71`
|
*I* like it. It is for :JEP:`71`
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,10 @@ if sys.version_info < (2,3,2):
|
||||||
crippled = True
|
crippled = True
|
||||||
|
|
||||||
warnings.warn("Accented and non-Western Jabber IDs will not be properly "
|
warnings.warn("Accented and non-Western Jabber IDs will not be properly "
|
||||||
"case-folded with this version of Python, resulting in "
|
"case-folded with this version of Python, resulting in "
|
||||||
"incorrect protocol-level behavior. It is strongly "
|
"incorrect protocol-level behavior. It is strongly "
|
||||||
"recommended you upgrade to Python 2.3.2 or newer if you "
|
"recommended you upgrade to Python 2.3.2 or newer if you "
|
||||||
"intend to use Twisted's Jabber support.")
|
"intend to use Twisted's Jabber support.")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
import stringprep
|
import stringprep
|
||||||
|
@ -97,7 +97,7 @@ class EmptyMappingTable:
|
||||||
|
|
||||||
class Profile:
|
class Profile:
|
||||||
def __init__(self, mappings=[], normalize=True, prohibiteds=[],
|
def __init__(self, mappings=[], normalize=True, prohibiteds=[],
|
||||||
check_unassigneds=True, check_bidi=True):
|
check_unassigneds=True, check_bidi=True):
|
||||||
self.mappings = mappings
|
self.mappings = mappings
|
||||||
self.normalize = normalize
|
self.normalize = normalize
|
||||||
self.prohibiteds = prohibiteds
|
self.prohibiteds = prohibiteds
|
||||||
|
@ -183,10 +183,10 @@ class NamePrep:
|
||||||
|
|
||||||
# Prohibited characters.
|
# Prohibited characters.
|
||||||
prohibiteds = [unichr(n) for n in range(0x00, 0x2c + 1) +
|
prohibiteds = [unichr(n) for n in range(0x00, 0x2c + 1) +
|
||||||
range(0x2e, 0x2f + 1) +
|
range(0x2e, 0x2f + 1) +
|
||||||
range(0x3a, 0x40 + 1) +
|
range(0x3a, 0x40 + 1) +
|
||||||
range(0x5b, 0x60 + 1) +
|
range(0x5b, 0x60 + 1) +
|
||||||
range(0x7b, 0x7f + 1) ]
|
range(0x7b, 0x7f + 1) ]
|
||||||
|
|
||||||
def prepare(self, string):
|
def prepare(self, string):
|
||||||
result = []
|
result = []
|
||||||
|
@ -206,8 +206,8 @@ class NamePrep:
|
||||||
|
|
||||||
def check_prohibiteds(self, string):
|
def check_prohibiteds(self, string):
|
||||||
for c in string:
|
for c in string:
|
||||||
if c in self.prohibiteds:
|
if c in self.prohibiteds:
|
||||||
raise UnicodeError, "Invalid character %s" % repr(c)
|
raise UnicodeError, "Invalid character %s" % repr(c)
|
||||||
|
|
||||||
def nameprep(self, label):
|
def nameprep(self, label):
|
||||||
label = idna.nameprep(label)
|
label = idna.nameprep(label)
|
||||||
|
@ -221,16 +221,16 @@ class NamePrep:
|
||||||
if crippled:
|
if crippled:
|
||||||
case_map = MappingTableFromFunction(lambda c: c.lower())
|
case_map = MappingTableFromFunction(lambda c: c.lower())
|
||||||
nodeprep = Profile(mappings=[case_map],
|
nodeprep = Profile(mappings=[case_map],
|
||||||
normalize=False,
|
normalize=False,
|
||||||
prohibiteds=[LookupTable([u' ', u'"', u'&', u"'", u'/',
|
prohibiteds=[LookupTable([u' ', u'"', u'&', u"'", u'/',
|
||||||
u':', u'<', u'>', u'@'])],
|
u':', u'<', u'>', u'@'])],
|
||||||
check_unassigneds=False,
|
check_unassigneds=False,
|
||||||
check_bidi=False)
|
check_bidi=False)
|
||||||
|
|
||||||
resourceprep = Profile(normalize=False,
|
resourceprep = Profile(normalize=False,
|
||||||
check_unassigneds=False,
|
check_unassigneds=False,
|
||||||
check_bidi=False)
|
check_bidi=False)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
C_11 = LookupTableFromFunction(stringprep.in_table_c11)
|
C_11 = LookupTableFromFunction(stringprep.in_table_c11)
|
||||||
C_12 = LookupTableFromFunction(stringprep.in_table_c12)
|
C_12 = LookupTableFromFunction(stringprep.in_table_c12)
|
||||||
|
@ -251,10 +251,10 @@ else:
|
||||||
prohibiteds=[C_11, C_12, C_21, C_22,
|
prohibiteds=[C_11, C_12, C_21, C_22,
|
||||||
C_3, C_4, C_5, C_6, C_7, C_8, C_9,
|
C_3, C_4, C_5, C_6, C_7, C_8, C_9,
|
||||||
LookupTable([u'"', u'&', u"'", u'/',
|
LookupTable([u'"', u'&', u"'", u'/',
|
||||||
u':', u'<', u'>', u'@'])])
|
u':', u'<', u'>', u'@'])])
|
||||||
|
|
||||||
resourceprep = Profile(mappings=[B_1,],
|
resourceprep = Profile(mappings=[B_1,],
|
||||||
prohibiteds=[C_12, C_21, C_22,
|
prohibiteds=[C_12, C_21, C_22,
|
||||||
C_3, C_4, C_5, C_6, C_7, C_8, C_9])
|
C_3, C_4, C_5, C_6, C_7, C_8, C_9])
|
||||||
|
|
||||||
nameprep = NamePrep()
|
nameprep = NamePrep()
|
||||||
|
|
Loading…
Add table
Reference in a new issue