mirror of
https://github.com/djohnlewis/stackdump
synced 2025-12-16 12:53:28 +00:00
Compare commits
16 Commits
v1.1
...
import-per
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a9c4504b3 | ||
|
|
77dd2def42 | ||
|
|
75a216f5a4 | ||
|
|
bf09e36928 | ||
|
|
cdb8d96508 | ||
|
|
8e3d21f817 | ||
|
|
6469691e4b | ||
|
|
65394ac516 | ||
|
|
bcf1d7c71a | ||
|
|
d36146ae46 | ||
|
|
e1272ce58a | ||
|
|
bff7e13d83 | ||
|
|
c0766de8d4 | ||
|
|
644269dd5d | ||
|
|
6bbf0d7b28 | ||
|
|
71c875437e |
@@ -22,3 +22,6 @@ tutorial/.*$
|
||||
|
||||
# ignore the downloaded logos
|
||||
^python/media/images/logos/.*
|
||||
|
||||
# PyCharm project files
|
||||
^.idea/
|
||||
|
||||
BIN
List-StackdumpCommands.ps1
Normal file
BIN
List-StackdumpCommands.ps1
Normal file
Binary file not shown.
BIN
Run-StackdumpCommand.ps1
Normal file
BIN
Run-StackdumpCommand.ps1
Normal file
Binary file not shown.
BIN
Start-Python.ps1
Normal file
BIN
Start-Python.ps1
Normal file
Binary file not shown.
BIN
Start-Solr.ps1
Normal file
BIN
Start-Solr.ps1
Normal file
Binary file not shown.
BIN
Start-StackdumpWeb.ps1
Normal file
BIN
Start-StackdumpWeb.ps1
Normal file
Binary file not shown.
BIN
java/solr/dist/solr-4.5.0.war
vendored
BIN
java/solr/dist/solr-4.5.0.war
vendored
Binary file not shown.
@@ -246,6 +246,11 @@ class Solr(object):
|
||||
Optionally accepts ``timeout`` for wait seconds until giving up on a
|
||||
request. Default is ``60`` seconds.
|
||||
|
||||
Optionally accepts ``assume_clean`` to skip cleaning request of invalid XML
|
||||
characters. This offers a slight performance improvement, but only set this
|
||||
to ``True`` if you know your request is clean (e.g. coming from other XML
|
||||
data). Bad things will happen otherwise. Default is ``False``.
|
||||
|
||||
Usage::
|
||||
|
||||
solr = pysolr.Solr('http://localhost:8983/solr')
|
||||
@@ -253,10 +258,11 @@ class Solr(object):
|
||||
solr = pysolr.Solr('http://localhost:8983/solr', timeout=10)
|
||||
|
||||
"""
|
||||
def __init__(self, url, decoder=None, timeout=60):
|
||||
def __init__(self, url, decoder=None, timeout=60, assume_clean=False):
|
||||
self.decoder = decoder or json.JSONDecoder()
|
||||
self.url = url
|
||||
self.timeout = timeout
|
||||
self.assume_clean = assume_clean
|
||||
self.log = self._get_log()
|
||||
self.session = requests.Session()
|
||||
self.session.stream = False
|
||||
@@ -506,7 +512,10 @@ class Solr(object):
|
||||
|
||||
value = "{0}".format(value)
|
||||
|
||||
return clean_xml_string(value)
|
||||
if self.assume_clean:
|
||||
return value
|
||||
else:
|
||||
return clean_xml_string(value)
|
||||
|
||||
def _to_python(self, value):
|
||||
"""
|
||||
|
||||
@@ -26,7 +26,7 @@ import html5lib
|
||||
from html5lib.filters._base import Filter as HTML5LibFilterBase
|
||||
import markdown
|
||||
|
||||
from stackdump.models import Site, Badge, Comment, User
|
||||
from stackdump.models import Site, Badge, User
|
||||
from stackdump import settings
|
||||
|
||||
# STATIC VARIABLES
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,8 @@ SERVER_PORT = 8080
|
||||
SOLR_URL = 'http://localhost:8983/solr/stackdump/'
|
||||
|
||||
import os
|
||||
DATABASE_CONN_STR = 'sqlite://%s/../../../data/stackdump.sqlite' % os.path.dirname(__file__)
|
||||
DATABASE_CONN_STR = 'sqlite:///' + os.path.join(os.path.dirname(__file__), '..', '..', '..', 'data', 'stackdump.sqlite')
|
||||
TEMP_COMMENTS_DATABASE_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..', 'data')
|
||||
|
||||
# if the website is hosted under a subpath, specify it here. It must end with a
|
||||
# slash.
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
from sqlobject import SQLObject, UnicodeCol, DateTimeCol, IntCol, ForeignKey, \
|
||||
DatabaseIndex
|
||||
|
||||
|
||||
ISO_DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.%f'
|
||||
|
||||
|
||||
class Site(SQLObject):
|
||||
name = UnicodeCol()
|
||||
desc = UnicodeCol()
|
||||
@@ -15,34 +19,23 @@ class Site(SQLObject):
|
||||
|
||||
siteKey_index = DatabaseIndex(key, unique=True)
|
||||
|
||||
|
||||
class Badge(SQLObject):
|
||||
sourceId = IntCol()
|
||||
site = ForeignKey('Site', cascade=True)
|
||||
userId = IntCol()
|
||||
name = UnicodeCol()
|
||||
date = DateTimeCol()
|
||||
date = DateTimeCol(datetimeFormat=ISO_DATE_FORMAT)
|
||||
|
||||
class Comment(SQLObject):
|
||||
sourceId = IntCol()
|
||||
site = ForeignKey('Site', cascade=True)
|
||||
postId = IntCol()
|
||||
score = IntCol()
|
||||
text = UnicodeCol()
|
||||
creationDate = DateTimeCol()
|
||||
userId = IntCol()
|
||||
|
||||
siteId_postId_index = DatabaseIndex(site, postId)
|
||||
|
||||
json_fields = [ 'id', 'score', 'text', 'creationDate', 'userId' ]
|
||||
|
||||
class User(SQLObject):
|
||||
sourceId = IntCol()
|
||||
site = ForeignKey('Site', cascade=True)
|
||||
reputation = IntCol()
|
||||
creationDate = DateTimeCol()
|
||||
creationDate = DateTimeCol(datetimeFormat=ISO_DATE_FORMAT)
|
||||
displayName = UnicodeCol()
|
||||
emailHash = UnicodeCol()
|
||||
lastAccessDate = DateTimeCol()
|
||||
lastAccessDate = DateTimeCol(datetimeFormat=ISO_DATE_FORMAT)
|
||||
websiteUrl = UnicodeCol()
|
||||
location = UnicodeCol()
|
||||
age = IntCol()
|
||||
|
||||
@@ -19,9 +19,10 @@ from default_settings import *
|
||||
# uncomment if the default host and port for Solr is different.
|
||||
#SOLR_URL = 'http://localhost:8983/solr/stackdump/'
|
||||
|
||||
# uncomment if the database for Stackdump is not the default SQLite one
|
||||
#import os
|
||||
#DATABASE_CONN_STR = 'sqlite://%s/../../../data/stackdump.sqlite' % os.path.dirname(__file__)
|
||||
# uncomment if the database for Stackdump is not the default SQLite one or you
|
||||
# wish to have the database at a different path to the stackdump_root/data
|
||||
# directory
|
||||
#DATABASE_CONN_STR = 'sqlite:///' + path_to_the_database
|
||||
|
||||
# if the website is hosted under a subpath, specify it here. It must end with a
|
||||
# slash.
|
||||
|
||||
Reference in New Issue
Block a user