misc: get StringIO from six (#36515)
This commit is contained in:
parent
a7844cf7ca
commit
268d68afa9
|
@ -7,7 +7,6 @@ import logging
|
|||
import os
|
||||
import re
|
||||
import shutil
|
||||
import StringIO
|
||||
import tarfile
|
||||
import urlparse
|
||||
import time
|
||||
|
@ -23,6 +22,8 @@ import pytest
|
|||
from webtest import Upload
|
||||
import mock
|
||||
|
||||
from django.utils.six import StringIO
|
||||
|
||||
from quixote import cleanup, get_publisher
|
||||
from quixote.http_request import Upload as QuixoteUpload
|
||||
|
||||
|
@ -930,7 +931,7 @@ def test_form_export(pub):
|
|||
resp = resp.click(href='export')
|
||||
xml_export = resp.body
|
||||
|
||||
fd = StringIO.StringIO(xml_export)
|
||||
fd = StringIO(xml_export)
|
||||
formdef2 = FormDef.import_from_xml(fd)
|
||||
assert formdef2.name == 'form title'
|
||||
|
||||
|
@ -1910,7 +1911,7 @@ def test_form_archive(pub):
|
|||
resp = resp.click(href='archive')
|
||||
resp = resp.form.submit('submit')
|
||||
assert resp.content_type == 'application/x-wcs-archive'
|
||||
tf = tarfile.open(fileobj=StringIO.StringIO(resp.body))
|
||||
tf = tarfile.open(fileobj=StringIO(resp.body))
|
||||
assert 'formdef' in [x.name for x in tf.getmembers()]
|
||||
assert len(tf.getmembers()) == 8 # 7 formdata + 1 formdef
|
||||
|
||||
|
@ -1919,7 +1920,7 @@ def test_form_archive(pub):
|
|||
resp = resp.click(href='archive')
|
||||
resp = resp.form.submit('submit')
|
||||
assert resp.content_type == 'application/x-wcs-archive'
|
||||
tf = tarfile.open(fileobj=StringIO.StringIO(resp.body))
|
||||
tf = tarfile.open(fileobj=StringIO(resp.body))
|
||||
assert 'formdef' in [x.name for x in tf.getmembers()]
|
||||
assert len(tf.getmembers()) == 1 # 0 formdata + 1 formdef
|
||||
|
||||
|
@ -4185,7 +4186,7 @@ def test_settings_export_import(pub, studio):
|
|||
resp = resp.follow()
|
||||
assert 'completed' in resp.body
|
||||
resp = resp.click('Download Export')
|
||||
zip_content = StringIO.StringIO(resp.body)
|
||||
zip_content = StringIO(resp.body)
|
||||
zipf = zipfile.ZipFile(zip_content, 'a')
|
||||
filelist = zipf.namelist()
|
||||
assert len(filelist) == 0
|
||||
|
@ -4211,7 +4212,7 @@ def test_settings_export_import(pub, studio):
|
|||
export_to.label = 'test'
|
||||
upload = QuixoteUpload('/foo/bar', content_type='application/vnd.oasis.opendocument.text')
|
||||
file_content = '''PK\x03\x04\x14\x00\x00\x08\x00\x00\'l\x8eG^\xc62\x0c\'\x00'''
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write(file_content)
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile('models', 'export_to_model-1.upload', upload)
|
||||
|
@ -4225,7 +4226,7 @@ def test_settings_export_import(pub, studio):
|
|||
job_id = urlparse.parse_qs(urlparse.urlparse(resp.location).query)['job'][0]
|
||||
resp = resp.follow()
|
||||
resp = resp.click('Download Export')
|
||||
zip_content = StringIO.StringIO(resp.body)
|
||||
zip_content = StringIO(resp.body)
|
||||
zipf = zipfile.ZipFile(zip_content, 'a')
|
||||
filelist = zipf.namelist()
|
||||
assert 'formdefs/1' not in filelist
|
||||
|
@ -4299,7 +4300,7 @@ def test_settings_export_import(pub, studio):
|
|||
job_id = urlparse.parse_qs(urlparse.urlparse(resp.location).query)['job'][0]
|
||||
resp = resp.follow()
|
||||
resp = resp.click('Download Export')
|
||||
zip_content = StringIO.StringIO(resp.body)
|
||||
zip_content = StringIO(resp.body)
|
||||
zipf = zipfile.ZipFile(zip_content, 'a')
|
||||
filelist = zipf.namelist()
|
||||
assert 'formdefs_xml/%s' % formdef.id in filelist
|
||||
|
@ -4332,7 +4333,7 @@ def test_settings_export_import(pub, studio):
|
|||
job_id = urlparse.parse_qs(urlparse.urlparse(resp.location).query)['job'][0]
|
||||
resp = resp.follow()
|
||||
resp = resp.click('Download Export')
|
||||
zip_content = StringIO.StringIO(resp.body)
|
||||
zip_content = StringIO(resp.body)
|
||||
zipf = zipfile.ZipFile(zip_content, 'a')
|
||||
filelist = zipf.namelist()
|
||||
assert len([x for x in filelist if 'roles/' in x]) == 0
|
||||
|
@ -5233,7 +5234,7 @@ def test_settings_theme_download_upload(pub):
|
|||
resp = app.get('/backoffice/settings/themes')
|
||||
resp = resp.click('download', index=0)
|
||||
assert resp.headers['content-type'] == 'application/zip'
|
||||
zip_content = StringIO.StringIO(resp.body)
|
||||
zip_content = StringIO(resp.body)
|
||||
zipf = zipfile.ZipFile(zip_content, 'a')
|
||||
filelist = zipf.namelist()
|
||||
assert 'alto/icon.png' in filelist
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from StringIO import StringIO
|
||||
import pytest
|
||||
import json
|
||||
import shutil
|
||||
|
@ -17,6 +16,7 @@ import time
|
|||
import json
|
||||
import sys
|
||||
|
||||
from django.utils.six import StringIO
|
||||
from quixote import cleanup, get_publisher
|
||||
from wcs.qommon.http_request import HTTPRequest
|
||||
from wcs.qommon.form import PicklableUpload
|
||||
|
|
|
@ -4,7 +4,6 @@ import json
|
|||
import os
|
||||
import re
|
||||
import shutil
|
||||
import StringIO
|
||||
import time
|
||||
import hashlib
|
||||
import random
|
||||
|
@ -21,6 +20,7 @@ try:
|
|||
except ImportError:
|
||||
xlwt = None
|
||||
|
||||
from django.utils.six import StringIO
|
||||
from quixote import cleanup, get_publisher
|
||||
from wcs.qommon import ods
|
||||
from wcs.api_utils import sign_url
|
||||
|
@ -910,7 +910,7 @@ def test_backoffice_ods(pub):
|
|||
assert 'filename=form-title.ods' in resp.headers['content-disposition']
|
||||
assert resp.body[:2] == 'PK' # ods has a zip container
|
||||
|
||||
zipf = zipfile.ZipFile(StringIO.StringIO(resp.body))
|
||||
zipf = zipfile.ZipFile(StringIO(resp.body))
|
||||
ods_sheet = ET.parse(zipf.open('content.xml'))
|
||||
# check the ods contains a link to the document
|
||||
elem = ods_sheet.findall('.//{%s}a' % ods.NS['text'])[0]
|
||||
|
@ -2963,7 +2963,7 @@ def test_backoffice_wfedit_and_data_source_with_user_info(pub):
|
|||
data = {'data': [{'id': 'A', 'text': 'hello'}, {'id': 'B', 'text': 'world'}]}
|
||||
def side_effect(url, *args):
|
||||
assert '?name_id=admin' in url
|
||||
return StringIO.StringIO(json.dumps(data))
|
||||
return StringIO(json.dumps(data))
|
||||
|
||||
urlopen.side_effect = side_effect
|
||||
|
||||
|
@ -4088,9 +4088,9 @@ def test_backoffice_workflow_form_with_live_data_source(pub):
|
|||
data2 = {'data': [{'id': 'C', 'text': 'hello'}, {'id': 'D', 'text': 'world'}]}
|
||||
def side_effect(url, *args):
|
||||
if 'toto' not in url:
|
||||
return StringIO.StringIO(json.dumps(data1))
|
||||
return StringIO(json.dumps(data1))
|
||||
else:
|
||||
return StringIO.StringIO(json.dumps(data2))
|
||||
return StringIO(json.dumps(data2))
|
||||
urlopen.side_effect = side_effect
|
||||
|
||||
resp = login(app).get(formdata.get_url(backoffice=True))
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import email
|
||||
import StringIO
|
||||
|
||||
from wcs.ctl.process_bounce import CmdProcessBounce
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import os
|
||||
import pickle
|
||||
import shutil
|
||||
from cStringIO import StringIO
|
||||
|
||||
import pytest
|
||||
|
||||
from django.utils.six import StringIO
|
||||
from quixote import cleanup
|
||||
from wcs import publisher
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from cStringIO import StringIO
|
||||
import pytest
|
||||
import os
|
||||
import json
|
||||
|
@ -7,6 +6,7 @@ import sys
|
|||
import shutil
|
||||
import urlparse
|
||||
|
||||
from django.utils.six import StringIO
|
||||
from quixote import cleanup
|
||||
from wcs import publisher
|
||||
from wcs.qommon.http_request import HTTPRequest
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import datetime
|
||||
import pytest
|
||||
import os
|
||||
from StringIO import StringIO
|
||||
|
||||
from django.utils.six import StringIO
|
||||
from quixote import cleanup
|
||||
from wcs.qommon.ezt import (Template, UnclosedBlocksError, UnmatchedEndError,
|
||||
UnmatchedElseError, ArgCountSyntaxError, _re_parse)
|
||||
|
|
|
@ -6,7 +6,6 @@ import pytest
|
|||
import hashlib
|
||||
import os
|
||||
import re
|
||||
import StringIO
|
||||
import time
|
||||
from urlparse import urlparse
|
||||
import zipfile
|
||||
|
@ -19,6 +18,7 @@ try:
|
|||
except ImportError:
|
||||
Image = None
|
||||
|
||||
from django.utils.six import StringIO
|
||||
from quixote.http_request import Upload as QuixoteUpload
|
||||
from django.utils.encoding import force_text
|
||||
from wcs.qommon.emails import docutils
|
||||
|
@ -2559,7 +2559,7 @@ def test_form_page_formula_prefill_items_field(pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
assert not resp.form['f0$element1'].checked
|
||||
assert resp.form['f0$element2'].checked
|
||||
|
@ -3152,7 +3152,7 @@ def test_formdata_generated_document_download(pub):
|
|||
export_to.convert_to_pdf = False
|
||||
export_to.label = 'create doc'
|
||||
upload = QuixoteUpload('/foo/test.rtf', content_type='application/rtf')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write('HELLO WORLD')
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3200,7 +3200,7 @@ def test_formdata_generated_document_download(pub):
|
|||
# change export model to now be a RTF file, do the action again on the same form and
|
||||
# check that both the old .odt file and the new .rtf file are there and valid.
|
||||
upload = QuixoteUpload('/foo/test.rtf', content_type='application/rtf')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write('HELLO NEW WORLD')
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3216,7 +3216,7 @@ def test_formdata_generated_document_download(pub):
|
|||
|
||||
# use substitution variables on rtf: only ezt format is accepted
|
||||
upload = QuixoteUpload('/foo/test.rtf', content_type='application/rtf')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write('HELLO {{DJANGO}} WORLD [form_name]')
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3244,7 +3244,7 @@ def test_formdata_generated_document_odt_download(pub, odt_template):
|
|||
template_filename = os.path.join(os.path.dirname(__file__), odt_template)
|
||||
template = open(template_filename).read()
|
||||
upload = QuixoteUpload('/foo/' + odt_template, content_type='application/octet-stream')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write(template)
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3275,7 +3275,7 @@ def test_formdata_generated_document_odt_download(pub, odt_template):
|
|||
resp = resp.follow() # $form/$id/create_doc
|
||||
resp = resp.follow() # $form/$id/create_doc/
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template-out.odt')) as f:
|
||||
assert_equal_zip(StringIO.StringIO(resp.body), f)
|
||||
assert_equal_zip(StringIO(resp.body), f)
|
||||
|
||||
resp = login(get_app(pub), username='foo', password='foo').get(form_location)
|
||||
resp = resp.form.submit('button_export_to')
|
||||
|
@ -3302,11 +3302,11 @@ def test_formdata_generated_document_odt_download(pub, odt_template):
|
|||
resp = resp.follow()
|
||||
assert resp.content_type == 'application/octet-stream'
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template-out.odt')) as f:
|
||||
assert_equal_zip(StringIO.StringIO(resp.body), f)
|
||||
assert_equal_zip(StringIO(resp.body), f)
|
||||
|
||||
# change file content, same name
|
||||
upload = QuixoteUpload('/foo/test.rtf', content_type='application/rtf')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write('HELLO NEW WORLD')
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3319,7 +3319,7 @@ def test_formdata_generated_document_odt_download(pub, odt_template):
|
|||
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template-out.odt')) as f:
|
||||
body = resp.click(odt_template, index=0).follow().body
|
||||
assert_equal_zip(StringIO.StringIO(body), f)
|
||||
assert_equal_zip(StringIO(body), f)
|
||||
assert resp.click('test.rtf', index=0).follow().body == 'HELLO NEW WORLD'
|
||||
|
||||
def test_formdata_generated_document_odt_download_with_substitution_variable(pub):
|
||||
|
@ -3333,7 +3333,7 @@ def test_formdata_generated_document_odt_download_with_substitution_variable(pub
|
|||
template_filename = os.path.join(os.path.dirname(__file__), 'template.odt')
|
||||
template = open(template_filename).read()
|
||||
upload = QuixoteUpload('/foo/template.odt', content_type='application/octet-stream')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write(template)
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3364,7 +3364,7 @@ def test_formdata_generated_document_odt_download_with_substitution_variable(pub
|
|||
resp = resp.follow() # $form/$id/create_doc
|
||||
resp = resp.follow() # $form/$id/create_doc/
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template-out.odt')) as f:
|
||||
assert_equal_zip(StringIO.StringIO(resp.body), f)
|
||||
assert_equal_zip(StringIO(resp.body), f)
|
||||
|
||||
export_to.attach_to_history = True
|
||||
wf.store()
|
||||
|
@ -3379,11 +3379,11 @@ def test_formdata_generated_document_odt_download_with_substitution_variable(pub
|
|||
response1 = resp = resp.follow()
|
||||
assert resp.content_type == 'application/octet-stream'
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template-out.odt')) as f:
|
||||
assert_equal_zip(StringIO.StringIO(resp.body), f)
|
||||
assert_equal_zip(StringIO(resp.body), f)
|
||||
|
||||
# change file content, same name
|
||||
upload = QuixoteUpload('/foo/test.rtf', content_type='application/rtf')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write('HELLO NEW WORLD')
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3396,7 +3396,7 @@ def test_formdata_generated_document_odt_download_with_substitution_variable(pub
|
|||
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template-out.odt')) as f:
|
||||
body = resp.click('template.odt', index=0).follow().body
|
||||
assert_equal_zip(StringIO.StringIO(body), f)
|
||||
assert_equal_zip(StringIO(body), f)
|
||||
response2 = resp.click('test.rtf', index=0).follow()
|
||||
assert response2.body == 'HELLO NEW WORLD'
|
||||
# Test attachment substitution variables
|
||||
|
@ -3451,7 +3451,7 @@ def test_formdata_generated_document_odt_to_pdf_download(pub):
|
|||
template_filename = os.path.join(os.path.dirname(__file__), 'template.odt')
|
||||
template = open(template_filename).read()
|
||||
upload = QuixoteUpload('/foo/template.odt', content_type='application/octet-stream')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write(template)
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3518,7 +3518,7 @@ def test_formdata_generated_document_odt_to_pdf_download_push_to_portfolio(pub,
|
|||
template_filename = os.path.join(os.path.dirname(__file__), 'template.odt')
|
||||
template = open(template_filename).read()
|
||||
upload = QuixoteUpload('/foo/template.odt', content_type='application/octet-stream')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write(template)
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3606,7 +3606,7 @@ def test_formdata_generated_document_non_interactive(pub):
|
|||
template_filename = os.path.join(os.path.dirname(__file__), 'template.odt')
|
||||
template = open(template_filename).read()
|
||||
upload = QuixoteUpload('/foo/template.odt', content_type='application/octet-stream')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write(template)
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3645,7 +3645,7 @@ def test_formdata_generated_document_non_interactive(pub):
|
|||
resp = resp.follow()
|
||||
assert resp.content_type == 'application/octet-stream'
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template-out.odt')) as f:
|
||||
assert_equal_zip(StringIO.StringIO(resp.body), f)
|
||||
assert_equal_zip(StringIO(resp.body), f)
|
||||
|
||||
assert formdef.data_class().count() == 1
|
||||
assert formdef.data_class().select()[0].status == 'wf-st2'
|
||||
|
@ -3666,7 +3666,7 @@ def test_formdata_generated_document_to_backoffice_field(pub):
|
|||
template_filename = os.path.join(os.path.dirname(__file__), 'template.odt')
|
||||
template = open(template_filename).read()
|
||||
upload = QuixoteUpload('/foo/template.odt', content_type='application/octet-stream')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write(template)
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -3710,7 +3710,7 @@ def test_formdata_generated_document_to_backoffice_field(pub):
|
|||
resp = resp.follow()
|
||||
assert resp.content_type == 'application/octet-stream'
|
||||
with open(os.path.join(os.path.dirname(__file__), 'template-out.odt')) as f:
|
||||
assert_equal_zip(StringIO.StringIO(resp.body), f)
|
||||
assert_equal_zip(StringIO(resp.body), f)
|
||||
|
||||
assert formdef.data_class().count() == 1
|
||||
assert formdef.data_class().select()[0].status == 'wf-st2'
|
||||
|
@ -3731,7 +3731,7 @@ def test_formdata_generated_document_in_private_history(pub):
|
|||
export_to = ExportToModel()
|
||||
export_to.label = 'create doc'
|
||||
upload = QuixoteUpload('/foo/test.rtf', content_type='application/rtf')
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write('HELLO WORLD')
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.app_dir, None, upload)
|
||||
|
@ -5063,7 +5063,7 @@ def test_item_field_with_disabled_items(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
resp.form['f0'] = '1'
|
||||
resp.form['f0'] = '2'
|
||||
|
@ -5076,7 +5076,7 @@ def test_item_field_with_disabled_items(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
pq = resp.pyquery.remove_namespaces()
|
||||
assert pq('option[disabled=disabled][value="1"]').text() == 'hello'
|
||||
|
@ -5101,7 +5101,7 @@ def test_item_field_with_disabled_items(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
pq = resp.pyquery.remove_namespaces()
|
||||
assert len(pq('option[disabled=disabled][value="1"]')) == 0
|
||||
|
@ -5118,7 +5118,7 @@ def test_item_field_with_disabled_items(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
resp.form['f0'] = '1'
|
||||
resp.form['f0'] = '2'
|
||||
|
@ -5131,7 +5131,7 @@ def test_item_field_with_disabled_items(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
pq = resp.pyquery.remove_namespaces()
|
||||
assert len(pq('input[name="f0"][disabled=disabled][value="1"]')) == 1
|
||||
|
@ -5160,7 +5160,7 @@ def test_items_field_with_disabled_items(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello'}, {'id': '2', 'text': 'world'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
resp.form['f0$element1'].checked = True
|
||||
resp.form['f0$element2'].checked = True
|
||||
|
@ -5173,7 +5173,7 @@ def test_items_field_with_disabled_items(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
assert 'disabled' in resp.form['f0$element1'].attrs
|
||||
resp.form['f0$element1'].checked = True
|
||||
|
@ -5190,7 +5190,7 @@ def test_items_field_with_disabled_items(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'disabled': True}, {'id': '2', 'text': 'world'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
assert not 'f0$element1' in resp.form.fields
|
||||
resp.form['f0$element2'].checked = True
|
||||
|
@ -5220,7 +5220,7 @@ def test_item_field_autocomplete_json_source(http_requests, pub):
|
|||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'},
|
||||
{'id': '2', 'text': 'world', 'extra': 'bar'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
assert 'data-autocomplete="true"' in resp.body
|
||||
assert resp.form['f0'].value == '1'
|
||||
|
@ -5237,7 +5237,7 @@ def test_item_field_autocomplete_json_source(http_requests, pub):
|
|||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'},
|
||||
{'id': '2', 'text': 'world', 'extra': 'bar'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = get_app(pub).get('/test/')
|
||||
assert 'data-autocomplete="true"' in resp.body
|
||||
assert 'data-hint="help text"' in resp.body
|
||||
|
@ -5257,7 +5257,7 @@ def test_item_field_autocomplete_json_source(http_requests, pub):
|
|||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'},
|
||||
{'id': '2', 'text': 'world', 'extra': 'bar'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = app.get('/test/')
|
||||
assert urlopen.call_count == 0
|
||||
pq = resp.pyquery.remove_namespaces()
|
||||
|
@ -5265,7 +5265,7 @@ def test_item_field_autocomplete_json_source(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp2 = app.get(select2_url + '?q=hell')
|
||||
assert urlopen.call_count == 1
|
||||
assert urlopen.call_args[0][0] == 'http://remote.example.net/json?q=hell'
|
||||
|
@ -5281,7 +5281,7 @@ def test_item_field_autocomplete_json_source(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = resp.form.submit('submit') # -> validation page
|
||||
assert urlopen.call_count == 1
|
||||
assert urlopen.call_args[0][0] == 'http://remote.example.net/json?id=1'
|
||||
|
@ -5290,7 +5290,7 @@ def test_item_field_autocomplete_json_source(http_requests, pub):
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = resp.form.submit('submit') # -> submit
|
||||
assert urlopen.call_count == 1
|
||||
assert urlopen.call_args[0][0] == 'http://remote.example.net/json?id=1'
|
||||
|
@ -5309,7 +5309,7 @@ remote.example.net = 1234
|
|||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'},
|
||||
{'id': '2', 'text': 'world', 'extra': 'bar'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = app.get('/test/')
|
||||
assert urlopen.call_count == 0
|
||||
pq = resp.pyquery.remove_namespaces()
|
||||
|
@ -5317,7 +5317,7 @@ remote.example.net = 1234
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp2 = app.get(select2_url + '?q=hell')
|
||||
assert urlopen.call_count == 1
|
||||
assert urlopen.call_args[0][0].startswith('http://remote.example.net/json?q=hell&orig=example.net&')
|
||||
|
@ -5330,7 +5330,7 @@ remote.example.net = 1234
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = resp.form.submit('submit') # -> validation page
|
||||
assert urlopen.call_count == 1
|
||||
assert urlopen.call_args[0][0].startswith('http://remote.example.net/json?id=1&orig=example.net&')
|
||||
|
@ -5339,7 +5339,7 @@ remote.example.net = 1234
|
|||
|
||||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = resp.form.submit('submit') # -> submit
|
||||
assert urlopen.call_count == 1
|
||||
assert urlopen.call_args[0][0].startswith('http://remote.example.net/json?id=1&orig=example.net&')
|
||||
|
@ -5356,7 +5356,7 @@ remote.example.net = 1234
|
|||
with mock.patch('wcs.qommon.misc.urlopen') as urlopen:
|
||||
data = {'data': [{'id': '1', 'text': 'hello', 'extra': 'foo'},
|
||||
{'id': '2', 'text': 'world', 'extra': 'bar'}]}
|
||||
urlopen.side_effect = lambda *args: StringIO.StringIO(json.dumps(data))
|
||||
urlopen.side_effect = lambda *args: StringIO(json.dumps(data))
|
||||
resp = app.get('/test/')
|
||||
pq = resp.pyquery.remove_namespaces()
|
||||
select2_url = pq('select').attr['data-select2-url']
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
import pytest
|
||||
import sys
|
||||
import shutil
|
||||
import StringIO
|
||||
import time
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from django.utils.six import StringIO
|
||||
from quixote import cleanup
|
||||
|
||||
from wcs.categories import Category
|
||||
|
@ -46,7 +46,7 @@ def assert_xml_import_export_works(formdef, include_id=False):
|
|||
|
||||
def assert_json_import_export_works(formdef, include_id=False):
|
||||
formdef2 = FormDef.import_from_json(
|
||||
StringIO.StringIO(formdef.export_to_json(include_id=include_id)), include_id=include_id)
|
||||
StringIO(formdef.export_to_json(include_id=include_id)), include_id=include_id)
|
||||
assert_compare_formdef(formdef, formdef2, include_id=include_id)
|
||||
return formdef2
|
||||
|
||||
|
@ -200,7 +200,7 @@ def test_workflow_options_with_file():
|
|||
|
||||
upload = Upload('/foo/bar', content_type='application/vnd.oasis.opendocument.text')
|
||||
file_content = '''PK\x03\x04\x14\x00\x00\x08\x00\x00\'l\x8eG^\xc62\x0c\'\x00'''
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write(file_content)
|
||||
upload.fp.seek(0)
|
||||
model_file = UploadedFile(pub.APP_DIR, None, upload)
|
||||
|
@ -311,7 +311,7 @@ def test_invalid_field_type():
|
|||
formdef.fields = [fields.StringField(id='1', type='XXX')]
|
||||
export = ET.tostring(export_to_indented_xml(formdef))
|
||||
with pytest.raises(FormdefImportError):
|
||||
FormDef.import_from_xml(StringIO.StringIO(export), include_id=True)
|
||||
FormDef.import_from_xml(StringIO(export), include_id=True)
|
||||
|
||||
def test_unknown_data_source():
|
||||
formdef = FormDef()
|
||||
|
@ -320,13 +320,13 @@ def test_unknown_data_source():
|
|||
data_source={'type': 'json', 'value': 'http://example.net'})]
|
||||
export = ET.tostring(export_to_indented_xml(formdef))
|
||||
|
||||
FormDef.import_from_xml(StringIO.StringIO(export))
|
||||
FormDef.import_from_xml(StringIO(export))
|
||||
|
||||
formdef.fields = [fields.StringField(id='1', type='string',
|
||||
data_source={'type': 'foobar'})]
|
||||
export = ET.tostring(export_to_indented_xml(formdef))
|
||||
with pytest.raises(FormdefImportError):
|
||||
FormDef.import_from_xml(StringIO.StringIO(export))
|
||||
FormDef.import_from_xml(StringIO(export))
|
||||
|
||||
def test_duplicated_field_ids():
|
||||
formdef = FormDef()
|
||||
|
@ -338,12 +338,12 @@ def test_duplicated_field_ids():
|
|||
export = ET.tostring(export_to_indented_xml(formdef, include_id=True))
|
||||
|
||||
with pytest.raises(FormdefImportError):
|
||||
FormDef.import_from_xml(StringIO.StringIO(export))
|
||||
FormDef.import_from_xml(StringIO(export))
|
||||
|
||||
with pytest.raises(FormdefImportError):
|
||||
FormDef.import_from_xml(StringIO.StringIO(export), include_id=True)
|
||||
FormDef.import_from_xml(StringIO(export), include_id=True)
|
||||
|
||||
formdef2 = FormDef.import_from_xml(StringIO.StringIO(export), fix_on_error=True)
|
||||
formdef2 = FormDef.import_from_xml(StringIO(export), fix_on_error=True)
|
||||
assert formdef2.fields[0].id == '1'
|
||||
assert formdef2.fields[1].id == '2'
|
||||
assert formdef2.fields[2].id == '3'
|
||||
|
@ -357,7 +357,7 @@ def test_wrong_max_field_id():
|
|||
formdef.max_field_id = 1
|
||||
export = ET.tostring(export_to_indented_xml(formdef, include_id=True))
|
||||
|
||||
formdef2 = FormDef.import_from_xml(StringIO.StringIO(export), include_id=True)
|
||||
formdef2 = FormDef.import_from_xml(StringIO(export), include_id=True)
|
||||
assert formdef2.max_field_id == 2
|
||||
|
||||
def test_page_condition():
|
||||
|
@ -540,7 +540,7 @@ def test_field_validation():
|
|||
old_format = ET.tostring(formdef_xml).replace(
|
||||
'<validation><type>regex</type><value>\\d</value></validation>',
|
||||
'<validation>\\d</validation>')
|
||||
f2 = FormDef.import_from_xml(StringIO.StringIO(old_format))
|
||||
f2 = FormDef.import_from_xml(StringIO(old_format))
|
||||
assert len(f2.fields) == len(formdef.fields)
|
||||
assert f2.fields[0].validation == {'type': 'regex', 'value': '\\d'}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import json
|
|||
import re
|
||||
import sys
|
||||
import shutil
|
||||
import StringIO
|
||||
import os
|
||||
import zipfile
|
||||
|
||||
|
@ -15,6 +14,7 @@ from django.core.management import call_command
|
|||
from django.core.management.base import CommandError
|
||||
from django.http import Http404
|
||||
from django.test import override_settings
|
||||
from django.utils.six import StringIO
|
||||
from quixote import cleanup
|
||||
from wcs.qommon import get_publisher_class
|
||||
from wcs.qommon.http_request import HTTPRequest
|
||||
|
@ -93,14 +93,14 @@ def test_finish_failed_request():
|
|||
assert '<div class="error-page">' in str(body)
|
||||
|
||||
def test_finish_interrupted_request():
|
||||
req = HTTPRequest(StringIO.StringIO(''), {
|
||||
req = HTTPRequest(StringIO(''), {
|
||||
'SERVER_NAME': 'example.net',
|
||||
'SCRIPT_NAME': '',
|
||||
'CONTENT_LENGTH': 'aaa',
|
||||
})
|
||||
response = pub.process_request(req)
|
||||
assert 'invalid content-length header' in str(response)
|
||||
req = HTTPRequest(StringIO.StringIO(''), {
|
||||
req = HTTPRequest(StringIO(''), {
|
||||
'SERVER_NAME': 'example.net',
|
||||
'SCRIPT_NAME': '',
|
||||
'CONTENT_TYPE': 'application/x-www-form-urlencoded',
|
||||
|
@ -108,7 +108,7 @@ def test_finish_interrupted_request():
|
|||
})
|
||||
response = pub.process_request(req)
|
||||
assert 'Invalid request: unexpected end of request body' in str(response)
|
||||
req = HTTPRequest(StringIO.StringIO(''), {
|
||||
req = HTTPRequest(StringIO(''), {
|
||||
'SERVER_NAME': 'example.net',
|
||||
'SCRIPT_NAME': '',
|
||||
'CONTENT_TYPE': 'multipart/form-data',
|
||||
|
@ -117,7 +117,7 @@ def test_finish_interrupted_request():
|
|||
response = pub.process_request(req)
|
||||
assert 'Invalid request: multipart/form-data missing boundary' in str(response)
|
||||
with pytest.raises(Http404):
|
||||
req = HTTPRequest(StringIO.StringIO(''), {
|
||||
req = HTTPRequest(StringIO(''), {
|
||||
'SERVER_NAME': 'example.net',
|
||||
'SCRIPT_NAME': '',
|
||||
'PATH_INFO': '/gloubiboulga',
|
||||
|
@ -147,7 +147,7 @@ def test_import_config_zip():
|
|||
pub.cfg['sp'] = {'what': 'ever'}
|
||||
pub.write_cfg()
|
||||
|
||||
c = StringIO.StringIO()
|
||||
c = StringIO()
|
||||
z = zipfile.ZipFile(c, 'w')
|
||||
z.writestr('config.pck', cPickle.dumps(
|
||||
{'language': {'language': 'fr'},
|
||||
|
@ -160,7 +160,7 @@ def test_import_config_zip():
|
|||
assert pub.cfg['whatever'] == ['a', 'b', 'c']
|
||||
assert pub.cfg['sp'] == {'what': 'ever'}
|
||||
|
||||
c = StringIO.StringIO()
|
||||
c = StringIO()
|
||||
z = zipfile.ZipFile(c, 'w')
|
||||
z.writestr('config.json', json.dumps(
|
||||
{'language': {'language': 'en'},
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
import pytest
|
||||
import sys
|
||||
import shutil
|
||||
import StringIO
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from django.utils.six import StringIO
|
||||
from quixote import cleanup
|
||||
from wcs import publisher
|
||||
|
||||
|
@ -175,7 +175,7 @@ def test_status_actions_named_existing_role(pub):
|
|||
xml_export = xml_export_orig.replace(
|
||||
'<item role_id="2">Test Role named existing role</item>',
|
||||
'<item>Test Role named existing role</item>')
|
||||
wf3 = Workflow.import_from_xml_tree(ET.parse(StringIO.StringIO(xml_export)))
|
||||
wf3 = Workflow.import_from_xml_tree(ET.parse(StringIO(xml_export)))
|
||||
assert wf3.possible_status[0].items[0].by == ['2']
|
||||
|
||||
|
||||
|
@ -207,14 +207,14 @@ def test_status_actions_named_missing_role(pub):
|
|||
assert '<item role_id="3">Test Role A</item>' in xml_export_orig
|
||||
xml_export = xml_export_orig.replace('<item role_id="3">Test Role A</item>',
|
||||
'<item role_id="4">Test Role A</item>')
|
||||
wf3 = Workflow.import_from_xml_tree(ET.parse(StringIO.StringIO(xml_export)))
|
||||
wf3 = Workflow.import_from_xml_tree(ET.parse(StringIO(xml_export)))
|
||||
assert wf3.possible_status[0].items[0].by == ['3']
|
||||
|
||||
# check that it creates a new role if there's no match on id and name
|
||||
xml_export = xml_export_orig.replace('<item role_id="3">Test Role A</item>',
|
||||
'<item role_id="999">foobar</item>')
|
||||
nb_roles = Role.count()
|
||||
wf3 = Workflow.import_from_xml_tree(ET.parse(StringIO.StringIO(xml_export)))
|
||||
wf3 = Workflow.import_from_xml_tree(ET.parse(StringIO(xml_export)))
|
||||
assert Role.count() == nb_roles+1
|
||||
|
||||
# check that it doesn't fallback on the id if there's no match on the
|
||||
|
@ -222,12 +222,12 @@ def test_status_actions_named_missing_role(pub):
|
|||
nb_roles = Role.count()
|
||||
xml_export = xml_export_orig.replace('<item role_id="3">Test Role A</item>',
|
||||
'<item role_id="3">Test Role C</item>')
|
||||
wf3 = Workflow.import_from_xml_tree(ET.parse(StringIO.StringIO(xml_export)))
|
||||
wf3 = Workflow.import_from_xml_tree(ET.parse(StringIO(xml_export)))
|
||||
assert wf3.possible_status[0].items[0].by != ['3']
|
||||
assert Role.count() == nb_roles+1
|
||||
|
||||
# on the other hand, check that it uses the id when included_id is True
|
||||
wf3 = Workflow.import_from_xml_tree(ET.parse(StringIO.StringIO(xml_export)),
|
||||
wf3 = Workflow.import_from_xml_tree(ET.parse(StringIO(xml_export)),
|
||||
include_id=True)
|
||||
assert wf3.possible_status[0].items[0].by == ['3']
|
||||
|
||||
|
@ -264,7 +264,7 @@ def test_export_to_model_action(pub):
|
|||
export_to.label = 'test'
|
||||
upload = Upload('/foo/bar', content_type='application/vnd.oasis.opendocument.text')
|
||||
file_content = '''PK\x03\x04\x14\x00\x00\x08\x00\x00\'l\x8eG^\xc62\x0c\'\x00'''
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write(file_content)
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.APP_DIR, None, upload)
|
||||
|
@ -281,7 +281,7 @@ def test_export_to_model_action(pub):
|
|||
export_to.label = 'test'
|
||||
upload = Upload('/foo/bar', content_type='text/rtf')
|
||||
file_content = ''
|
||||
upload.fp = StringIO.StringIO()
|
||||
upload.fp = StringIO()
|
||||
upload.fp.write(file_content)
|
||||
upload.fp.seek(0)
|
||||
export_to.model_file = UploadedFile(pub.APP_DIR, None, upload)
|
||||
|
@ -367,7 +367,7 @@ def test_commentable_action(pub):
|
|||
assert '<required>True</required>' in xml_export
|
||||
xml_export = xml_export.replace('<required>True</required>', '')
|
||||
assert '<required>True</required>' not in xml_export
|
||||
wf2 = Workflow.import_from_xml_tree(ET.parse(StringIO.StringIO(xml_export)))
|
||||
wf2 = Workflow.import_from_xml_tree(ET.parse(StringIO(xml_export)))
|
||||
assert wf2.possible_status[0].items[0].required is False
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import json
|
||||
import pytest
|
||||
from StringIO import StringIO
|
||||
|
||||
from wcs.qommon.http_request import HTTPRequest
|
||||
from wcs.qommon.template import Template
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
import StringIO
|
||||
import psycopg2
|
||||
import traceback
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.core.management.base import CommandError
|
||||
from django.utils.six import StringIO
|
||||
|
||||
from wcs.qommon.publisher import get_publisher_class
|
||||
|
||||
|
@ -80,7 +80,7 @@ class Command(BaseCommand):
|
|||
self.publisher.site_options.add_section('options')
|
||||
self.publisher.site_options.set('options', 'postgresql', 'true')
|
||||
options_file = os.path.join(self.publisher.app_dir, 'site-options.cfg')
|
||||
stringio = StringIO.StringIO()
|
||||
stringio = StringIO()
|
||||
self.publisher.site_options.write(stringio)
|
||||
atomic_write(options_file, stringio.getvalue())
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ from email.utils import formataddr
|
|||
import smtplib
|
||||
import socket
|
||||
|
||||
from cStringIO import StringIO
|
||||
|
||||
try:
|
||||
import docutils
|
||||
import docutils.core
|
||||
|
@ -43,6 +41,7 @@ except ImportError:
|
|||
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.six import StringIO
|
||||
|
||||
from quixote import get_request, get_response, get_publisher
|
||||
|
||||
|
|
|
@ -38,13 +38,13 @@ builtins.__dict__['N_'] = lambda x: x
|
|||
|
||||
import linecache
|
||||
import requests
|
||||
from StringIO import StringIO
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import Http404
|
||||
from django.utils import translation
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.six import StringIO
|
||||
from django.utils.translation import gettext, ngettext
|
||||
|
||||
from quixote.publish import Publisher, get_request, get_response, get_publisher, redirect
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from cStringIO import StringIO
|
||||
import os
|
||||
import glob
|
||||
import xml.etree.ElementTree as ET
|
||||
|
@ -26,6 +25,7 @@ from django.template import (engines,
|
|||
from django.template.loader import render_to_string
|
||||
from django.utils.encoding import force_text, smart_text
|
||||
from django.utils.safestring import SafeString, SafeUnicode
|
||||
from django.utils.six import StringIO
|
||||
|
||||
from quixote import get_session, get_request, get_response, get_publisher
|
||||
from quixote.directory import Directory
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from cStringIO import StringIO
|
||||
import psycopg2
|
||||
import psycopg2.extensions
|
||||
import datetime
|
||||
|
@ -23,6 +22,7 @@ import re
|
|||
import cPickle
|
||||
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.six import StringIO
|
||||
|
||||
from quixote import get_publisher
|
||||
from . import qommon
|
||||
|
|
|
@ -21,9 +21,9 @@ import traceback
|
|||
import xml.etree.ElementTree as ET
|
||||
import collections
|
||||
import mimetypes
|
||||
from StringIO import StringIO
|
||||
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.six import StringIO
|
||||
|
||||
from quixote.html import TemplateIO, htmltext
|
||||
|
||||
|
|
Loading…
Reference in New Issue