diff options
author | Nikita Karetnikov <nikita.karetnikov@gmail.com> | 2012-08-20 09:32:54 +0400 |
---|---|---|
committer | Nikita Karetnikov <nikita.karetnikov@gmail.com> | 2012-08-20 09:32:54 +0400 |
commit | b125dac2199dd14af2c3887677c8e25c4c630499 (patch) | |
tree | d2a7006ee209d4542dedbe7bf6cdb21bf4921d56 /gstudio/management/commands | |
parent | 914f6627ed23d7ea01cd09a429193dbe5753a0da (diff) | |
download | gnowsys-b125dac2199dd14af2c3887677c8e25c4c630499.tar.gz |
Disabled sync-gbobjects.py
Diffstat (limited to 'gstudio/management/commands')
-rw-r--r-- | gstudio/management/commands/sync-gbobjects.py | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/gstudio/management/commands/sync-gbobjects.py b/gstudio/management/commands/sync-gbobjects.py index faf4274..2e8c955 100644 --- a/gstudio/management/commands/sync-gbobjects.py +++ b/gstudio/management/commands/sync-gbobjects.py @@ -13,59 +13,59 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from django.core.management.base import BaseCommand -from optparse import make_option - -import re -from datetime import datetime -from objectapp.models import Gbobject -from xmlrpclib import DateTime -from xmlrpclib import ServerProxy - -class Command(BaseCommand): - """Gets all Gbobjects for a specified server""" - option_list = BaseCommand.option_list + ( - make_option("--server", action="store", type="string", - dest="server", help="Specify an ip"),) - - def handle(self, *args, **options): - def parse_id(id=None): - def inner_parse(id): - """Gets a dict, parses and saves it""" - dict = srv.metaWeblog.dict_id(id) - pattern = "^(\d{4})(\d{2})(\d{2}).(\d{2}).(\d{2}).(\d{2})$" - - cd = DateTime().make_comparable(dict['creation_date'])[1] - lu = DateTime().make_comparable(dict['last_update'])[1] - ep = DateTime().make_comparable(dict['end_publication'])[1] - sp = DateTime().make_comparable(dict['start_publication'])[1] - - def group(value): - return value.group(1, 2, 3, 4, 5, 6) - - cd = group(re.search(pattern, cd)) - lu = group(re.search(pattern, lu)) - ep = group(re.search(pattern, ep)) - sp = group(re.search(pattern, sp)) - - def str_to_int(string): - return [int(x) for x in string] - - cd = str_to_int(cd) - lu = str_to_int(lu) - ep = str_to_int(ep) - sp = str_to_int(sp) - - dict['creation_date'] = datetime(*cd) - dict['last_update'] = datetime(*lu) - dict['end_publication'] = datetime(*ep) - dict['start_publication'] = datetime(*sp) - - Gbobject(**dict).save() - - for d in srv.metaWeblog.dict_id(): - inner_parse(d['node_ptr_id']) - - server = options["server"] - srv = ServerProxy(server, allow_none=True) - parse_id() +# from django.core.management.base import BaseCommand +# from optparse import make_option + +# import re +# from datetime import datetime +# from objectapp.models import Gbobject +# from xmlrpclib import DateTime +# from xmlrpclib import ServerProxy + +# class Command(BaseCommand): +# """Gets all Gbobjects for a specified server""" +# option_list = BaseCommand.option_list + ( +# make_option("--server", action="store", type="string", +# dest="server", help="Specify an ip"),) + +# def handle(self, *args, **options): +# def parse_id(id=None): +# def inner_parse(id): +# """Gets a dict, parses and saves it""" +# dict = srv.metaWeblog.dict_id(id) +# pattern = "^(\d{4})(\d{2})(\d{2}).(\d{2}).(\d{2}).(\d{2})$" + +# cd = DateTime().make_comparable(dict['creation_date'])[1] +# lu = DateTime().make_comparable(dict['last_update'])[1] +# ep = DateTime().make_comparable(dict['end_publication'])[1] +# sp = DateTime().make_comparable(dict['start_publication'])[1] + +# def group(value): +# return value.group(1, 2, 3, 4, 5, 6) + +# cd = group(re.search(pattern, cd)) +# lu = group(re.search(pattern, lu)) +# ep = group(re.search(pattern, ep)) +# sp = group(re.search(pattern, sp)) + +# def str_to_int(string): +# return [int(x) for x in string] + +# cd = str_to_int(cd) +# lu = str_to_int(lu) +# ep = str_to_int(ep) +# sp = str_to_int(sp) + +# dict['creation_date'] = datetime(*cd) +# dict['last_update'] = datetime(*lu) +# dict['end_publication'] = datetime(*ep) +# dict['start_publication'] = datetime(*sp) + +# Gbobject(**dict).save() + +# for d in srv.metaWeblog.dict_id(): +# inner_parse(d['node_ptr_id']) + +# server = options["server"] +# srv = ServerProxy(server, allow_none=True) +# parse_id() |