Code Monkey home page Code Monkey logo

colab-superarchives-plugin's Introduction

Colab, a Software for Communities

https://travis-ci.org/colab/colab.svg?branch=master https://coveralls.io/repos/colab/colab/badge.png?branch=master

What is Colab?

Application that integrates existing systems to represent the contributions of the members through:

  • The amendments to the Wiki trac system.
  • Changes to the trac system code.
  • Discussions at the mailman list.
  • And other systems in the community.

Features

Installation

First install the dependencies and than the project it self:

pip install -e .

Development environment

You must install vagrant to set up the development environment. With vagrant available you should run:

vagrant up

During the process you should choose the vagrant box that you want to use. In the end you should have a virtual machine with development environment set up.

Running Colab

To run Colab with development server you will have to:

1- Log in virtual machine:

vagrant ssh

2- Use colab virtualenv:

workon colab

3- Run the development server:

colab-admin runserver 0.0.0.0:8000

Now you can access colab in your browser via http://localhost:8000

NOTE: In case you want to keep the configuration file else where just set the desired location in environment variable COLAB_SETTINGS.

About test

How to write a test

Inside of each folder on /vagrant/colab/<folder> you can create a folder called "tests" and inside of it implements the code for test each file. Remember that you should create __init__.py file.

How to run the tests

Follow the steps below:

1- Log in virtual machine:

vagrant ssh

2- Use colab virtualenv:

workon colab

3- Enter into colab source code directory:

cd /vagrant

4- Run tests with setup.py:

python setup.py test

How to run Acceptance Tests

Follow the steps below to run the acceptance tests.

1- Log in virtual machine:

1.1 - To run without opening a graphic interface

vagrant ssh

1.2 - To run opening a graphic interface

vagrant ssh -- -X

2- Use colab virtualenv:

workon colab

3- Enter into colab source code directory:

cd /vagrant

4- Run all the acceptance tests with:

COLAB_SETTINGS=tests/colab_settings.py colab-admin behave

4.1 To run without opening a browser: .. code-block:

COLAB_SETTINGS=tests/colab_settings.py xvfb-run -a colab-admin behave

4.2 To run a specific feature:

COLAB_SETTINGS=tests/colab_settings.py colab-admin behave /path/to/features/file.feature

colab-superarchives-plugin's People

Contributors

alexandreab avatar caiquepereira avatar chaws avatar emiliemorais avatar gustjc avatar italopaiva avatar matheus-fga avatar matheusfaria avatar ziul avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

mes-2016-1

colab-superarchives-plugin's Issues

Find a way to generate thread data for rss

On colab/rss/feeds.py:
class LatestThreadsFeeds(Feed):
title = _(u'Latest Discussions')
link = '/rss/threads/latest/'

def items(self):
return Thread.objects.all()[:20]

def item_link(self, item):
return item.latest_message.url

def item_title(self, item):
title = '[' + item.mailinglist.name + '] '
title += item.latest_message.subject_clean
return title

def item_description(self, item):
return item.latest_message.body

class HottestThreadsFeeds(Feed):
title = _(u'Discussions Most Relevance')
link = '/rss/threads/hottest/'

def items(self):
return Thread.highest_score.all()[:20]

Thread comes from super_archives. figure out a way of doing with plugin

Move fixture data from Colab to here

Here's the fixture data found in colab related to super_archives
{
"fields": {
"logo": "",
"description": "",
"last_imported_index": 0,
"name": "ListA",
"email": "[email protected]"
},
"model": "super_archives.mailinglist",
"pk": 1
},
{
"fields": {
"logo": "",
"description": "",
"last_imported_index": 0,
"name": "ListB",
"email": "[email protected]"
},
"model": "super_archives.mailinglist",
"pk": 2
},
{
"fields": {
"logo": "",
"description": "",
"last_imported_index": 0,
"name": "ListC",
"email": "[email protected]"
},
"model": "super_archives.mailinglist",
"pk": 3
},
{
"fields": {
"spam": false,
"subject_token": "Thread_1_on_List_A",
"mailinglist": 1,
"score": 31,
"latest_message": 3
},
"model": "super_archives.thread",
"pk": 1
},
{
"fields": {
"spam": false,
"subject_token": "Thread_1_on_List_B",
"mailinglist": 2,
"score": 0,
"latest_message": 4
},
"model": "super_archives.thread",
"pk": 3
},
{
"fields": {
"spam": false,
"subject_token": "Thread_1_on_List_C",
"mailinglist": 3,
"score": 0,
"latest_message": 5
},
"model": "super_archives.thread",
"pk": 4
},
{
"fields": {
"body": "This is a repply to Thread 1 on list A",
"received_time": "2015-01-28T12:43:00.752Z",
"from_address": 1,
"thread": 1,
"spam": false,
"subject_clean": "Response to Thread 1A",
"message_id": "loreipsum",
"subject": "Response to Thread 1A"
},
"model": "super_archives.message",
"pk": 3
},
{
"fields": {
"body": "This is a repply to Thread 1 on list B",
"received_time": "2015-01-28T12:57:22.180Z",
"from_address": 1,
"thread": 3,
"spam": false,
"subject_clean": "Message 1 on Thread 1B",
"message_id": "",
"subject": "Message 1 on Thread 1B"
},
"model": "super_archives.message",
"pk": 4
},
{
"fields": {
"body": "This is a repply to Thread 1 on list C",
"received_time": "2015-01-28T13:02:12.903Z",
"from_address": 1,
"thread": 4,
"spam": false,
"subject_clean": "Message 1 on Thread 1C",
"message_id": "",
"subject": "Message 1 on Thread 1C"
},
"model": "super_archives.message",
"pk": 5
},
{
"fields": {
"real_name": "Administrator",
"user": 1,
"md5": "edb0e96701c209ab4b50211c856c50c4",
"address": "[email protected]"
},
"model": "super_archives.emailaddress",
"pk": 1
}

Find a way to get email md5 for avatar

On colab/accounts/templatetags/gravatar.py:
try:
email = EmailAddress.objects.get(address=email)
except EmailAddress.DoesNotExist:
pass

email_md5 = getattr(email, 'md5', 'anonymous')

it's using super_archives to generate md5 and get gravatar image, let's try to find a way of doing so with plugin

Find a way to validate user email on creation

On colab/accounts/views.py there's:
email = EmailAddressValidation.create(user.email, user)

location = reverse('archive_email_view',
kwargs={'key': email.validation_key})
verification_url = request.build_absolute_uri(location)
EmailAddressValidation.verify_email(email, verification_url)

Check if the user's email have been used previously

in the mainling lists to link the user to old messages

email_addr, created = EmailAddress.objects.get_or_create(
address=user.email)
if created:
email_addr.real_name = user.get_full_name()

email_addr.user = user
email_addr.save()

Let's try to find a way to do email validation using plugin

Find a way to populate ColabSearchForm

in colab/search/forms.py there's the following content:
list = forms.MultipleChoiceField(
required=False,
label=_(u'Mailinglist'),
choices=[('TODO', 'TODO')]

choices=[(v, v) for v in MailingList.objects.values_list(

'name', flat=True)]

)
Let's try to find a way to do it using plugin instead

Implement superarchives as dataimporter

This means that superarchives now has to behave like any other colab-plugi-ish, i.e., implementing data_import and creating models so Colab knows what's in superarchives.

Check some way of incremental importing instead of importing the whole thing over and over.

Move emailaddress model to Colab

In colab-superarchives-plugin/src/colab_superarchives/models.py there is:
class EmailAddressValidation(models.Model):
address = models.EmailField(unique=True)
user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True,
related_name='emails_not_validated')
validation_key = models.CharField(max_length=32, null=True,
default=get_validation_key)
created = models.DateTimeField(auto_now_add=True)

class Meta:
    unique_together = ('user', 'address')

@classmethod
def create(cls, address, user):
    email_address_validation = cls.objects.create(address=address,
                                                  user=user)
    return email_address_validation

@classmethod
def verify_email(cls, email_address_validation, verification_url):
    return email.send_verification_email(
        email_address_validation.address,
        email_address_validation.user,
        email_address_validation.validation_key,
        verification_url
        )

and others related to email. Move those to Colab core.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.