Univention Bugzilla – Attachment 10116 Details for
Bug 49060
Migrate to Python 3
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
suggested patch for UCR binary API
49060.patch (text/plain), 2.67 KB, created by
Florian Best
on 2019-07-11 15:09 CEST
(
hide
)
Description:
suggested patch for UCR binary API
Filename:
MIME Type:
Creator:
Florian Best
Created:
2019-07-11 15:09 CEST
Size:
2.67 KB
patch
obsolete
>diff --git a/base/univention-config-registry/python/univention/config_registry/frontend.py b/base/univention-config-registry/python/univention/config_registry/frontend.py >index d649e643ba..ec6edd66bb 100644 >--- a/base/univention-config-registry/python/univention/config_registry/frontend.py >+++ b/base/univention-config-registry/python/univention/config_registry/frontend.py >@@ -330,7 +330,7 @@ def handler_filter(args, opts=dict()): > """Run filter on STDIN to STDOUT.""" > ucr = ConfigRegistry() > ucr.load() >- sys.stdout.write(run_filter(sys.stdin.read(), ucr, opts=opts)) >+ os.write(sys.stdout.fileno(), run_filter(sys.stdin.read(), ucr, opts=opts)) > > > def handler_search(args, opts=dict()): >diff --git a/base/univention-config-registry/python/univention/config_registry/handler.py b/base/univention-config-registry/python/univention/config_registry/handler.py >index 90d4e27c39..97f226518f 100644 >--- a/base/univention-config-registry/python/univention/config_registry/handler.py >+++ b/base/univention-config-registry/python/univention/config_registry/handler.py >@@ -59,7 +59,7 @@ __all__ = ['ConfigHandlers'] > > VARIABLE_PATTERN = re.compile('@%@([^@]+)@%@') > VARIABLE_TOKEN = re.compile('@%@') >-EXECUTE_TOKEN = re.compile('@!@') >+EXECUTE_TOKEN = re.compile(b'@!@') > WARNING_PATTERN = re.compile('(UCRWARNING|BCWARNING|UCRWARNING_ASCII)=(.+)') > > INFO_DIR = '/etc/univention/templates/info' >@@ -89,6 +89,8 @@ def run_filter(template, directory, srcfiles=set(), opts=dict()): > :param opts: UNUSED. > :returns: The modified template with all UCR variables and sections replaced. > """ >+ if isinstance(template, bytes): >+ template = template.decode('utf-8') > while True: > i = VARIABLE_TOKEN.finditer(template) > try: >@@ -115,6 +117,7 @@ def run_filter(template, directory, srcfiles=set(), opts=dict()): > except StopIteration: > break > >+ template = template.encode('utf-8') > while True: > i = EXECUTE_TOKEN.finditer(template) > try: >@@ -124,8 +127,9 @@ def run_filter(template, directory, srcfiles=set(), opts=dict()): > proc = subprocess.Popen( > (sys.executable,), > stdin=subprocess.PIPE, stdout=subprocess.PIPE, >- close_fds=True, universal_newlines=True) >- value = proc.communicate('''\ >+ close_fds=True) >+ content = template[start.end():end.start()] >+ content = b'''\ > # -*- coding: utf-8 -*- > import univention.config_registry > configRegistry = univention.config_registry.ConfigRegistry() >@@ -133,7 +137,8 @@ configRegistry.load() > # for compatibility > baseConfig = configRegistry > %s >-''' % template[start.end():end.start()])[0] >+''' % (content,) >+ value = proc.communicate(content)[0] > template = template[:start.start()] + value + template[end.end():] > > except StopIteration:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 49060
: 10116 |
10256