Fedora-Packages: My new coding adventure world!

I have started working on the fedora packages App which is built on the top of the python-turbo gear framework. So this was a new framework to me but in past i had worked on Python-Flask and Rails that helped me to pick up turbogear in good pace.

First question would be why python-turbogear? I would like to give the answer from the official documentation and will help some of it which i have found quite interesting: because

  • Real multi-database support
  • Support for Horizontal data partitioning (aka, sharding)
  • Support for a variety of JavaScript toolkits, and new widget system to make building ajax heavy apps easier
  • Support for multiple data-exchange formats
  • Built in extensibility via standard WSGI components
  • Programmer friendly template system that also works for designers

The task was to “Embed the Datagrepper html messages into the fedora-packages overview tab”. Initially when i was looking through the project and found that it would be challenging to do the task as i was a newbie to the framework and also didn’t have any idea where to start from. So with my past experience i started with small means followed the documentation and built a “hello world” sample App. I started tweaking things into it and finally after 6 hours of struggle i got the turbogear things into my head.

Now i started working on the fedora packages app and added the link to the message card in the search result. When i showed this to my mentor he suggested me to link it into the overview tab of a package and the file which needed to be changes was search_results.mak, overview.py and details.mak.

I have added these lines of code.

  • ¬†details.mak
<div class="history-block">
    <h3>History</h3>
    <div class="history-cards">
    <a href="${w.history | n}"> Message Cards </a>
    </div>
</div>
  • overview.py
@property
def history(self):
    # html cards link of datagrepper
    datagrepper_link = "http://localhost:5000/raw?order=desc&rows_per_page=5&package="
    pkg_name = self.kwds['package_name']
    return str(datagrepper_link + pkg_name)

Then instead of the link to messages i had to embed the messages in the overview tab.

These were the final changes i made

  • overview.py
@property
def history(self):
    url = tg.config.get('datagrepper_url')
    package = str(self.kwds['package_name'])
    headers = dict(accept='text/html')
    params = dict(order='desc', rows_per_page=5, package=package, chrome='false')
    response = requests.get(url, headers=headers, params=params)
    return {'status_code':response.status_code, 'headers': response.headers, 'text': response.text}

The History messages were supposed to look like the Recent events on this link.Also we need to make things look better and So i have worked on CSS to improve that.

I added the following css

/* history cards */

.message-card {
min-height: 52px;
}

.history-cards img {
height: 25px;
width: 20px;
margin: 2px auto;
}

.history-cards p {
display: inline;
}

Finally the apps looked like this.

Screenshot from 2014-02-06 17:32:00

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s