mirror of
https://github.com/Screenly/Anthias.git
synced 2026-05-04 21:33:48 -04:00
Revert "Supporting unicode for player name"
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
import ConfigParser
|
||||
|
||||
|
||||
class UnicodeConfigParser(ConfigParser.RawConfigParser):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
ConfigParser.RawConfigParser.__init__(self, *args, **kwargs)
|
||||
|
||||
def write(self, fp):
|
||||
if self._defaults:
|
||||
fp.write("[%s]\n" % 'DEFAULT')
|
||||
for (key, value) in self._defaults.items():
|
||||
fp.write("%s = %s\n" % (key, unicode(value).replace('\n', '\n\t')))
|
||||
fp.write("\n")
|
||||
for section in self._sections:
|
||||
fp.write("[%s]\n" % section)
|
||||
for (key, value) in self._sections[section].items():
|
||||
if key == "__name__":
|
||||
continue
|
||||
if (value is not None) or (self._optcre == self.OPTCRE):
|
||||
key = " = ".join((key, unicode(value).replace('\n', '\n\t')))
|
||||
fp.write("%s\n" % (key))
|
||||
fp.write("\n")
|
||||
@@ -101,7 +101,6 @@ def template(template_name, **context):
|
||||
but also injects some global context."""
|
||||
|
||||
# Add global contexts
|
||||
context['player_name'] = context['player_name'].decode('utf-8')
|
||||
context['up_to_date'] = is_up_to_date()
|
||||
context['default_duration'] = settings['default_duration']
|
||||
context['default_streaming_duration'] = settings['default_streaming_duration']
|
||||
|
||||
10
settings.py
10
settings.py
@@ -1,11 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import codecs
|
||||
|
||||
from os import path, getenv
|
||||
from sys import exit
|
||||
from time import sleep
|
||||
import ConfigParser
|
||||
from lib.unicode_configparser import UnicodeConfigParser
|
||||
import logging
|
||||
from UserDict import IterableUserDict
|
||||
from flask import request, Response
|
||||
@@ -115,14 +114,13 @@ class ScreenlySettings(IterableUserDict):
|
||||
|
||||
def save(self):
|
||||
# Write new settings to disk.
|
||||
config = UnicodeConfigParser()
|
||||
config = ConfigParser.ConfigParser()
|
||||
for section, defaults in DEFAULTS.items():
|
||||
config.add_section(section)
|
||||
for field, default in defaults.items():
|
||||
self._set(config, section, field, default)
|
||||
config_file = codecs.open(self.conf_file, 'w', 'utf-8')
|
||||
config.write(config_file)
|
||||
config_file.close()
|
||||
with open(self.conf_file, "w") as f:
|
||||
config.write(f)
|
||||
self.load()
|
||||
|
||||
def get_configdir(self):
|
||||
|
||||
Reference in New Issue
Block a user