White space fix. I am a bit compulsive about that thing.

This commit is contained in:
Mustafa Arıcı 2011-06-20 18:07:24 +00:00
parent 26f728ac0a
commit 5dbd714a36
3 changed files with 11 additions and 11 deletions

View File

@ -80,7 +80,7 @@ class Handler:
if node.nodeName == "label": if node.nodeName == "label":
self.label = child.toxml() self.label = child.toxml()
if node.nodeName == "face": if node.nodeName == "face":
self.face = child.toxml() self.face = child.toxml()

View File

@ -84,7 +84,7 @@ class Entries (models.Model):
class Meta: class Meta:
ordering = ['-date'] ordering = ['-date']
def sanitize(self, data): def sanitize(self, data):
p = re.compile(r'<[^<]*?/?>') p = re.compile(r'<[^<]*?/?>')
return p.sub('', data) return p.sub('', data)

View File

@ -7,17 +7,17 @@ __author__ = ['Oguz Yarimtepe <oguzy@gmail.com>', 'Mustafa Arici <cad@mustafaari
from djagen.collector.models import * from djagen.collector.models import *
class PlanetHandler(): class PlanetHandler():
def __init__(self,planet): def __init__(self,planet):
self.channels = planet.channels() self.channels = planet.channels()
def run(self): def run(self):
for channel in self.channels: for channel in self.channels:
self.author_ch = self.__DeliverChannelToDB(channel) self.author_ch = self.__DeliverChannelToDB(channel)
for item in channel.items(): for item in channel.items():
self.__DeliverItemToDB(item,self.author_ch) self.__DeliverItemToDB(item,self.author_ch)
self.__DeliverRunTimeToDB() self.__DeliverRunTimeToDB()
def __DeliverChannelToDB(self,channel): def __DeliverChannelToDB(self,channel):
""" This def. writes author and channel related bits into the DB. """ This def. writes author and channel related bits into the DB.
You should provide at least a channel from planet.channels() You should provide at least a channel from planet.channels()
@ -34,7 +34,7 @@ class PlanetHandler():
except: except:
author.author_surname = '' author.author_surname = ''
author.channel_url = channel.url author.channel_url = channel.url
try: try:
author.author_face = channel.face author.author_face = channel.face
except: except:
@ -51,12 +51,12 @@ class PlanetHandler():
author.channel_link = channel.link author.channel_link = channel.link
except: except:
author.channel_link = None author.channel_link = None
try: try:
author.channel_urlstatus = channel.url_status author.channel_urlstatus = channel.url_status
except: except:
author.channel_urlstatus = None author.channel_urlstatus = None
if channel.label == "Personal": if channel.label == "Personal":
author.label_personal = 1 author.label_personal = 1
if channel.label == "LKD": if channel.label == "LKD":
@ -67,7 +67,7 @@ class PlanetHandler():
author.label_eng = 1 author.label_eng = 1
author.save() author.save()
return author return author
def __DeliverItemToDB(self,item,author): def __DeliverItemToDB(self,item,author):
""" This def. writes entry and item related bits into the DB. """ This def. writes entry and item related bits into the DB.
You should provide at least a an existing author object-model and an item from channel You should provide at least a an existing author object-model and an item from channel
@ -106,8 +106,8 @@ class PlanetHandler():
entry.date = datetime.datetime(d[0], d[1], d[2], d[3], d[4], d[5]) entry.date = datetime.datetime(d[0], d[1], d[2], d[3], d[4], d[5])
entry.save() entry.save()
return entry return entry
def __DeliverRunTimeToDB(self): def __DeliverRunTimeToDB(self):
""" Passes the time to DB, which this script has runned at.""" """ Passes the time to DB, which this script has runned at."""
r = RunTime() r = RunTime()
r.save() r.save()