Django-wiki installed but root article throws global flag error - django

I have installed Django-wiki in a fresh virtual Django install. My initial page comes up, the site allows for user registration. Everything looks well until I enter my first Root article.
I have kept it rudimentary with a title "Test" and the body just a simple "Hello" but when I save I get this error:
error at /
global flags not at the start of the expression at position 9
Request Method: GET
Request URL: http://xxxxxxx.preprod.xxxx:8000/
Django Version: 4.0.8
Exception Type: error
Exception Value:
global flags not at the start of the expression at position 9
Exception Location: C:\python\Lib\re_parser.py, line 841, in _parse
Python Executable: C:\daas_django_apps\env\Scripts\python.exe
Python Version: 3.11.0
Error during template rendering
In template C:\daas_django_apps\env\Lib\site-packages\wiki\templates\wiki\view.html, error at line 7
Line 7 is:
{% wiki_render article %}
I have tried checking all my configuration and it seems ok and matches Django-Wiki installation example. Tried changing user ownership of the article and creating a group for viewing but to no avail.
Any help would be appreciated.
Thank you!

Indeed, the use of inline global flags (eg: (?im)) in two regular expressions are now raising an exception, instead of a warning before 3.11 (https://github.com/python/cpython/issues/91222).
A fix has been merged on the main branch and it will be released soon if there are no other issues with 3.11.
See https://github.com/django-wiki/django-wiki/pull/1243 for more details.

Related

Django 2 URL <int: > notation isn't behaving as expected

I have been migrating a platform from django 1.11 to django 2 for the past week with no issues, up until today, when I tried to update my urls. I have these 3 lines of code:
1. url(r'^track/(?P<track_id>[0-9]+)/user/playlists', views.music),
2. path(r'track/<int:track_id>/user/playlists', views.music),
3. re_path(r'^track/(?P<track_id>[0-9]+)/user/playlists',views.music),
the original line that worked fine in django 1.11.
the new line that I created to replace Line 1. I removed the caret '^' and replaced the RegEx.
the line I am using right now because it is working fine.
My issue here is that my test fails when I use Line 2 but passes when I use Line 3.What could possible cause this behavior?
PS: The test that fails is just a test that passes 14 to the URL and checks the response. The response should be 200 but is 404 instead. In fact, I tried pdb inside the music method, but the test finished without stopping there, which means that it didn't even go in.
self.check_response('/track/%d/user/playlists/' % 14)
You're still using a regular expression in 2 because of the 'r'.
Make it like this:
path('track/<int:track_id>/user/playlists', views.music),
More details can be found here.

Opencart orders not importing to ShipStation

My Opencart store has stopped importing orders to ShipStation ever since I updated my Journal theme. I know I probably have to update OpenCart which I am hiring someone to do but I need a workaround till then. Thank you in advance.
I get this error from ShipStation:
"An error occurred attempting to update orders: Invalid XML. Error: 'There are multiple root elements. Line 3, position 14.' We received: ' Journal Installation Error You are using an outdated OpenCart 2.x version. Journal only works with the latest Opencart 2.x version.Please download and install'"
The error log on my Opencart shipstation backend says this:
2016-07-20 12:27:06 - PHP Notice: Undefined offset: 1 in /home/garagist/public_html/store/shipstation/controller/export.php on line 23
Journal support said this to fix it and I have no idea how to do that:
You need to edit /shipstation/config.php file and add this line (anywhere in it), so the Journal engine won't be loaded for that extension:
define('BLOCK_JOURNAL', true);
First you installed the wrong version of Journal. I am very familiar with it and I know the developers provide a template for each version in the zip file from codecanyon. Even if you were running 1.5x, it's in there. Fix that problem first.
Second, ShipStation has nothing to do with journal, you have server issues now (probably due to the incorrect version of journal). I've never had to block journal from the ShipStation config file. That's probably why it isn't working.
FYI, I have around 5 shops and over 10 clients running journal and shipstation, no isuses at all ever. Versions range from OC 1.5-2.3.0.2.
You don't need to upgrade, don't pay if you don't have to.
Update: From Journal Directly "Compatible with Opencart: 1.5.4.x / 1.5.5.x / 1.5.6.x / 2.0.x / 2.1.x / 2.2.x / 2.3.x" Seems counterintuitive to support 2.0x if they're going to force you to update your OC installation when the theme is installed doesn't it?
Good luck.

I'm getting "'utf8' codec can't decode byte #x96: invalid start byte" error in GAE Launcher

I am getting an error message when trying to run my Python API via the Google App Engine Launcher. I'm following a set of instructions by "Ashutosh KS" to launch a website on the Google Server that I found at http://www.hongkiat.com/blog/host-website-google-server/.
I get the error message below when I run the App.yaml file.
google.appengine.api.yaml_errors.EventListenerYAMLError: 'utf8' codec can't decode byte #x96: invalid start byte
in "C:\healygeoscience\app.yaml", position 99
2015-02-17 01:48:53 (Process exited with code 1)
When I attempt to deploy the API, I also get the following error.
appcfg.py: error: Error parsing C:\healygeoscience\app.yaml: 'utf8' codec can't decode byte #x96: invalid start byte
in "C:\healygeoscience\app.yaml", position 99.
2015-02-17 01:50:04 (Process exited with code 2)
My App.yaml file is as follows:
application: healygeoscience
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
– url: /
static_files: www/index.html
upload: www/index.html
– url: /
static_dir: www
libraries:
– name: webapp2
verssion: "2.5.2"
The website is a single page website based on the Ceevee template from http://www.styleshout.com/demo/?theme=ceevee., which I edited with TextPad. The website is operational when run locally, although I have to refresh several times to get all images to appear - possibly significant ?
From reading other questions on Stackoverflow, I realise that the error is due to an issue of encoding, and am wondering if the statement on line 8 in the header section of the index.html file is significant. Some posts suggest decode from charset=ISO-8859-1 to unicode. Can you explain and offer code? From TextPad, I have saved index.html file in UTF-8 and Unicode, and from WordPad I saved App.yaml to Unicode Text Document , but error persists!
Does position 99 refer to line numbers, and if so, does this include the fourteen lines of code in App.yaml, and also include blank lines in App.yaml and index.html? How do I locate the string with #x96.
I suspect a lot of novices trying to set up personal and business websites will encounter this issue, so it would probably be very beneficial if someone could offer some advice to a complete Python novice.
RaymondHealy
If you copied the contents of the app.yaml from the hongkiat walkthrough before editing, you need to retype the '-' characters.
There are many subtly different characters that resemble '-' and are automatically 'corrected' by many text editors, in this case those in the walkthrough are not recognised.
99 refers to the character number. You can find which character is referred to by reading the file into a Python interpreter and selecting 99:
file_contents = open('app.yaml').read()
print(file_contents[99])

UnicodeDecodeError in django 1.6 and allauth

I'm trying to run a django website on my local computer. It works fine on an external server, but I didn't set it up and right now I don't have access to all the specs.
The issue I have is when I try to log in the web site as a user, which has been defined. Running in debug mode I get a detailed error page containing on top the message:
UnicodeDecodeError at /accounts/login/
'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
Looking down I can see that the error occurs in crypto.py, function salted_hmac at the line
key = hashlib.sha1((key_salt + secret).encode('utf-8')).digest()
and displaying the local variables I see
key_salt u'django.contrib.sessionsSessionStore'
secret '\xe2\x80\x9cXXX"'
value '{}'
where XXX is a 50 character string identical to the SECRET_KEY defined in my configuration file. Variable secret is assigned in the function through:
if secret is None:
secret = settings.SECRET_KEY
and I know that secret is None at this point since it is a third parameter in salted_hmac not used by the caller. I strongly suspect that the error occurs because python can not handle the unicode characters at the beginning of the variable secret.
So I have a few questions:
1) Why is setting.SECRET_KEY different from the SECRET_KEY I defined in the configuration file? Is it how it should be? And if it is do I have any control over what it should be?
2) Could something in my environment be responsible for this?
A few notes: As I mentioned it works on a server, running ubuntu 1.6, python 2.7. However I can not right now obtain the info on the versions for the other packages. But even if I could I still want to know why it doesn't work on my installation. I have tested with django 1.6.1, python 2.7 on lubuntu 14.04, opensuse 13.2, with identical results.
Thanks for any help or hint.
a
Problem solved: the secret key in my configuration file started with an (unicode) opening quote, instead of a regular double quote, probably a result of copying and pasting the original file that had been written with an editor that uses these "smarter" quotes.

Invalid CFML construct error with Simple ColdBox Application

I want to make a simple ColdBox application. So I used the instructions in this link and downloaded coldbox_3.5.2. But when I try to view this url in my browser:
http://127.0.0.1/coldbox_3.5.2/samples/
I am getting following error :
Invalid CFML construct found on line 28 at column 22.
ColdFusion was looking at the following text:
{
The CFML compiler was processing:
A script statement beginning with this.flash on line 28, column 9.
A cfscript tag beginning on line 12, column 2.
As I am trying this for the first time, I have no idea what is causing the error. Can anyone help me understand the error?
The error is because CF8 (build 8,0,0,176276) did not support nested inline structs.
As per its requirements, ColdBox needs CF 8.0.1 (build 8,0,1,195765) or above.
http://wiki.coldbox.org/wiki/Installation.cfm