Plone Tool sets mapping

Plone Built-in Toolsets

Usually I had been using various tools like `portal_catalog`, `portal_setup` provided by CMFPlone. But all time I was curious, where those tools come from, i mean source so that i can inspect their methods, arguments, parameters etc.

  1. “MailHost”: “Products.MailHost.MailHost.MailHost”
  2. “caching_policy_manager”: “Products.CMFCore.CachingPolicyManager.CachingPolicyManager”
  3. “content_type_registry”: “Products.CMFCore.ContentTypeRegistry.ContentTypeRegistry”
  4. “error_log”: “Products.SiteErrorLog.SiteErrorLog.SiteErrorLog”
  5. “plone_utils”: “Products.CMFPlone.PloneTool.PloneTool”
  6. “portal_actions”:  “Products.CMFPlone.ActionsTool.ActionsTool”
  7. “portal_catalog”: “Products.CMFPlone.CatalogTool.CatalogTool”
  8. “portal_controlpanel”: “Products.CMFPlone.PloneControlPanel.PloneControlPanel”
  9. “portal_css”: “Products.ResourceRegistries.tools.CSSRegistry.CSSRegistryTool” [Not used in Plone 5.x any more]
  10. “portal_groupdata”: “Products.PlonePAS.tools.groupdata.GroupDataTool”
  11. “portal_groups”: “Products.PlonePAS.tools.groups.GroupsTool”
  12. “portal_javascripts” : “Products.ResourceRegistries.tools.JSRegistry.JSRegistryTool” [Not used in Plone 5.x any more]
  13. “portal_memberdata”: “Products.PlonePAS.tools.memberdata.MemberDataTool”
  14. “portal_membership”: “Products.PlonePAS.tools.membership.MembershipTool”
  15. “portal_migration”: “Products.CMFPlone.MigrationTool.MigrationTool”
  16. “portal_password_reset”: “Products.PasswordResetTool.PasswordResetTool.PasswordResetTool”
  17. “portal_properties”:  “Products.CMFPlone.PropertiesTool.PropertiesTool”
  18. “portal_quickinstaller”: “Products.CMFPlone.QuickInstallerTool.QuickInstallerTool”
  19. “portal_registration”: “Products.CMFPlone.RegistrationTool.RegistrationTool”
  20. “portal_skins”: “Products.CMFPlone.SkinsTool.SkinsTool”
  21. “portal_types”: “Products.CMFPlone.TypesTool.TypesTool”
  22. “portal_uidannotation”: “Products.CMFUid.UniqueIdAnnotationTool.UniqueIdAnnotationTool”
  23. “portal_uidgenerator”: “Products.CMFUid.UniqueIdGeneratorTool.UniqueIdGeneratorTool”
  24. “portal_uidhandler”: “Products.CMFUid.UniqueIdHandlerTool.UniqueIdHandlerTool”
  25. “portal_diff”: “Products.CMFDiffTool.CMFDiffTool.CMFDiffTool”
  26. “portal_url”: “Products.CMFPlone.URLTool.URLTool”
  27. “portal_view_customizations”: “plone.app.customerize.tool.ViewTemplateContainer”
  28. “portal_workflow”: “Products.CMFPlone.WorkflowTool.WorkflowTool”
  29. “translation_service”: “Products.CMFPlone.TranslationServiceTool.TranslationServiceTool”
  30. “portal_types”: “Products.CMFCore.TypesTool” + “Products.CMFPlone.TypesTool”

How Can I use those Tools
————————-
from Products.CMFCore.utils import getToolByName
from plone.api.portal import get as getPortal
from Acquisition import aq_inner

context = aq_inner(context) or portal or getPortal()
portal_catalog = getToolByName(context, 'portal_catalog')

Toolset Source: {eggs}/Products/CMFPlone/profiles/default/toolset.xml

PosgreSQL `hstore` problem in django django.db.utils.ProgrammingError: type “hstore” does not exist

Migration problem while using Django‘s models Hstore fileld (posgres specific)

Django version: 1.8.3

Exception: django.db.utils.ProgrammingError: type "hstore" does not exist

Solution

  1. Create a empty migration
    1. ./manage.py makemigrations –name <migration name> <app_label> –empty
    2. example migration file.
    3. Run ./manage.py migrate
    4. No create real migration

assign local role in plone through zmi

Assign local role in plone through zmi

While developing application, some times situation may come to need resource specific permission/authorization. For example, you are member of a development team, so you have a office room with 5 desks for you and your colleague, all of you have equal access to enter into the room but in case of your own desk you are the owner! and you have not same permission for other desks to do anything.

For this situation plone provides very easy solution, you can assign local role for each Archetypes content.  So let’s start your application

  1. Go http://{your portal url}/@@usergroup-userprefs and add new user normally. Oh! please remember the usename.
  2. Go http://{your portal url}/{content url}/manage_listLocalRoles . i.e http://localhost:8080/room/mydesk/manage_listLocalRoles
    1. From left `User` type that username and from right `Role` select your desired role. Don’t worry! you can assign any role even owner, manager; it is local role and will only impact on this content.
    2. North Line Hospital
  3. Go http://{your portal url}/portal_workflow/manage_selectWorkflows
    1. Click `update security settings` button bellow.

Now enjoy the benefits!

Skype problem in Ubuntu

I have faced problems several time while trying start Skype. It doesn’t open, even trying from  terminal! instead of printing this errors
skype: symbol lookup error: /usr/lib/i386-linux-gnu/libQtOpenGL.so.4: undefined symbol: _ZNK14QWidgetPrivate17hasHeightForWidthEv

Solution

  1. Open terminal type ~$ sudo nano /etc/ld.so.conf.d/skype.conf
  2. Add this line ` /usr/lib/i386-linux-gnu/mesa/` and press Ctl+X
  3. Finally ~$ sudo ldconfig -v

* My Ubuntu version 14.04 LTS, it should work since 12.04 LTS

** Common FAQ

  • Question: I have already done above & working perfectly but when applying new updates; same problem happen.
  • Answer: Don’t panic please just follow 3 no step. ~$ sudo ldconfig -v

Credit AskUbuntu

=———————————————————–=

Another problem may facing Ubuntu user for Skype, that is Skype open just for a while and stop or could be continuous restarting. [Recently 20th Dec, 2015 I faced this problem, although my OS version is Ubuntu Server 14.04 LTS ]

Solution:

  • Make sure you have sqlite3 installed in your PC. Other than you can install it easily by following this instruction
  • Go to your terminal (CTRL + ATL +  T)
  • Precaution: The following attempts will remove all of your previous files transfer history
  • $ sqlite3 ~/.Skype/[YOURUSER}/main.db
  • > sqlite> DELETE FROM Messages WHERE type=68;
  • > .quit
  • Congratulation you are done! Try to start skype.  

 

Date Time format in Python

With my long experiences in programming, we have to do lots of deal with DateTime. Here basically I will demonstrate Python’s `string to datetime` object and `datetime to string format`

from datetime import datetime

# First we will make string date to datetime object
# Example string format is: month/day/year 24hours:minute:seconds
dt = datetime.strptime("09/24/2014 23:09:44", "%m/%d/%Y %H:%M:%S")
print type(dt)
# should be <type ‘datetime.datetime’>

# Now we will produce string representation of python’s datetime object
# Format will be week day name, day, full month name, year 12hour:minute:second AM/PM
print dt.strftime("%A, %d %B, %Y%t%l:%M:%S %p")
# should be Wednesday, 24 September, 2014 11:09:44 PM

List of format directives

  • %a – abbreviated weekday name
  • %A – full weekday name
  • %b – abbreviated month name
  • %B – full month name
  • %c – preferred date and time representation
  • %C – century number (the year divided by 100, range 00 to 99)
  • %d – day of the month (01 to 31)
  • %D – same as %m/%d/%y
  • %e – day of the month (1 to 31)
  • %g – like %G, but without the century
  • %G – 4-digit year corresponding to the ISO week number (see %V).
  • %h – same as %b
  • %H – hour, using a 24-hour clock (00 to 23)
  • %I – hour, using a 12-hour clock (01 to 12)
  • %j – day of the year (001 to 366)
  • %m – month (01 to 12)
  • %M – minute
  • %n – newline character
  • %p – either am or pm according to the given time value
  • %r – time in a.m. and p.m. notation
  • %R – time in 24 hour notation
  • %S – second
  • %t – tab character
  • %T – current time, equal to %H:%M:%S
  • %u – weekday as a number (1 to 7), Monday=1. Warning: In Sun Solaris Sunday=1
  • %U – week number of the current year, starting with the first Sunday as the first day of the first week
  • %V – The ISO 8601 week number of the current year (01 to 53), where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week
  • %W – week number of the current year, starting with the first Monday as the first day of the first week
  • %w – day of the week as a decimal, Sunday=0
  • %x – preferred date representation without the time
  • %X – preferred time representation without the date
  • %y – year without a century (range 00 to 99)
  • %Y – year including the century
  • %Z or %z – time zone or name or abbreviation
  • %% – a literal % character

Courtesy: Tutorial Point

Rapid Application Development: Project Risk Management

When planning a project you hope for the best, but there is always a chance of something unexpected preventing this. Project risk management is about having the confidence of knowing what to do if the worse occurs, and what this will cost.

Project risk management consists of two key aspects: determining the risk, and designing counter measures.

Determining Risk

When determining risk there are three key aspects to consider:

  • The event causing the risk.
  • The likelihood of the event happening.
  • The impact on the plan if the event occurs.
Risk Events

When planning, it is impossible to determine every risk causing event that may occur. Many things can occur on a project, and you could spend forever trying to anticipate them all. However, as will become clear, it is not important to consider them all, you need to consider a representative selection of events that could effect a project.

Risk Likelihood

Even when we have a set of risk events, we do not generally have accurate statistics about their occurrence. It is unlikely therefore that we can determine their exact likelihood. This is a reason that a subjective scale of high, medium, or low is often used to determine likelihood. It focuses attention on those events you feel will be most likely to occur.

Risk Impact

The next step is to determine what impact a risk event may have on a project. This means determining what effect it will have on the scope, time, resource, or quality aspects of the project plan. These can vary from an annoyance through to a total catastrophe. Various scale scan be used but a similar three point scale of high, medium, or low is also often used.

Why Do It?

The process described so far appears very subjective, liable to error, and will definitely not be complete. So why do it? This is a valid question for many project plans, which just determine risk and go no further. However what we are really interested in is delivering a project plan in a way that satisfies the customer. This is the importance of the counter measures part. It states what you will do if a risk event occurs to mitigate the damage.

Designing Counter Measures

Project Risk Mitigation

When designing counter measures it will be noticed that the same counter measure can be employed to cover several different types of risk. What is more those same counter measures will most likely prove useful against risks you have not anticipated. This is the power of risk planning; by planning how to deal with the worst that you can think of, you are also providing insurance for events you have not considered. Therefore you have raised the possibility that the project will be delivered successfully.

Generic Risk Counter Measures

Risk counter measures will reduce the likelihood, the impact, or both of a risk happening. There are various generic risk counter measures that can be used to reduce risk. As an example supposing you wanted to cross a busy road in order to buy some fish and chips. Your options could be:

  • Eliminate the risk: Buy fish and frozen chips from a supermarket and cook them at home.
  • Cease the activity: Decide not to have fish and chips.
  • Reduce the likelihood: Carefully check the road and only cross when there is no traffic.
  • Reduce the impact: Wear body armour so that if you are hit then it will have less effect.
  • Early warning: Check the road to see if there is any traffic before crossing.
  • Avoid: Decide to have a pizza instead from a shop on your side of the road.
  • Share or transfer: Ring for a taxi to go and collect your fish and chips.
  • Accept risk: Just cross the road anyway.
Selecting Counter Measures

To select appropriate counter measures you check your list of risk events and consider for each of them what you could do to mitigate the effect of it happening. You start with the high likelihood and high impact events, and work down to the low likelihood and low impact events. For each consider the generic counter measures list and see if any can apply to the risk event you are considering. As an example for a test plan if there is a risk of the software being delivered to testing that does not even run, you may cease the testing activity. By documenting this in advance in the test plan all stakeholders are aware of the possibility of this extreme action. Another event may be the loss of one of the testing team. This could be covered by:

  • Reducing the likelihood, by ensuring the team are well paid, and have had a successful health check,
  • Reducing the impact, by having spare team members, or a call off arrangement with a contract agency,
  • Early warning, by having a strong system of staff appraisal, and other measures to see if staff are likely to become unavailable,
  • Accept the risk, by notifying the customer that if the event occurs then the scope, time scale, or quality standards will have to be adjusted and meeting convened to discuss.

There are other possibilities, but there are costs associated with all of them.

A Balanced Risk Management Plan

A balance must be struck between no planning, and planning to the point of project paralysis. The key is to balance the cost of the planning process, along with likely costs of counter measures, against the benefits to be delivered by the project. This can only be done in conjunction with the various stakeholders. If it is done at the start of a project it might even lead to the conclusion that the project is not worth pursuing. If it is pursued then the risk plan enables a more accurate judgment to be made about the likely overall costs. A risk management plan makes you think about what it is you want to achieve, and what you are willing to pay for it. As a result you stand a far higher chance of achieving success.

Source