Typoscript: If page is not equal to - typo3

I'm trying to include a typoscript on the child pages of the page it's included on.
On page id 272 I have included in the setup a typoscript file:
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/templates/typoscript/fancyBoxPopup.ts">
And I only want this typoscript to run on that pages children.
So I tried this:
[globalVar = TSFE:id != 252, 253, 254, 270, 272, 271, 273, 274]
But that makes the script run on all children and parents (those listed in the statement)
Here is the full script:
[globalVar = TSFE:id != 252, 253, 254, 270, 272, 271, 273, 274]
page.includeJS >
page.includeJS.ieFixes = fileadmin/templates/js/ieFixes.js
columnWidth {
page {
main = 400
}
}
[end]

I think I manage to fix it.
I found PIDupinRootline.
So the final code looks like this:
[PIDupinRootline = 252,253,254,270,272,271,273,274]
...
[end]

Related

Gatling scala: Check that the status code belongs to a list

For a scenario I want to check that status code of the response belongs to 200-209 or 304 or 404.
I tried the following but apparently it's not supported. And I can't find my use case in the docs.
scenario("Scenario example").exec(httpRequest
.check(status.in(200 to 209, 304, 404)))
Is there a better solution other than listing the codes manually?
.check(status.in(200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 304, 404))
.check(
status.in((200 to 209) ++ List(304, 404))
)
You passed something mixed with Seq and Int.
The method in takes Seq[Int]:
.check(
status.in((201 to 209) :+ 303 :+ 304)
)

CKAN 2.9 ValueError: Registry initialized :: ckan basic-charts plugins

I am new to ckan. After successfully installing ckan when I went to use some ckan plugins as an example ckan-basiccharts i am getting ValueError. After some research, I understand it's related to web-assets. In basicchart folder, I change the {%resource ....} to {%asset ..}
ckanext/basiccharts/theme/templates/basechart_view.html in .html file
but I am still getting the same error. Can anyone please explain the logic behind this error and some tricks to get rid of this error?
Traceback (most recent call last):
File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/../../views/resource.py", line 151, in read
return base.render(template, extra_vars)
File "/usr/lib/ckan/default/src/ckan/ckan/lib/base.py", line 151, in render
return flask_render_template(template_name, **extra_vars)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/templating.py", line 137, in render_template
return _render(
File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/usr/lib/ckan/default/src/ckan/ckanext/datastore/templates/package/resource_read.html", line 1, in <module>
{% ckan_extends %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/package/resource_read.html", line 3, in <module>
{% set res = resource %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/package/base.html", line 4, in <module>
{% set dataset_type = dataset_type or pkg.type or 'dataset' %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/page.html", line 1, in <module>
{% extends "base.html" %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/base.html", line 106, in <module>
{%- block page %}{% endblock -%}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/page.html", line 19, in <module>
{%- block content %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/page.html", line 22, in <module>
{% block main_content %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/page.html", line 53, in <module>
{% block pre_primary %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/package/resource_read.html", line 22, in <module>
{% block resource %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/package/resource_read.html", line 24, in <module>
{% block resource_inner %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/package/resource_read.html", line 104, in <module>
{% block data_preview %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/package/resource_read.html", line 105, in <module>
{% block resource_view %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/package/resource_read.html", line 118, in <module>
{% block resource_view_content %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/package/resource_read.html", line 128, in <module>
{% snippet 'package/snippets/resource_view.html',
File "/usr/lib/ckan/default/src/ckan/ckan/lib/jinja_extensions.py", line 274, in _call
return base.render_snippet(*args, **kwargs)
File "/usr/lib/ckan/default/src/ckan/ckan/lib/base.py", line 95, in render_snippet
output = render(template_name, extra_vars=kw)
File "/usr/lib/ckan/default/src/ckan/ckan/lib/base.py", line 151, in render
return flask_render_template(template_name, **extra_vars)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/templating.py", line 137, in render_template
return _render(
File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/usr/lib/ckan/default/src/ckan/ckan/templates/package/snippets/resource_view.html", line 3, in <module>
{% block resource_view %}
File "/usr/lib/ckan/default/src/ckan/ckan/templates/package/snippets/resource_view.html", line 27, in <module>
{{ h.rendered_resource_view(resource_view, resource, package) }}
File "/usr/lib/ckan/default/src/ckan/ckan/lib/helpers.py", line 2488, in rendered_resource_view
return literal(base.render(template, extra_vars=data_dict))
File "/usr/lib/ckan/default/src/ckan/ckan/lib/base.py", line 151, in render
return flask_render_template(template_name, **extra_vars)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/templating.py", line 137, in render_template
return _render(
File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/ckanext_basiccharts-0.1-py3.8.egg/ckanext/basiccharts/theme/templates/basechart_view.html", line 1, in <module>
{% resource 'basiccharts/main' %}
File "/usr/lib/ckan/default/src/ckan/ckan/lib/jinja_extensions.py", line 334, in _call
h.include_resource(args[0], **kwargs)
File "/usr/lib/ckan/default/src/ckan/ckan/lib/helpers.py", line 2097, in include_resource
import ckan.lib.fanstatic_resources as fanstatic_resources
File "/usr/lib/ckan/default/src/ckan/ckan/lib/fanstatic_resources.py", line 252, in <module>
create_library('vendor', os.path.join(base_path, 'vendor'), depend_base=False)
File "/usr/lib/ckan/default/src/ckan/ckan/lib/fanstatic_resources.py", line 243, in create_library
registry.add(library)
File "/usr/lib/ckan/default/lib/python3.8/site-packages/fanstatic/registry.py", line 18, in add
self[item.name] = item
File "/usr/lib/ckan/default/lib/python3.8/site-packages/fanstatic/registry.py", line 72, in __setitem__
raise ValueError('Registry initialized.')
ValueError: Registry initialized.
For migration to webassets, you need to create an assets folder and place there .js and .css files of the extension. In addition, you need to create webassets.yml inside the assets folder where those .js and .css files should be registered. This process is described here and here.
But you can use this version of ckanext-basiccharts that is compatible with current ckan versions.

How can I split an array into specified lines when printing?

New to software development, I'm working through Big Nerd Ranch's book 'Swift Programming'. One of the challenges set by the book is to print an array within a dictionary that contains 15 zip codes and to have them split across three lines in groups of five. The formatting must exactly match how it appears in the book.
I have tried to solve the issue using the information taught in the book with assistance from the developer documentation.
No dice.
This is what I need to print:
Caterham has the following zip codes: [111, 111, 111, 111, 111,
222, 222, 222, 222, 222,
333, 333, 333, 333, 333]
However this is the closest I can get...
var areaCodes = ["Caterham": [111, 111, 111, 111, 111], "Coulsdon": [222, 222, 222, 222, 222], "Purley": [333, 333, 333, 333, 333]]
var caterhamCodes : [Int] = []
for (_, values) in areaCodes {
caterhamCodes += values
}
print("Caterham has the following codes: \(caterhamCodes[0...4]),")
print(" \(caterhamCodes[5...9]),")
print(" \(caterhamCodes[10...14]).")
which prints:
Caterham has the following postcodes: [111, 111, 111, 111, 111],
[222, 222, 222, 222, 222],
[333, 333, 333, 333, 333].
Essentially, I need what I have above minus some square brackets and without the punctuation after each time a block of zip codes is printed. The book specifies that I might need to use a parameter called terminator. It also mentions I might need to learn how to represent special characters in string literals.
I appreciate that this is probably a high level question with a simple answer, but I'm only a few weeks into learning, so I hope I can be forgiven for asking at least a few silly questions!
Welcome to the developer community and have a nice stay!
I am trying to put answer as simple as possible, so here is my attempt:
var areaCodes = ["Caterham": [111, 111, 111, 111, 111],
"Coulsdon": [222, 222, 222, 222, 222],
"Purley": [333, 333, 333, 333, 333]]
let codesArray = areaCodes.values.sorted(by: { $0[0] < $1[0] })
let caterhamString = "Caterham has the following zip codes: ["
var printString = caterhamString
for (index, area) in codesArray.enumerated() {
for code in area {
printString += "\(code), "
}
if index != codesArray.count - 1 {
printString += "\n" + String(repeating: " ", count: caterhamString.count)
}
}
print(printString.dropLast(2).appending("]"))
Hope this helps! Good luck!
Here is a way of getting the desired output :
let intro = "Caterham has the following zip codes: ["
let spaces = ",\n" + String(repeating: " ", count: intro.count)
let areaCodes = ["Caterham": [111, 111, 111, 111, 111], "Coulsdon": [222, 222, 222, 222, 222], "Purley": [333, 333, 333, 333, 333]]
let codes = areaCodes.values.sorted { $0[0] < $1[0] }
var output = intro +
codes.map { $0.map{ String($0) }.joined(separator: ", ") }
.joined(separator: spaces)
+ "]"
print(output)
Which prints
Caterham has the following zip codes: [111, 111, 111, 111, 111,
222, 222, 222, 222, 222,
333, 333, 333, 333, 333]

Odoo - outgoing email KeyError: 'body'

In Odoo 9 community outgoing email used to work (smtp configured, etc.), but now I get the following error when trying to send any email (invoice, internal note, etc.) from any account, for any template.
Things I changed since it worked that might (or might not) be linked to this issue:
I installed and uninstalled the SMTP Server Per User plugin
I changed the "from: " email address in the email templates
Any clue why this occurs? Or any clue what this "body" key is and where it is supposed to be defined? Thanks!
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 605, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 642, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 316, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 309, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 893, in __call__
return self.method(*args, **kw)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 471, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 998, in call_button
action = self._call_kw(model, method, args, {})
File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 986, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper
return old_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 369, in old_api
result = method(recs, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/wizard/mail_compose_message.py", line 191, in send_mail_action
return self.send_mail()
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/account/models/account_invoice.py", line 1306, in send_mail
return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/wizard/mail_compose_message.py", line 248, in send_mail
ActiveModel.browse(res_id).message_post(message_type='comment', subtype=subtype, **mail_values)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/models/mail_thread.py", line 1712, in message_post
new_message = MailMessage.create(values)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/models/mail_message.py", line 864, in create
user_signature=self.env.context.get('mail_notify_user_signature', True))
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/models/mail_message.py", line 926, in _notify
partners._notify(self, force_send=force_send, user_signature=user_signature)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/models/res_partner.py", line 127, in _notify
('notify_email', '!=', 'none')])._notify_by_email(message, force_send=force_send, user_signature=user_signature)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/models/res_partner.py", line 178, in _notify_by_email
new_emails, new_recipients_nbr = self._notify_send(not_values['body'], not_values['subject'], recipient_template_values['not_followers'], **base_mail_values)
KeyError: 'body'
#v11 odoo community
Solved Error : Odoo - outgoing email KeyError: 'body'
When Other User sends message on contacts page it gives outgoing email KeyError: 'body'.
This Error is occur from Mail Template : [mail module /data/ mail_data.xml]
so change Your Template Body code Or You Can Also inherit Mail Template:
Remove extra content in this mail_data.xml file.
% if ctx.get('website_url'):
% endif
Only This code Work Properly :
<p style="color: #555555;">
Sent by
% if ctx.get('website_url'):
<a href="${ctx['website_url']}" style="text-decoration:none; color: #875A7B;">
% endif
${ctx.get('company_name')}
</a>
using
<a target="_blank" href="https://www.odoo.com" style="text-decoration:none; color: #875A7B;">Odoo</a>.
</p>
Also Reference : https://i.stack.imgur.com/h8yMK.png
I did not solve the issue myself, but the person who did told me it came from a translation file and an "<" sign that was interpreted as a smaller than in the python code. So he changed the translation file to remove the smaller than.

Django-pipeline invalid syntax

I am trying to setup django-pipeline in my test project, however, I am running into a bug which doesn't have an obvious solution. Here is the pipeline configure in the settings.py
PIPELINE = {
'PIPELINE_ENABLED': True,
'COMPILERS': ('pipeline_browserify.compiler.BrowserifyCompiler', ),
'CSS_COMPRESSOR': 'pipeline.compressors.NoopCompressor',
'JS_COMPRESSOR': 'pipeline.compressors.uglifyjs.UglifyJSCompressor',
'STYLESHEETS': {
# 'animelist_css': {
# 'source_filenames': ( 'animelist/css/style.css', ),
# 'output_filename': 'animelist/css/animelist_css.css',
# }
},
'JAVASCRIPT': {
# 'animelist_js': {
# 'source_filenames': (
# 'animelist/js/bower_components/jquery/dist/jquery.min.js',
# 'animelist/js/bower_components/react/JSXTransformer.js',
# 'animelist/js/bower_components/react/react-with-addons.js',
# 'animelist/js/app.browserify.js',
# ),
# 'output_filename': 'animelist/js/animelist_js.js',
# }
}
}
As you can see from the configuration, this setting will allow collectstatic to run without any problem. However, collectstatic will fail if I were to uncomment those lines. The error is shown below
You have requested to collect static files at the destination
location as specified in your settings:
/var/www/anime/static
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/opt/virtualenvs/django_project/lib64/python3.4/site- packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
collected = self.collect()
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
for original_path, processed_path, processed in processor:
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/storage.py", line 33, in post_process
packager.pack_javascripts(package)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/packager.py", line 112, in pack_javascripts
return self.pack(package, self.compressor.compress_js, js_compressed, templates=package.templates, **kwargs)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/packager.py", line 105, in pack
paths = self.compile(package.paths, force=True)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/packager.py", line 99, in compile
return self.compiler.compile(paths, force=force)
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/pipeline/compilers/__init__.py", line 49, in compile
from concurrent import futures
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/opt/virtualenvs/django_project/lib64/python3.4/site-packages/concurrent/futures/_base.py", line 355
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
Help is greatly appreciated.
Apparently, the error is the result of installing futures backport in pip3. Simply uninstall futures packages in your pip3.