当前位置: 首页>>代码示例>>Python>>正文


Python Setting.get方法代码示例

本文整理汇总了Python中wouso.core.config.models.Setting.get方法的典型用法代码示例。如果您正苦于以下问题:Python Setting.get方法的具体用法?Python Setting.get怎么用?Python Setting.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wouso.core.config.models.Setting的用法示例。


在下文中一共展示了Setting.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set_custom_theme

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
def set_custom_theme(player, theme):
    from wouso.utils import get_themes
    from wouso.core.config.models import Setting
    if theme in get_themes():
        Setting.get('theme_user_%d' % player.id).set_value(theme)
        return True
    return False
开发者ID:AndreiRO,项目名称:wouso,代码行数:9,代码来源:__init__.py

示例2: chat_scripts

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
def chat_scripts():
    """
    Dump the chat scris
    :return:
    """
    if settings.CHAT_ENABLED and not Setting.get('disable-Chat').get_value():
        return render_to_string('chat/setup.html', {'chat_host': Setting.get('chat_host').get_value(),
                                                    'chat_port': Setting.get('chat_port').get_value(),
                                                    'basepath': settings.FORCE_SCRIPT_NAME,
        })
    return ''
开发者ID:AndreiRO,项目名称:wouso,代码行数:13,代码来源:chat.py

示例3: coin_top_settings

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
    def coin_top_settings(cls):
        """
        Return a list of coin names for which we calculate the top

        Example: ['gold', 'karma']
        """
        return [c for c in Setting.get('top-coins').get_value().split(',') if c] or []
开发者ID:ArmandNM,项目名称:wouso,代码行数:9,代码来源:models.py

示例4: read

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
 def read(self, request):
     api = {
         'api_version': API_VERSION,
         'title': Setting.get('title').get_value(),
         'authenticated': request.user.is_authenticated()
     }
     return api
开发者ID:ArmandNM,项目名称:wouso,代码行数:9,代码来源:handlers.py

示例5: render_zone

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
def render_zone(context, zone, glue):
    """
    :return: HTML for the sidebar
    """
    s = get_library(zone)
    order = [k for k in Setting.get('%s-order' % zone).get_value().split(',') if k]
    if not order:
        order = s.get_blocks()
    return glue.join([s.get_block(block, context) for block in order])
开发者ID:AndreiRO,项目名称:wouso,代码行数:11,代码来源:ui.py

示例6: handle

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
    def handle(self, *args, **options):
        self.stdout.write('Starting at: %s\n' % datetime.now())

        # Now handle other apps
        from wouso.interface import get_apps
        apps = get_apps()

        for a in apps:
            self.stdout.write('%s ...\n' % a.name())
            a.management_task(stdout=self.stdout)

        # Now handle games
        for g in get_games():
            if g.management_task:
                self.stdout.write('%s ...\n' % g.name())
                g.management_task(stdout=self.stdout)

        now = datetime.now()
        Setting.get('wousocron_lastrun').set_value('%s' % now)
        self.stdout.write('Finished at: %s\n' % now)
开发者ID:ciprianf,项目名称:wouso,代码行数:22,代码来源:wousocron.py

示例7: get_theme

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
def get_theme():
    """
     Return the current theme
    """
    global _theme

    if _theme is None:
        from wouso.core.config.models import Setting
        return Setting.get('theme').value

    return _theme
开发者ID:cvicentiu,项目名称:wouso,代码行数:13,代码来源:__init__.py

示例8: setup_user_groups

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
def setup_user_groups():
    # Assistants group, 'Staff'
    staff = Group.objects.get_or_create(name='Staff')[0]
    cpanel_perm = Permission.objects.get(codename='change_setting')
    staff.permissions.add(cpanel_perm)

    # Default entry race, 'Unaffiliated'
    unaffiliated = Race.objects.get_or_create(name='Unaffiliated')[0]
    unaffiliated.can_play = False
    unaffiliated.save()
    default_race = Setting.get('default_race')
    default_race.set_value(str(unaffiliated.pk))
开发者ID:ArmandNM,项目名称:wouso,代码行数:14,代码来源:utils.py

示例9: get_context_data

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
    def get_context_data(self, **kwargs):
        from wouso.games.quest.models import Quest, QuestGame
        from django import get_version
        from wouso.settings import WOUSO_VERSION, DATABASES
        from wouso.core.config.models import Setting

        database = DATABASES['default'].copy()
        database_engine = database['ENGINE'].split('.')[-1]
        database_name = database['NAME']

        future_questions = Schedule.objects.filter(
            day__gte=datetime.datetime.now())
        nr_future_questions = len(future_questions)
        questions = Question.objects.all()
        nr_questions = len(questions)
        active_quest = QuestGame().get_current()
        total_quests = Quest.objects.all().count()

        # artifacts
        artifact_groups = ArtifactGroup.objects.all()

        # admins
        staff_group, new = auth.Group.objects.get_or_create(name='Staff')

        # wousocron last_run
        last_run = Setting.get('wousocron_lastrun').get_value()
        if last_run == "":
            last_run = "wousocron was never run"

        # online members
        oldest = datetime.datetime.now() - datetime.timedelta(minutes=10)
        online_last10 = Player.objects.filter(last_seen__gte=oldest).order_by(
            '-last_seen')

        # number of players which can play
        cp_number = Player.objects.filter(race__can_play=True).count()

        context = super(StatusView, self).get_context_data(**kwargs)
        context.update({'nr_future_questions': nr_future_questions,
                        'nr_questions': nr_questions,
                        'active_quest': active_quest,
                        'total_quests': total_quests,
                        'artifact_groups': artifact_groups,
                        'django_version': get_version(),
                        'wouso_version': WOUSO_VERSION,
                        'database_engine': database_engine,
                        'database_name': database_name,
                        'staff': staff_group,
                        'last_run': last_run,
                        'online_users': online_last10,
                        'cp_number': cp_number})
        return context
开发者ID:TobyWanKenobi,项目名称:wouso,代码行数:54,代码来源:views.py

示例10: render_header

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
def render_header(context):
    s = get_library('header')
    order = [k for k in Setting.get('header-order').get_value().split(',') if k]
    if not order:
        order = s.get_blocks()
    content = ''
    for block in order:
        data = s.get_block(block, context)
        if not data:
            continue
        content += '<span id="head-%s"><a href="%s">%s' % (block, data.get('link', ''), data.get('text', ''))
        if data.get('count', 0):
            content += '<sup class="unread-count">%s</sup>' % data.get('count')
        content += '</a></span> '
    return content
开发者ID:AndreiRO,项目名称:wouso,代码行数:17,代码来源:ui.py

示例11: dashboard

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
def dashboard(request):
    from wouso.games.quest.models import Quest, QuestGame
    from django import get_version
    from wouso.settings import WOUSO_VERSION
    from wouso.core.config.models import Setting

    future_questions = Schedule.objects.filter(day__gte=datetime.datetime.now())
    nr_future_questions = len(future_questions)

    questions = Question.objects.all()
    nr_questions = len(questions)
    active_quest = QuestGame().get_current()
    total_quests = Quest.objects.all().count()

    # artifacts
    artifact_groups = ArtifactGroup.objects.all()

    # admins
    staff_group, new = auth.Group.objects.get_or_create(name='Staff')

    # wousocron last_run
    last_run = Setting.get('wousocron_lastrun').get_value()
    if last_run == "":
        last_run="wousocron was never run"

    # online members
    oldest = datetime.datetime.now() - datetime.timedelta(minutes = 10)
    online_last10 = Player.objects.filter(last_seen__gte=oldest).order_by('-last_seen')

    # number of players which can play
    cp_number = Player.objects.filter(race__can_play=True).count()

    return render_to_response('cpanel/index.html',
                              {'nr_future_questions' : nr_future_questions,
                               'nr_questions' : nr_questions,
                               'active_quest': active_quest,
                               'total_quests': total_quests,
                               'module': 'home',
                               'artifact_groups': artifact_groups,
                               'django_version': get_version(),
                               'wouso_version': WOUSO_VERSION,
                               'staff': staff_group,
                               'last_run': last_run,
                               'online_users': online_last10,
                               'cp_number': cp_number,
                               },
                              context_instance=RequestContext(request))
开发者ID:TomyRO,项目名称:wouso,代码行数:49,代码来源:views.py

示例12: render_zone

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
def render_zone(context, zone, glue):
    """
    :return: HTML for the sidebar
    """
    s = get_library(zone)
    order = [k for k in Setting.get('%s-order' % zone).get_value().split(',') if k]
    if not order:
        order = s.get_blocks()

    # Do not print blocks with empty contents.
    non_empty_block_contents = []
    for block in order:
        content = s.get_block(block, context)
        if content and not content.isspace():
            non_empty_block_contents.append(content)

    return glue.join(non_empty_block_contents)
开发者ID:ArmandNM,项目名称:wouso,代码行数:19,代码来源:ui.py

示例13: dashboard

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
def dashboard(request):
    from wouso.games.quest.models import Quest, QuestGame
    from django import get_version
    from wouso.settings import WOUSO_VERSION
    from wouso.core.config.models import Setting

    future_questions = Schedule.objects.filter(day__gte=datetime.datetime.now())
    nr_future_questions = len(future_questions)

    questions = Question.objects.all()
    nr_questions = len(questions)
    active_quest = QuestGame().get_current()
    total_quests = Quest.objects.all().count()

    # artifacts
    artifact_groups = ArtifactGroup.objects.all()

    # admins
    staff_group, new = auth.Group.objects.get_or_create(name='Staff')

    # wousocron last_run
    last_run = Setting.get('wousocron_lastrun').get_value()

    return render_to_response('cpanel/index.html',
                              {'nr_future_questions' : nr_future_questions,
                               'nr_questions' : nr_questions,
                               'active_quest': active_quest,
                               'total_quests': total_quests,
                               'module': 'home',
                               'artifact_groups': artifact_groups,
                               'django_version': get_version(),
                               'wouso_version': WOUSO_VERSION,
                               'staff': staff_group,
                               'last_run': last_run,
                               },
                              context_instance=RequestContext(request))
开发者ID:taygun,项目名称:wouso,代码行数:38,代码来源:views.py

示例14: post

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
 def post(self, request):
     data = request.POST['display']
     blocks = ','.join([b.strip() for b in data.split(',') if b.strip()])
     Setting.get('sidebar-order').set_value(blocks)
     return redirect('cpanel_display')
开发者ID:TobyWanKenobi,项目名称:wouso,代码行数:7,代码来源:views.py

示例15: get_theme_dir

# 需要导入模块: from wouso.core.config.models import Setting [as 别名]
# 或者: from wouso.core.config.models.Setting import get [as 别名]
 def get_theme_dir(self):
     """ Note (AE): I'm unhappy with this approach, since a Setting.get
     call is done for every request. THIS must be cached somehow
     """
     theme = Setting.get('theme').value
     return os.path.join(settings.THEMES_ROOT, theme, 'templates')
开发者ID:LucianU,项目名称:wouso,代码行数:8,代码来源:loaders.py


注:本文中的wouso.core.config.models.Setting.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。