[RFC} HTML lang attribute in ISO 639-1
by Samuel Henrique De Oliveira Guimaraes
Hi,
I'm noticing that some elements are collapsing or having weird width values in certain languages. A solution for this would be changing the element width with SCSS/CSS based on the HTML lang attribute.
For now I'm just going to use the lang values that Wok sets today but I suggest we stick with ISO 639-1 for accessibility reasons. If the browser can't detect the language it will "think" that the content is in English:
http://www.w3schools.com/tags/ref_language_codes.asp
Regards,
Samuel
8 years, 4 months
[PATCH] [Wok] Minor change in Wok Drop-Downs to fix text alignment with different icons and locales
by sguimaraes943@gmail.com
From: Samuel Guimarães <sguimaraes943(a)gmail.com>
This patch adds a new CSS rule to allow Font Awesome icons in Wok drop-down menus.
Samuel Guimarães (1):
Minor change in Wok Drop-Downs to fix text alignment with different
icons and locales
ui/css/src/modules/_menu-flat.scss | 10 ++++++++--
ui/css/wok.css | 10 ++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
--
2.5.5
8 years, 4 months
[PATCH] [Kimchi] Updated serial console to support s390x architecture.
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
On s390x architecture, serial console differ from
x86. Added code to support s390x architecture.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
xmlutils/serial.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/xmlutils/serial.py b/xmlutils/serial.py
index 99b1e90..c823ee6 100644
--- a/xmlutils/serial.py
+++ b/xmlutils/serial.py
@@ -36,6 +36,11 @@ def get_serial_xml(params):
<target type='serial' port='1'/>
<address type='spapr-vio' reg='0x30001000'/>
</console>
+
+ For s390x
+ <console type='pty'>
+ <target type='sclp' port='0'/>
+ </console>
"""
# pcc serial console
if params["arch"] in ["ppc", "ppc64"]:
@@ -43,7 +48,11 @@ def get_serial_xml(params):
console.append(E.target(type="serial", port='1'))
console.append(E.address(type="spapr-vio", reg="0x30001000"))
return ET.tostring(console, encoding='utf-8', pretty_print=True)
-
+ # for s390x
+ elif params["arch"] in ["s390x"]:
+ console = E.console(type="pty")
+ console.append(E.target(type="sclp", port='0'))
+ return ET.tostring(console, encoding='utf-8', pretty_print=True)
# for x
else:
serial = E.serial(type="pty")
--
2.7.4
8 years, 4 months
[PATCH] [Kimchi 0/2] s390x architecture based changes
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
1) On s390x machine, guestfs is not supported, hence made the change
in imageinfo.py to return unknown as distro and version on import error
of guestfs.
2) On s390x machine, scan cannot use El Torito boot specification.
Hence for now set bootable as True till we don't get the way to scan
on s390x.
Archana Singh (2):
Modified code, to return distro and version as unknown, if guestfs
import failed.
s390x based architecture changes.
imageinfo.py | 10 ++++++----
isoinfo.py | 10 ++++++++++
2 files changed, 16 insertions(+), 4 deletions(-)
--
2.7.4
8 years, 4 months
[PATCH] [Kimchi 1/3] Added s390x architecture support in osinfo params.
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
1) Added s390x in SUPPORTED_ARCHS.
2) Added memory devices slot limits for s390x.
3) Added template_spec for s390x.
4) Added arch check to add old template spec in params
and no need to do modern_version_bases check as for
s390x as template specs are same for all version.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
osinfo.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/osinfo.py b/osinfo.py
index a3c2b0e..fcdb0fe 100644
--- a/osinfo.py
+++ b/osinfo.py
@@ -31,7 +31,8 @@ from wok.plugins.kimchi.config import kimchiPaths
SUPPORTED_ARCHS = {'x86': ('i386', 'i686', 'x86_64'),
'power': ('ppc', 'ppc64'),
- 'ppc64le': ('ppc64le')}
+ 'ppc64le': ('ppc64le'),
+ 's390x': ('s390x')}
# Memory devices slot limits by architecture
@@ -39,7 +40,8 @@ MEM_DEV_SLOTS = {'ppc64': 256,
'ppc64le': 256,
'x86_64': 256,
'i686': 256,
- 'i386': 256}
+ 'i386': 256,
+ 's390x': 256}
template_specs = {'x86': {'old': dict(disk_bus='ide',
@@ -71,7 +73,11 @@ template_specs = {'x86': {'old': dict(disk_bus='ide',
kbd_bus='usb',
kbd_type="keyboard",
mouse_bus='usb',
- tablet_bus='usb')}}
+ tablet_bus='usb')},
+ 's390x': {'old': dict(disk_bus='virtio',
+ nic_model='virtio', cdrom_bus='scsi'),
+ 'modern': dict(disk_bus='virtio',
+ nic_model='virtio', cdrom_bus='scsi')}}
custom_specs = {'fedora': {'22': {'x86': dict(video_model='qxl')}}}
@@ -218,8 +224,10 @@ def lookup(distro, version):
# set up arch to ppc64 instead of ppc64le due to libvirt compatibility
if params["arch"] == "ppc64le":
params["arch"] = "ppc64"
-
- if distro in modern_version_bases[arch]:
+ # On s390x, template spec does not change based on version.
+ if params["arch"] == "s390x":
+ params.update(template_specs[arch]['old'])
+ elif distro in modern_version_bases[arch]:
if LooseVersion(version) >= LooseVersion(
modern_version_bases[arch][distro]):
params.update(template_specs[arch]['modern'])
--
2.7.4
8 years, 4 months
[PATCH] [Kimchi] Added s390x architecture support.
by archus@linux.vnet.ibm.com
From: Archana Singh <archus(a)linux.vnet.ibm.com>
1) Added s390x in SUPPORTED_ARCHS.
2) Added memory devices slot limits for s390x.
3) Added template_spec for s390x.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
osinfo.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/osinfo.py b/osinfo.py
index a3c2b0e..f7cdb2e 100644
--- a/osinfo.py
+++ b/osinfo.py
@@ -31,7 +31,8 @@ from wok.plugins.kimchi.config import kimchiPaths
SUPPORTED_ARCHS = {'x86': ('i386', 'i686', 'x86_64'),
'power': ('ppc', 'ppc64'),
- 'ppc64le': ('ppc64le')}
+ 'ppc64le': ('ppc64le'),
+ 's390x': ('s390x')}
# Memory devices slot limits by architecture
@@ -39,7 +40,8 @@ MEM_DEV_SLOTS = {'ppc64': 256,
'ppc64le': 256,
'x86_64': 256,
'i686': 256,
- 'i386': 256}
+ 'i386': 256,
+ 's390x': 256}
template_specs = {'x86': {'old': dict(disk_bus='ide',
@@ -71,7 +73,11 @@ template_specs = {'x86': {'old': dict(disk_bus='ide',
kbd_bus='usb',
kbd_type="keyboard",
mouse_bus='usb',
- tablet_bus='usb')}}
+ tablet_bus='usb')},
+ 's390x': {'old': dict(disk_bus='virtio',
+ nic_model='virtio', cdrom_bus='scsi'),
+ 'modern': dict(disk_bus='virtio',
+ nic_model='virtio', cdrom_bus='scsi')}}
custom_specs = {'fedora': {'22': {'x86': dict(video_model='qxl')}}}
--
2.7.4
8 years, 4 months
[PATCH V2] [Wok 0/4] Fix issue #142
by Lucio Correia
In order to run tests successfully, remove your data/logs/wok-req.log.
I will send fix for issue #140 in a separate patchset.
Lucio Correia (4):
Add option to get untranslated message text
Log message code and parameters instead of translated text
Fix issue with converting message to unicode
Update tests
src/wok/control/base.py | 13 ++++++-------
src/wok/message.py | 32 ++++++++++++++++++--------------
src/wok/reqlogger.py | 47 ++++++++++++++++++++++++++++++++++++++---------
src/wok/root.py | 12 ++++++------
tests/test_api.py | 2 +-
5 files changed, 69 insertions(+), 37 deletions(-)
--
1.9.1
8 years, 4 months
[RFC] Issue #585: 'make clean' does not revert its changes from 'make rpm'
by Bianca Carvalho
Reproducing the issue locally, when I run 'make rpm' and 'git status'
the following files are listed:
modified: ChangeLog
modified: po/de_DE.po
modified: po/en_US.po
modified: po/es_ES.po
modified: po/fr_FR.po
modified: po/it_IT.po
modified: po/ja_JP.po
modified: po/kimchi.pot
modified: po/ko_KR.po
modified: po/pt_BR.po
modified: po/ru_RU.po
modified: po/zh_CN.po
modified: po/zh_TW.po
To solve that problem, there are two possible solutions:
1- Files changed at runtime will have the following format:
- For example: ChangeLog, I will keep a tracked one at
ChangeLog.am, and the file generate by make command, ChangeLog, will not
be tracked (and be added to .gitignore).
2- include following command to Makefile.am: git clean -df & git reset
--hard, to remove untracked files from the working tree and to revert
files changes.
I would like to make sure which one (or any other solution) would be the
best in this case and why not use any of them.
Thanks,
Bianca
8 years, 4 months
[PATCH] [Wok 0/4] Fix issues #140 and #142
by Lucio Correia
In order to run tests successfully, remove your data/logs/wok-req.log.
DEPENDS ON: [Wok] Isolate string utils in order to avoid cyclic import
Lucio Correia (4):
Add option to get untranslated message text
Log message code and parameters instead of translated text
Fix issue with converting message to unicode
Update tests
src/wok/control/base.py | 13 ++++++-------
src/wok/message.py | 32 ++++++++++++++++++--------------
src/wok/reqlogger.py | 47 ++++++++++++++++++++++++++++++++++++++---------
src/wok/root.py | 12 ++++++------
tests/test_api.py | 2 +-
5 files changed, 69 insertions(+), 37 deletions(-)
--
1.9.1
8 years, 4 months
[PATCH] [Wok] Isolate string utils in order to avoid cyclic import
by Lucio Correia
These functions are basic ones but were not able to be
imported from message.py since other functions in utils
were causing cyclic imports. Isolate it to avoid that
problem.
Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
---
src/wok/control/base.py | 3 +-
src/wok/reqlogger.py | 3 +-
src/wok/stringutils.py | 154 ++++++++++++++++++++++++++++++++++++++++++++++++
src/wok/utils.py | 136 +-----------------------------------------
4 files changed, 159 insertions(+), 137 deletions(-)
create mode 100644 src/wok/stringutils.py
IMPORTANT: apply this along with ginger and gingerbase patches.
diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index 69541b1..6dfc977 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -33,7 +33,8 @@ from wok.control.utils import validate_params
from wok.exception import InvalidOperation, UnauthorizedError, WokException
from wok.message import WokMessage
from wok.reqlogger import RequestRecord
-from wok.utils import get_plugin_from_request, utf8_dict, wok_log, encode_value
+from wok.stringutils import encode_value, utf8_dict
+from wok.utils import get_plugin_from_request, wok_log
# Default request log messages
diff --git a/src/wok/reqlogger.py b/src/wok/reqlogger.py
index 8fadbcf..fd02382 100644
--- a/src/wok/reqlogger.py
+++ b/src/wok/reqlogger.py
@@ -30,7 +30,8 @@ from tempfile import NamedTemporaryFile
from wok.config import config, get_log_download_path
from wok.exception import InvalidParameter, OperationFailed
-from wok.utils import ascii_dict, remove_old_files
+from wok.stringutils import ascii_dict
+from wok.utils import remove_old_files
# Log search setup
diff --git a/src/wok/stringutils.py b/src/wok/stringutils.py
new file mode 100644
index 0000000..8f0160b
--- /dev/null
+++ b/src/wok/stringutils.py
@@ -0,0 +1,154 @@
+#
+# Project Wok
+#
+# Copyright IBM Corp, 2016
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import copy
+import locale
+
+
+def ascii_dict(base, overlay=None):
+ result = copy.deepcopy(base)
+ result.update(overlay or {})
+
+ for key, value in result.iteritems():
+ if isinstance(value, unicode):
+ result[key] = str(value.decode('utf-8'))
+
+ return result
+
+
+def utf8_dict(base, overlay=None):
+ result = copy.deepcopy(base)
+ result.update(overlay or {})
+
+ for key, value in result.iteritems():
+ if isinstance(value, unicode):
+ result[key] = value.encode('utf-8')
+
+ return result
+
+
+def encode_value(val):
+ """
+ Convert the value to string.
+ If its unicode, use encode otherwise str.
+ """
+ if isinstance(val, unicode):
+ return val.encode('utf-8')
+ return str(val)
+
+
+def decode_value(val):
+ """
+ Converts value to unicode,
+ if its not an instance of unicode.
+ For doing so convert the val to string,
+ if its not instance of basestring.
+ """
+ if not isinstance(val, basestring):
+ val = str(val)
+ if not isinstance(val, unicode):
+ val = val.decode('utf-8')
+ return val
+
+
+def formatMeasurement(number, settings):
+ '''
+ Refer to "Units of information" (
+ http://en.wikipedia.org/wiki/Units_of_information
+ ) for more information about measurement units.
+
+ @param number The number to be normalized.
+ @param settings
+ base Measurement base, accepts 2 or 10. defaults to 2.
+ unit The unit of the measurement, e.g., B, Bytes/s, bps, etc.
+ fixed The number of digits after the decimal point.
+ locale The locale for formating the number if not passed
+ format is done as per current locale.
+ @returns [object]
+ v The number part of the measurement.
+ s The suffix part of the measurement including multiple and unit.
+ e.g., kB/s means 1000B/s, KiB/s for 1024B/s.
+ '''
+ unitBaseMapping = {2: [{"us": 'Ki', "v": 1024},
+ {"us": 'Mi', "v": 1048576},
+ {"us": 'Gi', "v": 1073741824},
+ {"us": 'Ti', "v": 1099511627776},
+ {"us": 'Pi', "v": 1125899906842624}],
+ 10: [{"us": 'k', "v": 1000},
+ {"us": 'M', "v": 1000000},
+ {"us": 'G', "v": 1000000000},
+ {"us": 'T', "v": 1000000000000},
+ {"us": 'P', "v": 1000000000000000}]}
+
+ if(not number):
+ return number
+ settings = settings or {}
+ unit = settings['unit'] if 'unit' in settings else 'B'
+ base = settings['base'] if 'base' in settings else 2
+
+ new_locale = settings['locale'] if 'locale' in settings else ''
+
+ if(base != 2 and base != 10):
+ return encode_value(number) + unit
+
+ fixed = settings['fixed']
+
+ unitMapping = unitBaseMapping[base]
+ for mapping in reversed(unitMapping):
+ suffix = mapping['us']
+ startingValue = mapping['v']
+ if(number < startingValue):
+ continue
+
+ formatted = float(number) / startingValue
+ formatted = formatNumber(formatted, fixed, new_locale)
+ return formatted + suffix + unit
+
+ formatted_number = formatNumber(number, fixed, new_locale)
+ return formatted_number+unit
+
+
+def formatNumber(number, fixed, format_locale):
+ '''
+ Format the number based on format_locale passed.
+ '''
+
+ # get the current locale
+ current_locale = locale.getlocale()
+ new_locale = ''
+ # set passed locale and set new_locale to same value.
+ if format_locale:
+ new_locale = locale.setlocale(locale.LC_ALL, format_locale)
+
+ # Based on type of number use the correct formatter
+ if isinstance(number, float):
+ if fixed:
+ formatted = locale.format('%' + '.%df' % fixed, number, True)
+ else:
+ formatted = locale.format('%f', number, True)
+ if isinstance(number, int):
+ formatted = locale.format('%d', number, True)
+ # After formatting is done as per locale, reset the locale if changed.
+ if (new_locale and not current_locale[0] and not current_locale[1]):
+ locale.setlocale(locale.LC_ALL, 'C')
+ elif (new_locale):
+ locale.setlocale(locale.LC_ALL, current_locale[0] + "." +
+ current_locale[1])
+
+ return formatted
diff --git a/src/wok/utils.py b/src/wok/utils.py
index c78a77a..d6bdf0a 100644
--- a/src/wok/utils.py
+++ b/src/wok/utils.py
@@ -21,7 +21,6 @@
#
import cherrypy
-import copy
import glob
import grp
import os
@@ -33,7 +32,6 @@ import subprocess
import sys
import traceback
import xml.etree.ElementTree as ET
-import locale
from cherrypy.lib.reprconf import Parser
from datetime import datetime, timedelta
@@ -43,6 +41,7 @@ from threading import Timer
from wok.asynctask import AsyncTask
from wok.config import paths, PluginPaths
from wok.exception import InvalidParameter, TimeoutExpired
+from wok.stringutils import decode_value
wok_log = cherrypy.log.error_log
@@ -137,28 +136,6 @@ def get_plugin_from_request():
return 'wok'
-def ascii_dict(base, overlay=None):
- result = copy.deepcopy(base)
- result.update(overlay or {})
-
- for key, value in result.iteritems():
- if isinstance(value, unicode):
- result[key] = str(value.decode('utf-8'))
-
- return result
-
-
-def utf8_dict(base, overlay=None):
- result = copy.deepcopy(base)
- result.update(overlay or {})
-
- for key, value in result.iteritems():
- if isinstance(value, unicode):
- result[key] = value.encode('utf-8')
-
- return result
-
-
def import_class(class_path):
module_name, class_name = class_path.rsplit('.', 1)
try:
@@ -610,114 +587,3 @@ def upgrade_objectstore_schema(objstore=None, field=None):
wok_log.error("Cannot upgrade objectstore schema: %s" % e.args[0])
return False
return True
-
-
-def encode_value(val):
- """
- Convert the value to string.
- If its unicode, use encode otherwise str.
- """
- if isinstance(val, unicode):
- return val.encode('utf-8')
- return str(val)
-
-
-def decode_value(val):
- """
- Converts value to unicode,
- if its not an instance of unicode.
- For doing so convert the val to string,
- if its not instance of basestring.
- """
- if not isinstance(val, basestring):
- val = str(val)
- if not isinstance(val, unicode):
- val = val.decode('utf-8')
- return val
-
-
-def formatMeasurement(number, settings):
- '''
- Refer to "Units of information" (
- http://en.wikipedia.org/wiki/Units_of_information
- ) for more information about measurement units.
-
- @param number The number to be normalized.
- @param settings
- base Measurement base, accepts 2 or 10. defaults to 2.
- unit The unit of the measurement, e.g., B, Bytes/s, bps, etc.
- fixed The number of digits after the decimal point.
- locale The locale for formating the number if not passed
- format is done as per current locale.
- @returns [object]
- v The number part of the measurement.
- s The suffix part of the measurement including multiple and unit.
- e.g., kB/s means 1000B/s, KiB/s for 1024B/s.
- '''
- unitBaseMapping = {2: [{"us": 'Ki', "v": 1024},
- {"us": 'Mi', "v": 1048576},
- {"us": 'Gi', "v": 1073741824},
- {"us": 'Ti', "v": 1099511627776},
- {"us": 'Pi', "v": 1125899906842624}],
- 10: [{"us": 'k', "v": 1000},
- {"us": 'M', "v": 1000000},
- {"us": 'G', "v": 1000000000},
- {"us": 'T', "v": 1000000000000},
- {"us": 'P', "v": 1000000000000000}]}
-
- if(not number):
- return number
- settings = settings or {}
- unit = settings['unit'] if 'unit' in settings else 'B'
- base = settings['base'] if 'base' in settings else 2
-
- new_locale = settings['locale'] if 'locale' in settings else ''
-
- if(base != 2 and base != 10):
- return encode_value(number) + unit
-
- fixed = settings['fixed']
-
- unitMapping = unitBaseMapping[base]
- for mapping in reversed(unitMapping):
- suffix = mapping['us']
- startingValue = mapping['v']
- if(number < startingValue):
- continue
-
- formatted = float(number) / startingValue
- formatted = formatNumber(formatted, fixed, new_locale)
- return formatted + suffix + unit
-
- formatted_number = formatNumber(number, fixed, new_locale)
- return formatted_number+unit
-
-
-def formatNumber(number, fixed, format_locale):
- '''
- Format the number based on format_locale passed.
- '''
-
- # get the current locale
- current_locale = locale.getlocale()
- new_locale = ''
- # set passed locale and set new_locale to same value.
- if format_locale:
- new_locale = locale.setlocale(locale.LC_ALL, format_locale)
-
- # Based on type of number use the correct formatter
- if isinstance(number, float):
- if fixed:
- formatted = locale.format('%' + '.%df' % fixed, number, True)
- else:
- formatted = locale.format('%f', number, True)
- if isinstance(number, int):
- formatted = locale.format('%d', number, True)
- # After formatting is done as per locale, reset the locale if changed.
- if (new_locale and not current_locale[0] and not current_locale[1]):
- locale.setlocale(locale.LC_ALL, 'C')
- elif (new_locale):
- locale.setlocale(locale.LC_ALL, current_locale[0] + "." +
- current_locale[1])
-
- return formatted
--
1.9.1
8 years, 4 months