Beispiel #1
0
logging.basicConfig(level=logging.INFO)

import tdapi
from tdapi.kb import TDKnowledgeArticle

user = '******'
password = '******'


def today_str():
    return date.today().isoformat()


if __name__ == '__main__':
    td_conn = tdapi.TDUserConnection(username=user, password=password)
    tdapi.set_connection(td_conn)
    default_review_date = today_str()

    for article in TDKnowledgeArticle.objects.all():
        review_date = article.get('ReviewDateUtc')
        if review_date is None:
            logging.info("Setting review date for %s", article)
            try:
                modified_date = article.get('ModifiedDate')
                if modified_date is not None:
                    article.update({'ReviewDateUtc': modified_date})
                else:
                    article.update({'ReviewDateUtc': default_review_date})
            except tdapi.TDException:
                logging.warning("Could not update %s", article.get('ID'))
Beispiel #2
0
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(PROJECT_ROOT_DIR, 'templates'),
)

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
)

# This is rarely needed, but exists for Docker-izing this code:
if os.environ.get('MIGRATE_ONLY', False):
    SECRET_KEY = 'dummy'
else:
    import os
    SECRET_KEY = os.environ['SECRET_KEY']
    BEID = os.environ['BEID']
    WebServicesKey = os.environ['WEBSERVICESKEY']

    import tdapi
    TD_CONNECTION = tdapi.set_connection(
        tdapi.TDConnection(BEID=BEID,
                           WebServicesKey=WebServicesKey))


    TD_CLIENT_URL = os.environ['TD_CLIENT_URL']

    # this URL needs to end in '/':
    if TD_CLIENT_URL[-1] != '/':
        TD_CLIENT_URL += '/'
Beispiel #3
0
#!python
from datetime import date
import logging
logging.basicConfig(level=logging.INFO)

import tdapi
from tdapi.kb import TDKnowledgeArticle

user = '******'
password = '******'

def today_str():
    return date.today().isoformat()


if __name__ == '__main__':
    td_conn = tdapi.TDUserConnection(username=user,
                                     password=password)
    tdapi.set_connection(td_conn)
    default_review_date = today_str()
    
    for article in TDKnowledgeArticle.objects.all():
        review_date = article.get('ReviewDateUtc')
        if review_date is None:
            logging.info("Setting review date for %s", article)
            try:
                article.update({'ReviewDateUtc': default_review_date})
            except tdapi.TDException:
                logging.warning("Could not update %s", article.get('ID'))
Beispiel #4
0
STATIC_URL = '/static/'

import os

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(PROJECT_ROOT_DIR, 'templates'), )

AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', )

# This is rarely needed, but exists for Docker-izing this code:
if os.environ.get('MIGRATE_ONLY', False):
    SECRET_KEY = 'dummy'
else:
    import os
    SECRET_KEY = os.environ['SECRET_KEY']
    BEID = os.environ['BEID']
    WebServicesKey = os.environ['WEBSERVICESKEY']

    import tdapi
    TD_CONNECTION = tdapi.set_connection(
        tdapi.TDConnection(BEID=BEID, WebServicesKey=WebServicesKey))

    TD_CLIENT_URL = os.environ['TD_CLIENT_URL']

    # this URL needs to end in '/':
    if TD_CLIENT_URL[-1] != '/':
        TD_CLIENT_URL += '/'