Skip to content

Commit 0b22469

Browse files
author
Jens Kadenbach
committed
Improvement of docs
1 parent 24f2e99 commit 0b22469

File tree

6 files changed

+115
-60
lines changed

6 files changed

+115
-60
lines changed

README.md

Lines changed: 0 additions & 54 deletions
This file was deleted.

README.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
About Pypo
2+
==========
3+
4+
Pypo is a self hosted bookmarking service like `Pocket`_. This is a very
5+
early alpha. There will be an android application, bookmarklets and
6+
possibly a firefox extension to add, search and view the bookmarks.
7+
8+
It's main components are built with:
9+
10+
- Python
11+
- Postgresql
12+
- Django
13+
- readability-lxml
14+
- Whoosh
15+
- django-haystack
16+
- django-taggit
17+
- tld
18+
- South
19+
- requests
20+
- djangorestframework
21+
22+
Features
23+
--------
24+
25+
- Adding links to the users own link list
26+
- Fetch summary and title from those links
27+
- Add tags
28+
- Search by title, url and tags
29+
30+
Installation
31+
------------
32+
33+
1. Create a virtualenv and
34+
35+
pip install -r requirements.txt
36+
37+
2. Setup a postgresql db
38+
3. You can overwrite the default settings by creating a
39+
settings\_local.py next to pypo/settings.py . Do not directly edit
40+
the settings.py.
41+
4. Setup the database
42+
43+
./manage.py syncdb ./manage.py migrate
44+
45+
5. Add a superuser
46+
47+
./manage.py createsuperuser
48+
49+
6. Host the application, see `Deploying Django with WSGI`_
50+
7. Create normal users with the admin interface /admin
51+
8. That should do it.
52+
53+
License
54+
-------
55+
56+
This project is licensed under the terms of the Apache License version
57+
2. See COPYING.txt for details.
58+
59+
.. _Pocket: http://www.getpocket.com
60+
.. _Deploying Django with WSGI: https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/

doc/index.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@
66
Welcome to pypo's documentation!
77
================================
88

9-
Contents:
10-
119
.. toctree::
1210
:maxdepth: 2
1311

14-
This is just a stub.
15-
16-
.. autoclass:: readme.models.Item
12+
readme_module
1713

14+
.. include:: ../README.rst
1815

1916

2017
Indices and tables

doc/readme_module.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Readme Module
2+
=============
3+
4+
Everything except for configuration.
5+
6+
Models
7+
------
8+
9+
.. automodule:: readme.models
10+
:members:
11+
12+
Scrapers
13+
--------
14+
15+
.. automodule:: readme.scrapers
16+
:members:

readme/models.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,35 @@
1616

1717

1818
class Item(models.Model):
19+
"""
20+
Entry in the read-it-later-list
21+
22+
"""
23+
#:param url Page url
1924
url = models.URLField(max_length=2000)
25+
#:param title Page title
2026
title = models.TextField()
27+
#:param created Creating date of the item
2128
created = models.DateTimeField(auto_now_add=True)
29+
#:param owner Owning user
2230
owner = models.ForeignKey(User)
31+
#:param readable_article Processed content of the url
2332
readable_article = models.TextField(null=True)
33+
#:param tags User assigned tags
2434
tags = TaggableManager(blank=True)
2535

2636
@property
2737
def summary(self):
38+
'''
39+
Shortened artile
40+
'''
2841
return strip_tags(self.readable_article)[:300]
2942

3043
@property
3144
def domain(self):
45+
"""
46+
Domain of the url
47+
"""
3248
return get_tld(self.url.encode('utf-8'), fail_silently=True)
3349

3450
def get_absolute_url(self):
@@ -38,6 +54,10 @@ def get_delete_url(self):
3854
return reverse('item_delete', args=[str(self.id)])
3955

4056
def fetch_article(self):
57+
"""
58+
Fetches a title and a readable_article for the current url.
59+
It uses the scrapers module for this and only downloads the content.
60+
"""
4161
url = self.url
4262
try:
4363
req = requests.get(url, stream=True)

readme/scrapers.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55

66
class ParserException(Exception):
7+
'''
8+
Generic exception for parsers/scrapers.
9+
Indicates that a scraper cannot succeed.
10+
'''
711
pass
812

913

@@ -34,6 +38,7 @@ def parse(item, content_type, text=None, content=None):
3438
def domain_parser(domain):
3539
"""
3640
Decorator to register a domain specific parser
41+
3742
:param domain: String
3843
:return: function
3944
"""
@@ -45,7 +50,9 @@ def decorator(func):
4550

4651
def parse_web_page(text):
4752
"""
48-
Generic wep page parser with readability
53+
Generic wep page parser with readability.
54+
Used as a fallback.
55+
4956
:param text: unicode text
5057
:return: title, article
5158
:raise ParserException:
@@ -63,6 +70,15 @@ def parse_web_page(text):
6370
@domain_parser('github.com')
6471
@domain_parser('bitbucket.org')
6572
def parse_github(item, content_type, text):
73+
"""
74+
Reads the readme of a repo if it can find one.
75+
76+
:param item: ignored
77+
:param content_type: ignored
78+
:param text: unicode text
79+
:return: title, article
80+
:raise ParserException: raised of no readme is found
81+
"""
6682
if text is None:
6783
raise ParserException('Could not decode content')
6884
doc = document_fromstring(text)

0 commit comments

Comments
 (0)